3 ms·
I can vouch for 'easy to learn': if you can already program in another language, learning Python is like being reintroduced to an old friend who has grown up q
by davidroberts 14y ago
I can vouch for 'easy to learn': if you can already program in another language, learning Python is like being reintroduced to an old friend who has grown up quite a bit since you last met him.
- EliRivers 14y agoI found the opposite. For example, I find it extraordinarily frustrating not to be able to know what kind of object something is by looking at the point in code where it is created; something like variable = somefunction(inputParameter) where variable did not exist before leaves me having to look up the documentation of somefunction to know what kind of object it is returning.
- davidroberts 14y agoHopefully, whoever defined somefunction did something like this: def somefunction(inputParameter): ''' inputParameter: List of seven positive integers representing a poker hand Returns: A positive integer used to score that hand relative to all other possible hands, better hands receive higher scores. '''
- EliRivers 14y agoYou know they didn't. These are programmers we're talking about :)
- deleted 14y ago[deleted]
- marcosdumay 14y agoWell, you'll hate it, but even after you discover what is the class of your object, you'll still have no idea what methods it implements, and what attributes it has. In Python any of that can (and do) change. Sometimes that is frustating. I suffered a lot until I understood the Django's forms API. But this feature is worth the cost.
- PasserBy2 14y agoThe secret is not to care and just hack away.
- EliRivers 14y agoThat does explain a great deal of the code and programmes I have encountered over the last decade :)
- csense 14y agoDocumentation? We don't need no stinking documentation! Try this variant: variable = somefunction(inputParameter) # the next line is a temporary debug statement print "variable has the following attributes:", dir(variable) Or this one: variable = somefunction(inputParameter) help(variable) # temporary debugging statement Or this one: help(somefunction) Or even this: variable = somefunction(inputParameter) print "the type is", type(variable) # temporary debugging statement A lot of API's use built-in objects, so quite often you don't even need anything more complicated than: variable = somefunction(inputParameter) print "variable is", variable Using a Python-aware IDE like Eclipse PyDev might help too, but it's been a while since I've personally used it so I can't say off the top of my head what feature you want. Honestly, Python is so easy to use, you don't really need an IDE at all (of course this is just my opinion on something that's purely a matter of personal taste).