4 ms·
My top 3 criticisms as an intermediate (~5 months of study) python programmer: 1. Importing behavior is ridiculous: https://chrisyeh96.github.io/2017/08/08/def
by faizshah 8y ago
My top 3 criticisms as an intermediate (~5 months of study) python programmer:
1. Importing behavior is ridiculous: https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html https://chrisyeh96.github.io/2017/08/08/definitive-guide-pyt...
2. Python libraries' documentation leave a lot to be desired (compared to good javadocs). Just because your language is dynamically typed doesn't mean you don't need to describe what the expected shape of a parameter should be.
3.
Static method? @staticmethod
Static variable? declare it outside of your methods but inside your class
Private method/var? name it: __name (but it's not really private just hard to find)
I'm sure other Java programmers have had a culture shock coming to python as well. I appreciate how concise the language is, the great community and module ecosystem, and how productive it is. But, it feels to me like there's features missing (I've only been seriously programming python for 5 months though, before I was basically just scripting and writing java code in python).
Also the most fun part of learning python has been list comprehensions and itertools, they've really been a revelation. Like when I first learned Ruby procs, blocks, closures and lambdas.
- texmex20 8y agoAs a fellow Java programmer who's picked up Python in the past year, I completely agree with these. Especially #2 -imo a dynamically typed language/library warrants having better documentation, not worse.
- lmm 8y ago> Static method? @staticmethod > Static variable? declare it outside of your methods but inside your class Sounds like you're still thinking in Java :). A static method is rarely what you want (and if you do you can put it on the class like for variables); functions are first-class so you can just put them in your module.
- laurentl 8y agoAs a former certified Java programmer, moving to Python was a breath of fresh air. More concise syntax, no more braces all over the place, much less boilerplate (think getter, setter, public static void main(String[] args)) and not everything has to be an object. First-class functions, yay ! (I haven’t used Java seriously since 1.6 so I don’t know how much the language has evolved since then). The only reason I’ve had to go back to Java is specific libraries, and speed. Python’s philosophy of convention rather than constraint is a nice chance from Java’s corseted mindset. But I’ve never had to use Python in a large development team, so I don’t know how well it holds up with a large group of devs. As an aside, if you have fun with comprehensions, itertools and lambdas, I urge you to take a look at functional programming!
- javajosh 8y agoJava has changed a great deal since 1.6, and includes something like first-class functions. But Java's main benefit over python is the JVM itself, which is extremely well specified and generally a rock-solid piece of kit. Python doesn't have a specification, or alternative implementations (AFAIK) and I think that hurts it.
- sinistersnare 8y agoPython is not specified but CPython serves as a reference implementation. Python has _numerous_ alternative implementations. Jython in Java, IronPython in C#, PyPy in Python (kinda...), and even more lesser-known implementations.
- lmm 8y agoComing from Java I loved Python's conciseness and convention, but as my codebase got larger I hit a maintainability wall where it was impossible to refactor reliably enough to keep the code clean and framework upgrades were always a massive task. Then I discovered Scala which combines the conciseness of Python (and allows you to write in a very "plain English" style if you want to, with the optional no-brackets call syntax) with the safety (and runtime and library availability) of Java.
- orf 8y agoThe solution is to stop thinking about private and static variables :) I've been developing Python for upwards of 10 years, and not one single time I have ever had a legitimate use for double underscore, and I've only seen one legitimate use in the wild (involving auto-generated code and C interfacing). You also very, very rarely need static methods.
- kemitche 8y ago> Private method/var? name it: __name (but it's not really private just hard to find) This is why I _love_ python. Stop trying to protect me from your library. I've been doing some C# work and nothing bothers me more than having to fork and re-build an entire library just because the author didn't think I should be allowed to touch some variable that should've just been `public` or `protected`. I don't need a library author to hard-block me from things. Put up the appropriate warning signs, then get out of my way.
- firefwing24 8y ago> 2. Python libraries' documentation leave a lot to be desired (compared to good javadocs). Just because your language is dynamically typed doesn't mean you don't need to describe what the expected shape of a parameter should be. Could you give examples?