Ask HN: Anyone went from PHP to Python?
1–10 of 41 posts
Re: Ask HN: Anyone went from PHP to Python?
#2Python is a great little language but even after multiple thousands of lines it still looks like the guardrails on the highway are missing, I never knew I was so addicted to curly braces.
I also find it very hard to switch from the one to the other and back again after sticking to one of the two for a while.
My 'preferred' language/framework for more complicated stuff actually does not seem to exist. I can list a whole series of problems with just about any development stack out there at the moment, at least the ones that I've used.
For quick and dirty stuff (throwaway sites or quick tests or prototypes) I still prefer PHP, but mostly because I can rely on a framework that I wrote years ago that makes it very easy to throw something together. It's far from perfect but it's the devil that I know best.
I've made three sites in python/django, it works but the ORM is very limiting and I keep hearing that forms are hell (but I rolled my own forms, so that wasn't a big deal).
I wished there was a clear winner amongst all these technologies, everybody seems to have built just enough to satisfy their particular itch.
Next on the list of stuff to try is werkzeug, another python framework.
Re: Ask HN: Anyone went from PHP to Python?
#3I did. Python is a great little language but even after multiple thousands of lines it still looks like the guardrails on the highway are missing, I never knew I was so addicted to curly braces. I also find it very hard to switch from the one to the other and back again after sticking to one of the two for a while. My 'preferred' language/framework for more complicated stuff actually does not seem to exist. I can lis…
Re: Ask HN: Anyone went from PHP to Python?
#4Here are a few things that I got tripped up by:
- I was searching for a substr? function. there is none; instead you do things like str[0:1]
- Dont Count on autocompletion (at least not in eclipse). I was hoping I could duck type things like i had done in php Eclipse and get object info autocompleted. This is not possible, so you have to keep a lot more info about objects in your head. Perhaps one way around this is to try keep all your classes in one module.
- Test with IDLE. I was used to testing php code by whipping up a single page and browsing to localhost. With appengine, and possibly your web server, this isn't justifiable when Python ships with a pretty cool cmd IDE.
hth!
Re: Ask HN: Anyone went from PHP to Python?
#5(That said, I'm using more and more Clojure for my personal stuff.)
Re: Ask HN: Anyone went from PHP to Python?
#6I've had some previous exposure to python, but nothing mission critical. I just switched from php to python about 3 weeks ago in order to deploy apps on the Google App Engine. My deepest language experience is in frontend Actionscript 3, so Python feels very similar to that in that you have imports, packages, and modules. I do still find myself typing ";" on rare occasions to end lines. Here are a few things that I g…
Tbh, PyDev for Eclipse is pretty darn good. Doesn't fail me on autocompletion, function arguments etc, except for places where objects are created dynamically. Also, I find it very handy being able to navigate to any one places in my $PYTHONPATH with one keystroke on F3 and get the documentation + the implementation to read through. Keeps me away from most documentation sites and inside the IDE.
Re: Ask HN: Anyone went from PHP to Python?
#7Once you do this, you'll be very annoyed every time you need to go back to using php. This change will be practical and eye opening for you. Enjoy.
Re: Ask HN: Anyone went from PHP to Python?
#8I did. Python is a great little language but even after multiple thousands of lines it still looks like the guardrails on the highway are missing, I never knew I was so addicted to curly braces. I also find it very hard to switch from the one to the other and back again after sticking to one of the two for a while. My 'preferred' language/framework for more complicated stuff actually does not seem to exist. I can lis…
Huh. That's not been my experience at all. I guess if you're trying to build full-strength webapps that might be the case, but we've built a decent number of fairly complex user-content-managed type sites, and Django has not caused any trouble at all. Very occasionally we step out of the ORM (usually in places we should be stepping out of RDMS in general, anyway, like tracking ad-clicks). (The ORM does now support aggregation, too - SUM(), AVG(), ad-hoc calculations etc.)
And the Forms lib is great if you're happy with default html-generation (it can do paras or tables); things get kinda fiddly when you're trying to customise layout and appearance, but it's still nice having validation, saving to the db etc. all in one place.
Re: Ask HN: Anyone went from PHP to Python?
#9I went from PHP-Nuke, to pure PHP, to Python, to handwritten Python site engines, to Google App Engine, and now finally hunkering down and getting Django under my belt, for real this time.
And that's my first tip: GAE makes a great stepping stone to Django (and even includes a sizable chunk of Django).
I have a very bad taste in my mouth from prior experience with Joomla, but I found Drupal to be very easy to use. But once I made the decision to finally learn a real framework, Python and Django made the work... almost trivial. Looking at the code for Drupal modules now makes me wonder why I let myself do all of that extra work that Django doesn't require.
I'm with jacquesm, I still use PHP from time to time for minor things, simply because there are a good amount of hosting providers that don't offer Django. But I think my experience with Python has made me a better PHP programmer. However that works. However I've never really had issues with forms, at least not with GAE, but it IS a little wonky.
self.request.get('form_field_name')Re: Ask HN: Anyone went from PHP to Python?
#10I did. Python is a great little language but even after multiple thousands of lines it still looks like the guardrails on the highway are missing, I never knew I was so addicted to curly braces. I also find it very hard to switch from the one to the other and back again after sticking to one of the two for a while. My 'preferred' language/framework for more complicated stuff actually does not seem to exist. I can lis…
You should try it for yourself and form your own opinion. I've found the declarative nature of the forms in Django to be extremely pleasant. My biggest complaint is the need for writing forms at all!