by yyyt · 14y ago · 0 comments
As we use to say in my country, "never tried things sweeter than carrot". I mean that was about me: I didn't know better things existed.
All that is done better in Python:
5. You don't need many of functions you use in PHP, for instance, _real_escape_string is not needed when you can do cursor.run("SQL Query param1=? AND param2=?", [param1, param2])
6. You can get help on functions in coding shell:
>>> help(open) # help on file opening function or even >>> open? # in IPython
With that I look into online or PDF docs quite rarely.
7. That's even faster in Python: you try things out in the shell, then save the shell session (IPython) and copy the code you need into the working file.
Moreover, while in PHP I was adding var_dump's everywhere, reloading a page 10 times before reaching the source of a bug, in Python I just do $ python -m ipdb same_script.py and have the debugging shell in the place I need, and it takes a minute of two to find the source of a bug.
No comments yet.