optional types

Chris Angelico rosuav at gmail.com
Wed Oct 29 14:43:39 EDT 2014


On Thu, Oct 30, 2014 at 5:18 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> Yes, but if it's official, the standard library (large parts of it, at
>> least) will use it, which will make it a lot more useful than it
>> currently is.
>
> I doubt it. Python should decide if it wants to stay Python or become
> another Java. I don't really believe in this "be everything for
> everybody" thing. You'll only become nothing for anybody.

Mebbe. More likely, Python wants to lift ideas from anyone and
everyone. List comprehensions came from the functional world, flexible
string representation came from Pike or bash (or was independently
invented), etc, etc.

Python won't turn into Java. The biggest philosophical difference
between the languages, as I see it, is Java's rigidity of boundaries
versus Python's consenting-adults policy. In Java, you write getters
and setters for everything, you lock your class up and make sure
people use it ONLY in the ways you've specified, you declare
parameters/return values/exceptions so people know exactly what to
expect, etc. Python gets out of your way and lets you write a single
application as a concerted whole; if you want to "reach in" and fiddle
with another class's members, go for it. I'm not saying that either
philosophy is *wrong*, of course, but just adding type hints to Python
isn't going to change the underlying philosophical model.

ChrisA



More information about the Python-list mailing list