Switching from php to python

Posted by ts on Stack Overflow See other posts from Stack Overflow or by ts
Published on 2010-05-19T23:06:29Z Indexed on 2010/05/19 23:10 UTC
Read the original article Hit count: 123

Hello

I am trying to make a list of things which can be difficult/surprising to someone who is changing language from PHP to Python.

so far i have rather short list:

  • forget require / include, learn import (this was most difficult to me - to understand package - module - class - object hierarchy and its mapping to filesystem)
  • you can't just upload file on server to have webpage (->mod_python, wsgi etc)
  • learn the python way for use variable class names (new $class() vs import + getattr)
  • / operator in python 2.x and all float-related horrors

those were difficult to me, it takes few days before mind adapts a new paradigm

after i found that there is few other areas which could be challenging for someone with (too) many years of php:

  • everything is an object
  • you have to live with exceptions
  • array vs list, set, dictionary, tuple ...
  • learn (effective) list comprehensions
  • learn generators

any other ideas / personal experiences ?

© Stack Overflow or respective owner

Related posts about python

Related posts about php