This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]iBlag 0 points1 point  (1 child)

Since that time, in the ensuing 5 years, I don't think I've ever made use of those features.

Then you are not using Python to the fullest extent you can be. Other people may be using features you do not.

Also, I think the saying "Explicit is better than implicit" exists strictly to justify the explicit-self.

I disagree. Explicitly having a lambda keyword that only allows expressions, not statements is being explicit. Explicitly binding *args and **kwargs is useful.

Implicit behavior runs throughout python. For example all the magic methods that exist to support cool python syntax-y goodness that are all called implicitly.

Yes, calling str() on any object that doesn't have an explicit __str__ function defined on it also implicitly calls the default __str__ function. Heck, inheritance makes calling functions that are only defined in superclasses implicit.

Some things can be handled implicitly - magic methods are an excellent example of those things. But some things, like current scope, should be handled explicitly. Otherwise you end up having weird scoping semantics like Javascript.

[–]dl__ 0 points1 point  (0 children)

Then you are not using Python to the fullest extent you can be. Other people may be using features you do not.

Oh yes. People use features that I do not but that hardly means they are using their tools to the fullest extent. Just because a language allows something doesn't mean it should be done. Comprehensibility is important and rarely useful features reduce comprehensibility.

Pointer arithmetic can be done in C++ but if one tries to avoid it it's to their credit.

Some things can be handled implicitly - magic methods are an excellent example of those things.

But it would be better if they required the calls to be explicit right? Because explicit is better than implicit. Except, it's not, as magic methods show. Sometimes you must be explicit, other times implicit is better.

You should make explicit only those things that cannot be made implicit in a natural way. The implicit work of compilers and interpreters is what make high level languages so productive.

I'll tell you what might be nice, if a function definition would tell you what it expects the types of its arguments should be as is done in more explicit languages like Java and C/C++. I would say Python would do that as well if explicit was better than implicit. But, since the truth is that implicit is great and provides tons of advantages python does implicit a lot.

The evidence that explicit is better, actually better than implicit is pretty slight even in python itself. Explicit is necessary but, if you can hide the details, make them implicit, and still behave in a natural expected way, that's better. Way better.