Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6
  1. #1

    Default Why I've chosen Python over PHP?

    I just thought I'd post a small article on why I've chosen Python over PHP, so let me start by saying I have been coding now for around 8 years and my first programming language I learnt was PHP (or scripting language depending on peoples opinions)
    Anyway back to the point, I love PHP and I found it to do everything I wanted, it was widely used meaning there were many different ways to solve problems, etc., I liked that PHP is so easily accessible and that most hosting comes with it, but then I look into Python.
    After working with Python for just over a year I found that the syntax was much cleaner (in my opinion), for example:
    In PHP if I wanted to do a if statement and return true if its false, I would do:
    PHP Code:
    $variable false;
    if(!
    $variable) {
        return 
    true;

    Where the syntax for Python can be:
    Code:
    variable = False
    if not variable:
        return True
    Another example I'll post was if I wanted a function to return false if the input is right

    PHP Code:
    function test($input) {
        if(
    $input == "yes") {
            return 
    true;
        } else {
            return 
    false;
        }

    Whereas in Python it would be
    Code:
    def test(input):
        if input == "Yes":
            return True
        else:
            return false
    I just overall found the syntax to be much cleaner and I know some people disagree as they would prefer to use the curly brackets instead of white spacing (Which is what most programming languages use)

    I also have several other reasons why I choose Python over PHP, for example, the framework Django, but I'd like to hear your opinions before I go onto that.

    Just wondering what other peoples opinions are on this?
    Please note, I'm not trying to start a programming language war, just curious!
    Last edited by Caughtrandomly; 30-05-2013 at 02:00 PM.

  2. #2
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Well, your code is mostly just inefficient here, no need for curly brackets if you use ternary operators.
    Chippiewill.


  3. #3

    Default

    I'm aware of that Chippiewill, but the code isn't inefficient as there simple examples of both code and yes you could use Ternary Operators (would of been easier to say PHP Shorthand) but I'm on about general PHP, as I personally don't like using shorthand most of the time.

  4. #4
    Join Date
    Oct 2006
    Posts
    9,900
    Tokens
    26,832
    Habbo
    Zak

    Latest Awards:

    Default

    I've never coded in Python but the syntax just makes it look unprofessional.

    I haven't really coded in PHP either but the syntax is clearly suit of C++ and Java. I prefer their syntaxes over what I've just seen in Python, just looks very aged.

  5. #5

    Default

    Thats a fair opinion Zak, I've done a lot of work in C#, which has a very similar syntax to PHP, and I still prefer Python over that for software development.

  6. #6
    Join Date
    Oct 2006
    Posts
    9,900
    Tokens
    26,832
    Habbo
    Zak

    Latest Awards:

    Default

    Tbh I hate PHP and I'd probably hate Python too Has Python got the versatility that PHP has?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •