Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Stefan Behnel
Lukasz Langa schrieb am 11.09.2017 um 21:25: > I remember mostly Stefan Behnel's concerns about Cython's annotations, I'm currently reimplementing the annotation typing in Cython to be compatible with PEP-484, so that concern is pretty much out of the way. This PEP still has an impact on Cython,

Re: [Python-ideas] Hexadecimal floating literals

2017-09-11 Thread Steven D'Aprano
On Tue, Sep 12, 2017 at 12:45:37AM +0200, Victor Stinner wrote: > Instead of modifying the Python grammar, the alternative is to enhance > float(str) to support it: > > k = float("0x1.2492492492492p-3") # 1/7 Why wouldn't you just write 1/7? -- Steve __

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Steven D'Aprano
On Mon, Sep 11, 2017 at 11:58:45AM -0400, Lukasz Langa wrote: > PEP: 563 > Title: Postponed Evaluation of Annotations A few comments, following the quoted passages as needed. > Rationale and Goals > === > > PEP 3107 added support for arbitrary annotations on parts of a function

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Ethan Smith
On Mon, Sep 11, 2017 at 1:21 PM, Yury Selivanov wrote: > On Mon, Sep 11, 2017 at 3:25 PM, Lukasz Langa wrote: > [..] > > This PEP is proposing delaying evaluation until annotations are accessed > but > > gives user code the power to decide whether the string form is enough, or > > maybe an AST w

Re: [Python-ideas] Hexadecimal floating literals

2017-09-11 Thread Neil Schemenauer
On 2017-09-12, Victor Stinner wrote: > Instead of modifying the Python grammar, the alternative is to enhance > float(str) to support it: > > k = float("0x1.2492492492492p-3") # 1/7 Making it a different function from float() would avoid backwards compatibility issues. I.e. float() no longer retu

Re: [Python-ideas] Hexadecimal floating literals

2017-09-11 Thread Victor Stinner
Instead of modifying the Python grammar, the alternative is to enhance float(str) to support it: k = float("0x1.2492492492492p-3") # 1/7 Victor 2017-09-08 8:57 GMT+02:00 Serhiy Storchaka : > The support of hexadecimal floating literals (like 0xC.68p+2) is included in > just released C++17 standa

Re: [Python-ideas] lazy import via __future__ or compiler analysis

2017-09-11 Thread Neil Schemenauer
On 2017-09-11, Neil Schemenauer wrote: > A module can be a singleton instance of a singleton ModuleType > instance. Maybe more accurate to say each module would have its own unique __class__ associated with it. So, you can add properties to the class without affecting other modules. For backward

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Yury Selivanov
On Mon, Sep 11, 2017 at 3:25 PM, Lukasz Langa wrote: [..] > This PEP is proposing delaying evaluation until annotations are accessed but > gives user code the power to decide whether the string form is enough, or > maybe an AST would be enough, or actual evaluation with get_type_hints() or > eval(

Re: [Python-ideas] lazy import via __future__ or compiler analysis

2017-09-11 Thread Neil Schemenauer
On 2017-09-11, C Anthony Risinger wrote: > I'm getting at, is can we find a way to make modules a real type? So dunder > methods are activated? This would make modules phenomenally powerful > instead of just a namespace (or resorting to after the fact __class__ > reassignment hacks). My __namespac

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Lukasz Langa
> On Sep 11, 2017, at 3:23 PM, Stefan Behnel wrote: > > Ryan Gonzalez schrieb am 11.09.2017 um 19:16: >> One thing I want to point out: there are a lot of really useful Python >> libraries that have come to rely on annotations being objects, ranging >> from plac to fbuild to many others. I could

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Guido van Rossum
On Mon, Sep 11, 2017 at 10:16 AM, Ryan Gonzalez wrote: > One thing I want to point out: there are a lot of really useful Python > libraries that have come to rely on annotations being objects, ranging > from plac to fbuild to many others. I could understand something that > delays the evaluation

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Lukasz Langa
> On Sep 11, 2017, at 1:16 PM, Ryan Gonzalez wrote: > > One thing I want to point out: there are a lot of really useful Python > libraries that have come to rely on annotations being objects, ranging > from plac to fbuild to many others. Shout out to fbuild which is a project that was built on

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Stefan Behnel
Ryan Gonzalez schrieb am 11.09.2017 um 19:16: > One thing I want to point out: there are a lot of really useful Python > libraries that have come to rely on annotations being objects, ranging > from plac to fbuild to many others. I could understand something that > delays the evaluation of annotati

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread אלעזר
On Mon, Sep 11, 2017 at 10:07 PM Lukasz Langa wrote: > This is off topic for discussion of this PEP. > > It would require another one (essentially an extension of PEP 484) to get > passed for your idea to be standardized. > I'm not sure whether this is directed to me; so just to make it clear, I

Re: [Python-ideas] lazy import via __future__ or compiler analysis

2017-09-11 Thread C Anthony Risinger
On Mon, Sep 11, 2017 at 1:09 PM, Neil Schemenauer < nas-python-id...@arctrix.com> wrote: > On 2017-09-11, C Anthony Risinger wrote: > > I'm not sure I follow the `exec(code, module)` part from the other > thread. > > `exec` needs a dict to exec code into [..] > [..] > > How do you handle lazy load

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Lukasz Langa
This is off topic for discussion of this PEP. It would require another one (essentially an extension of PEP 484) to get passed for your idea to be standardized. For now, I don't want to distract reviewers from conflating PEP 563 with all the possible wonderful or horrible ways people can potent

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread אלעזר
On Mon, Sep 11, 2017 at 8:58 PM Steven D'Aprano wrote: > On Mon, Sep 11, 2017 at 04:06:14PM +, אלעזר wrote: > > I like it. For previous discussion of this idea see here: > > > https://mail.python.org/pipermail/python-ideas/2016-September/042527.html > > > > I don't see this mentioned in the P

Re: [Python-ideas] lazy import via __future__ or compiler analysis

2017-09-11 Thread Neil Schemenauer
On 2017-09-11, C Anthony Risinger wrote: > I'm not sure I follow the `exec(code, module)` part from the other thread. > `exec` needs a dict to exec code into [..] [..] > How do you handle lazy loading when a defined function requests a global > via LOAD_NAME? Are you suggesting to change function._

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Steven D'Aprano
On Mon, Sep 11, 2017 at 04:06:14PM +, אלעזר wrote: > I like it. For previous discussion of this idea see here: > https://mail.python.org/pipermail/python-ideas/2016-September/042527.html > > I don't see this mentioned in the PEP, but it will also allow (easy) > description of contracts and dep

Re: [Python-ideas] Give nonlocal the same creating power as global

2017-09-11 Thread João Matos
Hello, You're correct. The idea is to give nonlocal the same ability, redirect subsequent bindings if the variable doesn't exist. No, what I said is that it would only create the var if it didn't exist. That means that the current behaviour of nonlocal to check all previous envs (except globa

Re: [Python-ideas] lazy import via __future__ or compiler analysis

2017-09-11 Thread C Anthony Risinger
On Fri, Sep 8, 2017 at 11:36 AM, Neil Schemenauer < nas-python-id...@arctrix.com> wrote: > On 2017-09-09, Chris Angelico wrote: > > Laziness has to be complete - or, looking the other way, eager > > importing is infectious. For foo to be lazy, bar also has to be lazy; > > Not with the approach I'm

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Ryan Gonzalez
One thing I want to point out: there are a lot of really useful Python libraries that have come to rely on annotations being objects, ranging from plac to fbuild to many others. I could understand something that delays the evaluation of annotations until they are accessed, but this seems really ext

Re: [Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread אלעזר
I like it. For previous discussion of this idea see here: https://mail.python.org/pipermail/python-ideas/2016-September/042527.html I don't see this mentioned in the PEP, but it will also allow (easy) description of contracts and dependent types. Elazar On Mon, Sep 11, 2017 at 6:59 PM Lukasz Lan

[Python-ideas] PEP 563: Postponed Evaluation of Annotations, first draft

2017-09-11 Thread Lukasz Langa
PEP: 563 Title: Postponed Evaluation of Annotations Version: $Revision$ Last-Modified: $Date$ Author: Łukasz Langa Discussions-To: Python-Dev Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 8-Sep-2017 Python-Version: 3.7 Post-History: Resolution: Abstract PEP 310

Re: [Python-ideas] Give nonlocal the same creating power as global

2017-09-11 Thread Terry Reedy
On 9/11/2017 10:03 AM, João Matos wrote: Hello, I would like to suggest that nonlocal should be given the same creating power as global. If I do global a_var it creates the global a_var if it doesn't exist. The global declaration does not create anything, but it redirects subsequent binding

Re: [Python-ideas] PEP 562

2017-09-11 Thread Guido van Rossum
There's no need for shame! I regularly find out that there are Python features I didn't know about. It's called perpetual learning. :-) On Sun, Sep 10, 2017 at 9:02 PM, INADA Naoki wrote: > Oh, I'm shame myself. > > Only when `from email import *` is used, __all__ submodules are imported. > INAD

Re: [Python-ideas] Give nonlocal the same creating power as global

2017-09-11 Thread Jason H
> Sent: Monday, September 11, 2017 at 10:03 AM > From: "João Matos" > To: python-ideas@python.org > Subject: [Python-ideas] Give nonlocal the same creating power as global > > Hello, > > I would like to suggest that nonlocal should be given the same creating > power as global. > If I do > glob

[Python-ideas] Give nonlocal the same creating power as global

2017-09-11 Thread João Matos
Hello, I would like to suggest that nonlocal should be given the same creating power as global. If I do global a_var it creates the global a_var if it doesn't exist. I think it would be great that nonlocal maintained that power. This way when I do nonlocal a_var it would create a_var in

[Python-ideas] Give nonlocal the same creating power as global

2017-09-11 Thread João Matos
Hello, I would like to suggest that nonlocal should be given the same creating power as global. If I do global a_var it creates the global a_var if it doesn't exist. I think it would be great that nonlocal maintained that power. This way when I do nonlocal a_var it would create a_var in the i

Re: [Python-ideas] Adding new lines to "Zen of Python"

2017-09-11 Thread Thomas Güttler
Am 08.09.2017 um 14:47 schrieb Thomas Güttler: I curious if there are any plans to update the "Zen of Python". What could be added to the "Zen of Python"? What do you think? I like this one: "Bad programmers worry about the code. Good programmers worry about data structures and their relati

Re: [Python-ideas] PEP 554: Stdlib Module to Support Multiple Interpreters in Python Code

2017-09-11 Thread Koos Zevenhoven
On Mon, Sep 11, 2017 at 8:32 AM, Nick Coghlan wrote: > On 11 September 2017 at 00:52, Koos Zevenhoven wrote: > > On Thu, Sep 7, 2017 at 9:26 PM, Eric Snow > > wrote: > > [...] > > > >> > >> get_main(): > >> > >>Return the main interpreter. > >> > > > > I assume the concept of a main interpr