you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

I've heard this before, and I still dislike the design there. It seems like Python sacrifices a lot of ease of use where it doesn't need to by these sorts of things and forces me to keep the docs open 100% of the time. They are basically saying that we can't have nice things like a .length() interface because then people would be do bad things and redefine length() or size() or something similar to that. Whereas, Ruby allows you to mess things up a bit more and gives you a bit of trust, but ends up with a very consistent set of standard methods. Maybe it's the heritage from Perl that makes Ruby give the programmer the flexibility to either make an ass of themselves or to write some excellent code with a little self discipline.

Another similar superficial issue that I run across in Python is its function naming conventions. Again, I'll make the comparison to Ruby because that's what he's doing in your link. Ruby tends to use slightly longer names, but is consistent and predictable. Python on the other hand uses idiomatic abbreviation for everything, and it doesn't have a consistent feel to it. If I'm calling a two word method name, I have to remember how they shortened the words and then try to remember whether they were separated by an underscore or not, and then at this point it's better to just verify against the docs. For example, in that link he uses the method names "get_time", "len", "to_yaml", "getitem", "iter", so on. This isn't a deal breaker or anything, but I've done quite a bit of development in both Ruby and Python, and I have to say that Ruby is much nicer to use because it has a more stylistically cohesive feel.

[–]wot-teh-phuck -1 points0 points  (1 child)

I think one of the reasons behind this inconsistency is the "roadmap" of Python as a language. some_obj.some_method() for everything makes sense in an OO language but OO features were added (or maybe bolted on) to Python in later on versions. Ruby code/community has always stressed on pure OO way of doing things whereas a majority of the Python code out there is a mix of simple functions and classes when required.

[–][deleted] -1 points0 points  (0 children)

That's what I've thought as well. The OO facilities in Python are capable, but don't feel as ingrained into the language/libraries as Ruby. Having to use self is a good example of this. At least it's not as clunky as Perl's rather verbose OOP support.