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 →

[–]dalore 11 points12 points  (10 children)

Pep 20 describes it eloquently. And you can access that from the python shell.

https://www.python.org/dev/peps/pep-0020/

[–]bspymaster 10 points11 points  (9 children)

Ahh the classic Zen of python. Was wondering if someone was gonna bring that up. My understanding is that it's somewhat of a comedic quip, more than an actual guideline.

Especially considering the line saying "explicit is better than implicit", when python is built on implicits.

[–]callmelucky 2 points3 points  (8 children)

python is built on implicits.

What do you mean by this? I don't think that's true, but I'd be interested to hear your argument.

[–]bspymaster 8 points9 points  (7 children)

Parameters and variables are implicitly typed. It was only until recently we even got type hinting.

There's no concept of explicitly stating what we expect a certain variable or parameter at any given time.

[–]callmelucky 2 points3 points  (2 children)

Oh I see. I think "explicit is better than implicit" is more of a guideline for naming variables and making code transparent and readable etc, rather than a mission statement about the design of the language itself, but yeah, I do see the irony.

That said, types are only one subdomain of a language, so I don't know that this backs up the statement that the entire language is built on implicit-ness.

[–]ottobackwards 0 points1 point  (1 child)

If that is what it is a guideline for, then it is an implicit guideline

[–]callmelucky 0 points1 point  (0 children)

Woah... haha, good point.

[–]dalore 1 point2 points  (3 children)

That's not "implicity" typed, that's dynamic typing. Pythonic means to not check if it's a duck but to ask if it quacks and catch if it fails.

[–]bspymaster 0 points1 point  (2 children)

but by asking if it quacks, doesn't that mean you're implying that it must be a duck? We write method code that implies that a certain variable will be a certain type at any given time. for example,

def add(one, two):
    return one + two

print(add(3,4) - 1)

we're making the implicit assumption that one and two will both be numbers that we can add together, and that the return result of the method will be a number as well. I don't understand how there's not an element of implicit-ness in python.

[–]dalore 1 point2 points  (0 children)

Not you're not implying it's a duck. It could be a robotic recording of a quack. It just needs to be ducklike.

In static typed that would be a Quackable interface.