Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-25 Thread Chris Angelico
On Sun, Apr 26, 2015 at 2:01 AM, Ronan Lamy ronan.l...@gmail.com wrote: * PEP484 hints are too high-level. Replacing an 'int' object with a single machine word would be useful, but an 'int' annotation gives no guarantee that it's correct (because Python 3 ints can have arbitrary size and

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-25 Thread Ronan Lamy
Le 25/04/15 04:07, Steven D'Aprano a écrit : On Sat, Apr 25, 2015 at 02:05:15AM +0100, Ronan Lamy wrote: * Hints have no run-time effect. The interpreter cannot assume that they are obeyed. I know what you mean, but just for the record, annotations are runtime inspectable, so people can (and

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-24 Thread Ronan Lamy
Le 24/04/15 19:45, Paul Sokolovsky a écrit : Hello, On Fri, 24 Apr 2015 18:27:29 +0100 Ronan Lamy ronan.l...@gmail.com wrote: PyPy's FAQ has an explanation of why type hints are not for performance. http://pypy.readthedocs.org/en/latest/faq.html#would-type-annotations-help-pypy-s-performance

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-24 Thread Kevin Modzelewski
On Fri, Apr 24, 2015 at 6:05 PM, Ronan Lamy ronan.l...@gmail.com wrote: Le 24/04/15 19:45, Paul Sokolovsky a écrit : Hello, On Fri, 24 Apr 2015 18:27:29 +0100 Ronan Lamy ronan.l...@gmail.com wrote: PyPy's FAQ has an explanation of why type hints are not for performance.

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-24 Thread Steven D'Aprano
On Sat, Apr 25, 2015 at 02:05:15AM +0100, Ronan Lamy wrote: * Hints have no run-time effect. The interpreter cannot assume that they are obeyed. I know what you mean, but just for the record, annotations are runtime inspectable, so people can (and probably have already started) to write

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-24 Thread Nick Coghlan
On 22 April 2015 at 03:03, Carol Willing willi...@willingconsulting.com wrote: 2. Clearly, great thought has been put into this PEP. If anyone has a good analysis of the potential impact on Python 3 adoption, please do pass along. I would be interested in reading the information. I don't have

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-24 Thread Ronan Lamy
Le 23/04/15 14:55, Paul Sokolovsky a écrit : Hello, On Thu, 23 Apr 2015 09:15:44 -0400 Daniel Holth dho...@gmail.com wrote: [] Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for Python. That's an example of how perceptions differ.

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-24 Thread Paul Sokolovsky
Hello, On Fri, 24 Apr 2015 18:27:29 +0100 Ronan Lamy ronan.l...@gmail.com wrote: Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for Python. That's an example of how perceptions differ. In my list, everyone(*) uses them -

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Harry Percival
lol @ the fact that the type hints are breaking github's syntax highlighter :) On 23 April 2015 at 14:44, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 23 Apr 2015 14:48:58 +0200 Wolfgang Langner tds333+py...@gmail.com wrote: Hello, On Thu, Apr 23, 2015 at 11:59 AM, Paul

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Paul Sokolovsky
Hello, On Thu, 23 Apr 2015 15:25:30 +0100 Harry Percival harry.perci...@gmail.com wrote: lol @ the fact that the type hints are breaking github's syntax highlighter :) What one can expect from software written in Ruby? ;-) -- Best regards, Paul

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Steven D'Aprano
On Thu, Apr 23, 2015 at 03:25:30PM +0100, Harry Percival wrote: lol @ the fact that the type hints are breaking github's syntax highlighter :) That just tells us that Github's syntax highlighter has been broken for over five years. Function annotations go back to Python 3.0, more than five

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Chris Barker
On Wed, Apr 22, 2015 at 5:45 PM, Guido van Rossum gu...@python.org wrote: Given that even if Difference existed, and even if we had a predefined type alias for Difference[Iterable[str], str], you' still have to remember to mark up all those functions with that annotation. It almost sounds

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Paul Sokolovsky
Hello, On Thu, 23 Apr 2015 09:15:44 -0400 Daniel Holth dho...@gmail.com wrote: [] Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for Python. That's an example of how perceptions differ. In my list, everyone(*) uses them -

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Daniel Holth
On Thu, Apr 23, 2015 at 9:55 AM, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 23 Apr 2015 09:15:44 -0400 Daniel Holth dho...@gmail.com wrote: [] Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for Python. That's

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Terry Reedy
On 4/22/2015 8:45 PM, Guido van Rossum wrote: On Wed, Apr 22, 2015 at 2:38 PM, Chris Barker chris.bar...@noaa.gov mailto:chris.bar...@noaa.gov wrote: On Tue, Apr 21, 2015 at 11:32 PM, Terry Reedy tjre...@udel.edu mailto:tjre...@udel.edu wrote: I was just thinking today that

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Florian Bruhin
* Wolfgang Langner tds333+py...@gmail.com [2015-04-23 10:43:52 +0200]: 2. Using it in the language as part of the function signature, my first thought was oh good, then I changed my mind to: oh it can be very ugly and unreadable, it is the wrong place. Now I am against it, best is, if I

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Paul Sokolovsky
Hello, On Thu, 23 Apr 2015 10:43:52 +0200 Wolfgang Langner tds333+py...@gmail.com wrote: [] Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for Python. That's an example of how perceptions differ. In my list, everyone(*) uses them -

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Wolfgang Langner
Hi, having a lot experience with Python beginners and people programming Java/Python I have also an opinion about this. ;-) First reaction was, oh good. Then I read every thread and comment about it, looked at a lot internal code give all some time and the result is: I found a lot of code

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Wolfgang Langner
Hello, On Thu, Apr 23, 2015 at 11:59 AM, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 23 Apr 2015 10:43:52 +0200 Wolfgang Langner tds333+py...@gmail.com wrote: [] Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Daniel Holth
On Thu, Apr 23, 2015 at 5:59 AM, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 23 Apr 2015 10:43:52 +0200 Wolfgang Langner tds333+py...@gmail.com wrote: [] Also ask why no one used type specifier, they are possible since Python 3.0 ? Because it is the wrong way for Python.

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-23 Thread Paul Sokolovsky
Hello, On Thu, 23 Apr 2015 14:48:58 +0200 Wolfgang Langner tds333+py...@gmail.com wrote: Hello, On Thu, Apr 23, 2015 at 11:59 AM, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 23 Apr 2015 10:43:52 +0200 Wolfgang Langner tds333+py...@gmail.com wrote: [] Also ask

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-22 Thread Terry Reedy
On 4/21/2015 6:41 PM, Chris Barker wrote: Well, it'll catch passing in a string instead of a sequence of strings -- one of teh common and semi-insidious type errors I see a lot (at least with newbies). Oh wait, maybe it won't -- a string IS a sequence of strings. That's why this is an

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-22 Thread Terry Reedy
On 4/21/2015 6:50 PM, Chris Barker wrote: On Tue, Apr 21, 2015 at 11:58 AM, Paul Sokolovsky pmis...@gmail.com mailto:pmis...@gmail.com wrote: It does, and hope people won't be caught in static typechecking loop and consider other usages too. I an interested is using type hints for

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-22 Thread Guido van Rossum
On Wed, Apr 22, 2015 at 2:38 PM, Chris Barker chris.bar...@noaa.gov wrote: Oh wait, maybe it won't -- a string IS a sequence of strings. That's why this is an insidious bug in the first place. On Tue, Apr 21, 2015 at 11:32 PM, Terry Reedy tjre...@udel.edu wrote: I was just thinking today

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-22 Thread Chris Barker
Oh wait, maybe it won't -- a string IS a sequence of strings. That's why this is an insidious bug in the first place. On Tue, Apr 21, 2015 at 11:32 PM, Terry Reedy tjre...@udel.edu wrote: I was just thinking today that for this, typing needs a subtraction (difference) operation in addition

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-22 Thread Cory Benfield
On 21 April 2015 at 18:12, Steven D'Aprano st...@pearwood.info wrote: I expect that dealing with duck typing will be very high on the list of priorities for the future. In the meantime, for this specific use-case, you're probably not going to be able to statically check this type hint. Your

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-22 Thread Cory Benfield
On 21 April 2015 at 17:59, Guido van Rossum gu...@python.org wrote: For me, PEP 484 is a stepping stone. Among the authors of PEP 484 there was much discussion about duck typing, and mypy even has some limited support for duck typing (I think you can still find it by searching the mypy code

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Terry Reedy
On 4/20/2015 9:07 PM, Chris Angelico wrote: On Tue, Apr 21, 2015 at 10:52 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Jack is not complaining only about *writing* code. He's complaining about the effect this will have on code that we all are expected to *read*. For reading, good

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread R. David Murray
On Tue, 21 Apr 2015 10:10:06 -0700, Guido van Rossum gu...@python.org wrote: On Tue, Apr 21, 2015 at 9:17 AM, R. David Murray rdmur...@bitdance.com wrote: Please be respectful rather than inflammatory. If you read what I wrote, I did not say that I was going to stop contributing, I

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Sokolovsky
Hello, On Tue, 21 Apr 2015 09:50:59 -0700 Ethan Furman et...@stoneleaf.us wrote: On 04/21, Paul Sokolovsky wrote: And for example yesterday's big theme was people blackmailing that they stop contributing to stdlib if annotations are in [...] A volunteer's honest reaction is not

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Guido van Rossum
On Tue, Apr 21, 2015 at 10:03 AM, Carol Willing willi...@willingconsulting.com wrote: Two areas of clarification would be helpful for me: 1. Optional: What does this really mean in practice? Am I opting in to static type checking and type hints? Or must I opt out of type hints? Having to

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Moore
On 21 April 2015 at 17:55, Gregory P. Smith g...@krypto.org wrote: I view most of this thread as FUD. The fear is understandable, I'm trying to tell people to stop panicing. I think (hope!) everyone is clear that what's being expressed in this thread is honest (emotional) reactions. There's a

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Guido van Rossum
On Tue, Apr 21, 2015 at 9:47 AM, Antoine Pitrou solip...@pitrou.net wrote: On Tue, 21 Apr 2015 09:28:45 -0700 Guido van Rossum gu...@python.org wrote: On Tue, Apr 21, 2015 at 12:49 AM, Antoine Pitrou solip...@pitrou.net wrote: On Mon, 20 Apr 2015 20:43:38 -0400 R. David Murray

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Antoine Pitrou
On Tue, 21 Apr 2015 18:27:50 +0300 Paul Sokolovsky pmis...@gmail.com wrote: Let me try: MicroPython already uses type annotations for statically typed functions. E.g. def add(x:int, y:int): return x + y will translate the function to just 2 machine instructions. That's quite nice.

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread R. David Murray
On Tue, 21 Apr 2015 16:55:49 -, Gregory P. Smith g...@krypto.org wrote: We will not be putting type annotations anywhere in the stdlib or expecting anyone else to maintain them there. That would never happen until tools that are convincing enough in their utility for developers to _want_ to

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Łukasz Langa
On Apr 21, 2015, at 11:23 AM, Guido van Rossum gu...@python.org wrote: 2. Clearly, great thought has been put into this PEP. If anyone has a good analysis of the potential impact on Python 3 adoption, please do pass along. I would be interested in reading the information. I wish I had

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Carol Willing
On 4/21/15 9:17 AM, R. David Murray wrote: Please be respectful rather than inflammatory. Thank you David. If you read what I wrote, I did not say that I was going to stop contributing, I specifically talked about that gut reaction being both emotional and illogical. That doesn't make the

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Sokolovsky
Hello, On Tue, 21 Apr 2015 12:17:01 -0400 R. David Murray rdmur...@bitdance.com wrote: On Tue, 21 Apr 2015 18:27:50 +0300, Paul Sokolovsky pmis...@gmail.com wrote: I was replying to Steven's message. Did you read it? Yes. And I try to follow general course of discussion, as its hard

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Daniel Holth
On Tue, Apr 21, 2015 at 1:10 PM, Guido van Rossum gu...@python.org wrote: On Tue, Apr 21, 2015 at 9:17 AM, R. David Murray rdmur...@bitdance.com wrote: Please be respectful rather than inflammatory. If you read what I wrote, I did not say that I was going to stop contributing, I

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Alexander Belopolsky
On Tue, Apr 21, 2015 at 2:23 PM, Guido van Rossum gu...@python.org wrote: At least nobody will be writing type hints in Cyrillic. :-) Why not? It works just fine: Список = list def sum(x: Список): ... pass ... (See https://en.wikipedia.org/wiki/Rapira for some prior art.)

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread R. David Murray
On Tue, 21 Apr 2015 21:31:49 +0300, Paul Sokolovsky pmis...@gmail.com wrote: On Tue, 21 Apr 2015 09:50:59 -0700 Ethan Furman et...@stoneleaf.us wrote: On 04/21, Paul Sokolovsky wrote: And for example yesterday's big theme was people blackmailing that they stop contributing to stdlib

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Antoine Pitrou
On Mon, 20 Apr 2015 20:43:38 -0400 R. David Murray rdmur...@bitdance.com wrote: +1 to this from me too. I'm afraid that means I'm -1 on the PEP. I didn't write this in my earlier email because I wasn't sure about it, but my gut reaction after reading Harry's email was if type annotations are

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Cory Benfield
On 21 April 2015 at 01:45, Chris Angelico ros...@gmail.com wrote: When you're writing a library, it can be a great help to provide type annotations, because every application that uses your library can benefit. It can be a great help to whom? Not to me (the library author), because I can't use

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Antoine Pitrou
On Tue, 21 Apr 2015 22:47:23 +1000 Steven D'Aprano st...@pearwood.info wrote: Ironically, type hinting will *reduce* the need for intrusive, anti-duck-testing explicit calls to isinstance() at runtime: It won't, since as you pointed out yourself, type checks are purely optional and entirely

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Steven D'Aprano
On Tue, Apr 21, 2015 at 11:56:15AM +0100, Rob Cliffe wrote: (Adding a type hint that restricted the argument to say a sequence of numbers turns out to be a mistake. Let's find out how big a mistake it is with an test run. py def sorter(alist: List[int]) - List[int]: ... return

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Cory Benfield
On 21 April 2015 at 12:23, Gustavo Carneiro gjcarne...@gmail.com wrote: Documentation is not checked. It often loses sync with the actual code. Docs say one thing, code does another. Agreed. I don't think anyone would disagree here. I'm talking from the position of being a library author,

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Steven D'Aprano
On Tue, Apr 21, 2015 at 01:25:34PM +0100, Chris Withers wrote: Anyway, I've not posted much to python-dev in quite a while, but this is a topic that I would be kicking myself in 5-10 years time when I've had to move to Javascript or insert new language here because everyone else has

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Moore
On 21 April 2015 at 13:47, Steven D'Aprano st...@pearwood.info wrote: On Tue, Apr 21, 2015 at 11:56:15AM +0100, Rob Cliffe wrote: (Adding a type hint that restricted the argument to say a sequence of numbers turns out to be a mistake. Let's find out how big a mistake it is with an

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Cory Benfield
On 21 April 2015 at 10:10, Chris Angelico ros...@gmail.com wrote: At this point, you may want to just stop caring about the exact type. Part of the point of gradual typing is that you can short-cut a lot of this. And quite frankly, this isn't really helping anything. Just skip it and say that

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Angelico
On Tue, Apr 21, 2015 at 6:58 PM, Cory Benfield c...@lukasa.co.uk wrote: On 21 April 2015 at 01:45, Chris Angelico ros...@gmail.com wrote: When you're writing a library, it can be a great help to provide type annotations, because every application that uses your library can benefit. It can be

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Cory Benfield
On 21 April 2015 at 15:31, Chris Angelico ros...@gmail.com wrote: Granted, there are some vague areas - how many functions take a file-like object, and are they all the same? - but between MyPy types and the abstract base types that already exist, there are plenty of ways to formalize duck

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Nikolaus Rath
On Apr 20 2015, Chris Angelico ros...@gmail.com wrote: Maybe it'd be of value to have a quick code stripper that takes away all the annotations, plus any other junk/framing that you're not interested in, and gives you something you can browse in a text editor? If you need to preprocess your

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 20:09, Paul Moore wrote: On 20 April 2015 at 19:41, Barry Warsaw ba...@python.org wrote: tldr; type hints in python source are scary. Would reserving them for stub files be better? I think so. I think PEP 8 should require stub files for stdlib modules and strongly encourage them

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Antoine Pitrou
Le 21/04/2015 15:50, Paul Sokolovsky a écrit : Hello, On Tue, 21 Apr 2015 15:08:27 +0200 Antoine Pitrou solip...@pitrou.net wrote: [] Because the user might not run the type checker, obviously. To quote you: When we say that type checking is optional, we mean it. You can't at the

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Angelico
On Wed, Apr 22, 2015 at 12:51 AM, Cory Benfield c...@lukasa.co.uk wrote: On 21 April 2015 at 15:31, Chris Angelico ros...@gmail.com wrote: Granted, there are some vague areas - how many functions take a file-like object, and are they all the same? - but between MyPy types and the abstract base

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Harry Percival
Hey, I just wanted to say to everyone, thanks for being so patient and willing to engage with this discussion, despite my not having done my research and read the (substantial) prior discussion on the topic. Here it is (or at least, some of it!) for any other newcomers:

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 19:30, Harry Percival wrote: Hi all, tldr; type hints in python source are scary. Would reserving them for stub files be better? I was trying to find Jack's original post as I think his summary is excellent and aligns well with where I think I'm coming from on this:

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Steven D'Aprano
On Tue, Apr 21, 2015 at 03:08:27PM +0200, Antoine Pitrou wrote: On Tue, 21 Apr 2015 22:47:23 +1000 Steven D'Aprano st...@pearwood.info wrote: Ironically, type hinting will *reduce* the need for intrusive, anti-duck-testing explicit calls to isinstance() at runtime: It won't, since as

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Alexander Walters
So. This is how you try and get me to care about Python 3. Can't speak for others, but this does the opposite for me. This makes me ecstatic that Python 2 has a nearly-frozen api. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Sokolovsky
Hello, On Tue, 21 Apr 2015 11:56:15 +0100 Rob Cliffe rob.cli...@btinternet.com wrote: On 21/04/2015 10:33, Cory Benfield wrote: On 21 April 2015 at 10:10, Chris Angelico ros...@gmail.com wrote: At this point, you may want to just stop caring about the exact type. Part of the point of

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Sokolovsky
Hello, On Tue, 21 Apr 2015 15:08:27 +0200 Antoine Pitrou solip...@pitrou.net wrote: [] Because the user might not run the type checker, obviously. To quote you: When we say that type checking is optional, we mean it. You can't at the same time point out that type checking has no power or

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Angelico
On Tue, Apr 21, 2015 at 7:56 PM, Arnaud Delobelle arno...@gmail.com wrote: If people constantly get told by their editor / IDE that they are calling function with the wrong argument types, what are they going to do? They may start adopting the same approach as in Java / C++ etc... where

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Antoine Pitrou
On Tue, 21 Apr 2015 23:16:19 +1000 Steven D'Aprano st...@pearwood.info wrote: I could keep going, but I hope I've made my point. I don't think so. Just because other languages are looking at it doesn't mean it will end up successful. It means it's an interesting idea, that's all. A litmus

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Arnaud Delobelle
On Tue, 21 Apr 2015 at 09:59 Cory Benfield c...@lukasa.co.uk wrote: [...] Further, Python's type system is not sufficiently flexible to allow library authors to adequately specify the types their code actually works on. I need to be able to talk about interfaces, because interfaces are the

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Barry Warsaw
On Apr 21, 2015, at 01:34 PM, Steven D'Aprano wrote: Putting the type information in a stub file is an exponentially more distant fourth best, or to put it another way, *the worst* solution for where to put type hints. Not only do you Repeat Yourself with the name of the parameter, but also the

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 19:30, Harry Percival wrote: Hi all, tldr; type hints in python source are scary. Would reserving them for stub files be better? I think Jack's summary of this is excellent and aligns well with where I think I'm coming from on this:

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Rob Cliffe
On 21/04/2015 10:33, Cory Benfield wrote: On 21 April 2015 at 10:10, Chris Angelico ros...@gmail.com wrote: At this point, you may want to just stop caring about the exact type. Part of the point of gradual typing is that you can short-cut a lot of this. And quite frankly, this isn't really

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Gustavo Carneiro
On 21 April 2015 at 11:56, Rob Cliffe rob.cli...@btinternet.com wrote: On 21/04/2015 10:33, Cory Benfield wrote: On 21 April 2015 at 10:10, Chris Angelico ros...@gmail.com ros...@gmail.com wrote: At this point, you may want to just stop caring about the exact type. Part of the point of

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 20/04/2015 20:09, Paul Moore wrote: On 20 April 2015 at 19:41, Barry Warsaw ba...@python.org wrote: tldr; type hints in python source are scary. Would reserving them for stub files be better? I think so. I think PEP 8 should require stub files for stdlib modules and strongly encourage them

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Withers
On 21/04/2015 12:23, Gustavo Carneiro wrote: Well, (i) can be done with good documentation (docstrings etc.). Documentation is not checked. It often loses sync with the actual code. Docs say one thing, code does another. That certainly something that could be fixed by formalising

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread R. David Murray
On Wed, 22 Apr 2015 01:09:52 +1000, Chris Angelico ros...@gmail.com wrote: def incremental_parser(input: FileLike) - List[Token]: tokens = [] data = while True: if not data: data = input.read(64) token = Token(data[0]); data = data[1:] while

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Sokolovsky
Hello, On Tue, 21 Apr 2015 16:11:51 +0200 Antoine Pitrou anto...@python.org wrote: [] You can't at the same time point out that type checking has no power or control over runtime behaviour, and then claim that type checking makes runtime behaviour (for example, ability to accept or

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Sokolovsky
Hello, On Tue, 21 Apr 2015 08:05:59 -0700 Nikolaus Rath nikol...@rath.org wrote: On Apr 20 2015, Chris Angelico ros...@gmail.com wrote: Maybe it'd be of value to have a quick code stripper that takes away all the annotations, plus any other junk/framing that you're not interested in, and

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Cory Benfield
On 21 April 2015 at 16:09, Chris Angelico ros...@gmail.com wrote: Pretty accurate, yeah. Here's how I see it: def incremental_parser(input: FileLike) - List[Token]: tokens = [] data = while True: if not data: data = input.read(64) token =

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Jim Baker
On Tue, Apr 21, 2015 at 9:09 AM, Chris Angelico ros...@gmail.com wrote: ... Pretty accurate, yeah. Here's how I see it: def incremental_parser(input: FileLike) - List[Token]: tokens = [] data = while True: if not data: data = input.read(64)

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Paul Moore
(Gmail messed up the attributions - apologies if I didn't fix them up correctly). 21 April 2015 at 19:55, Łukasz Langa luk...@langa.pl wrote: On Apr 21, 2015, at 11:23 AM, Guido van Rossum gu...@python.org wrote: 2. Clearly, great thought has been put into this PEP. If anyone has a good

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Robert Collins
On 22 April 2015 at 04:28, Guido van Rossum gu...@python.org wrote: On Tue, Apr 21, 2015 at 12:49 AM, Antoine Pitrou solip...@pitrou.net wrote: On Mon, 20 Apr 2015 20:43:38 -0400 R. David Murray rdmur...@bitdance.com wrote: +1 to this from me too. I'm afraid that means I'm -1 on the PEP.

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Robert Collins
On 22 April 2015 at 08:26, Guido van Rossum gu...@python.org wrote: In the end this should be up to you and the reviewers, but for such a venerable module like unittest I'd be hesitant to be an early adopter. I'd also expect that much of unittest is too dynamic in nature to benefit from type

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Barker
On Tue, Apr 21, 2015 at 2:33 AM, Cory Benfield c...@lukasa.co.uk wrote: It seems like the only place the type annotations will get used is in relatively trivial cases where the types are obvious anyway. I don't deny that *some* bugs will be caught, but I suspect they'll overwhelmingly be

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Barker
On Tue, Apr 21, 2015 at 11:58 AM, Paul Sokolovsky pmis...@gmail.com wrote: It does, and hope people won't be caught in static typechecking loop and consider other usages too. Im confused -- from the bit I've been skimming the discussion, over on python-ideas, and now here, is that this is all

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Chris Barker
Thank you Jack. Jack: I hate code and I want as little of it as possible in our product I love that quote -- and I ALWAYS use it when I teach newbies Python. It's kind of the point of Python -- you can get a lot done by writing very little code. I'm still confused about what all this type

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread James Edwards
Cory Benfield c...@lukasa.co.uk python-dev@python.org python-dev@python.org On Tue, Apr 21, 2015 at 8:47 AM, Cory Benfield c...@lukasa.co.uk wrote: I'm talking from the position of being a library author, where supporting versions of Python lower than 3.5 will be a reality for at least 5 more

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Steven D'Aprano
On Mon, Apr 20, 2015 at 08:37:28PM -0700, Guido van Rossum wrote: On Mon, Apr 20, 2015 at 4:41 PM, Jack Diederich jackd...@gmail.com wrote: Twelve years ago a wise man said to me I suggest that you also propose a new name for the resulting language The barrage of FUD makes me feel like

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Antoine Pitrou
On Tue, 21 Apr 2015 09:28:45 -0700 Guido van Rossum gu...@python.org wrote: On Tue, Apr 21, 2015 at 12:49 AM, Antoine Pitrou solip...@pitrou.net wrote: On Mon, 20 Apr 2015 20:43:38 -0400 R. David Murray rdmur...@bitdance.com wrote: +1 to this from me too. I'm afraid that means I'm -1 on

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Ethan Furman
On 04/21, Paul Sokolovsky wrote: And for example yesterday's big theme was people blackmailing that they stop contributing to stdlib if annotations are in [...] A volunteer's honest reaction is not blackmail, and categorizing it as such is not helpful to the discussion. -- ~Ethan~

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Gregory P. Smith
On Tue, Apr 21, 2015 at 12:50 AM Antoine Pitrou solip...@pitrou.net wrote: On Mon, 20 Apr 2015 20:43:38 -0400 R. David Murray rdmur...@bitdance.com wrote: +1 to this from me too. I'm afraid that means I'm -1 on the PEP. I didn't write this in my earlier email because I wasn't sure about

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Guido van Rossum
On Tue, Apr 21, 2015 at 7:51 AM, Cory Benfield c...@lukasa.co.uk wrote: The correct specification is read method with this type signature and seek method with this type signature. I would even be prepared to waive the type signatures on read and seek, given that enforcing the type hinting on

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Nikolaus Rath
On Apr 21 2015, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Tue, 21 Apr 2015 08:05:59 -0700 Nikolaus Rath nikol...@rath.org wrote: On Apr 20 2015, Chris Angelico ros...@gmail.com wrote: Maybe it'd be of value to have a quick code stripper that takes away all the annotations, plus

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Guido van Rossum
On Tue, Apr 21, 2015 at 9:17 AM, R. David Murray rdmur...@bitdance.com wrote: Please be respectful rather than inflammatory. If you read what I wrote, I did not say that I was going to stop contributing, I specifically talked about that gut reaction being both emotional and illogical. That

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Steven D'Aprano
On Tue, Apr 21, 2015 at 03:51:05PM +0100, Cory Benfield wrote: On 21 April 2015 at 15:31, Chris Angelico ros...@gmail.com wrote: Granted, there are some vague areas - how many functions take a file-like object, and are they all the same? - but between MyPy types and the abstract base

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Guido van Rossum
On Tue, Apr 21, 2015 at 1:18 PM, Robert Collins robe...@robertcollins.net wrote: On 22 April 2015 at 04:28, Guido van Rossum gu...@python.org wrote: Until some point in a possible but distant future when we're all thinking back fondly about the argument we're currently having, it will be the

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread R. David Murray
On Tue, 21 Apr 2015 18:27:50 +0300, Paul Sokolovsky pmis...@gmail.com wrote: I was replying to Steven's message. Did you read it? Yes. And I try to follow general course of discussion, as its hard to follow individual sub-threads. And for example yesterday's big theme was people

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-21 Thread Guido van Rossum
On Tue, Apr 21, 2015 at 12:49 AM, Antoine Pitrou solip...@pitrou.net wrote: On Mon, 20 Apr 2015 20:43:38 -0400 R. David Murray rdmur...@bitdance.com wrote: +1 to this from me too. I'm afraid that means I'm -1 on the PEP. I didn't write this in my earlier email because I wasn't sure about

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread Ian Cordasco
On Mon, Apr 20, 2015 at 4:00 PM, Harry Percival harry.perci...@gmail.com wrote: @Lukasz: Of course you're right, ugly is a matter of perspective, and I'm sure I could grow to love them, and they might evolve into a more polished direction they start to read more transparently after a

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread Harry Percival
exactly. yay stub files! we all agree! everyone loves them! boo type annotations inline in python source. only some people love them. and even then, only after a while, and only tentatively... and some people fear them, mightily... On 20 April 2015 at 23:14, Łukasz Langa luk...@langa.pl

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread Harry Percival
So I guess the main difference is that type annotations in stub files wouldn't be available at runtime? Ie, they wouldn't magically appear in __annotations__ (unless the python interpreter itself started to evaluate stub files too) On 20 April 2015 at 22:02, Guido van Rossum gu...@python.org

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread Harry Percival
I hate stub files. [...] in my opinion, [it] just about guarantees a maintenance burden that will fall by the side of the road. I'm not so pessimistic. It's not like documentation or docstrings or comments -- the whole point is that it should be very easy to have an automated check for whether

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread R. David Murray
I wrote a longer response and then realized it didn't really add much to the discussion. So let me be short: type annotations do *not* appeal to me, and I am not looking forward to the cognitive overhead of dealing with them. Perhaps I will eventually grow to like them if the tools that use them

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread Jack Diederich
Twelve years ago a wise man said to me I suggest that you also propose a new name for the resulting language I talked with many of you at PyCon about the costs of PEP 484. There are plenty of people who have done a fine job promoting the benefits. * It is not optional. Please stop saying that.

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-20 Thread Guido van Rossum
On Mon, Apr 20, 2015 at 1:17 PM, Robert Collins robe...@robertcollins.net wrote: On 21 April 2015 at 08:10, Eric Snow ericsnowcurren...@gmail.com wrote: While it helps, this sort of best-practice is still unsettled (and apparently not obvious). In the short term it would make more

  1   2   >