Re: [Python-Dev] PEP 557: Data Classes

2017-09-09 Thread Eric V. Smith
On 9/9/2017 11:41 AM, Gustavo Carneiro wrote: Hi, it is not clear whether anything is done to total_cost:     def total_cost(self) -> float: Does this become a property automatically, or is it still a method call?  To that end, some examples of *using* a data class, not just defining one, wo

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Guido van Rossum
I can't tell whether this was meant seriously, but I don't think it's worth it. People can easily write their own dummy function and give it any damn semantics they want. Let's reject the PEP. On Sat, Sep 9, 2017 at 11:46 AM, Barry Warsaw wrote: > I couldn’t resist one more PEP from the Core spr

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Victor Stinner
Previous discussion: https://bugs.python.org/issue10049 Issue closed as rejected. Victor 2017-09-09 14:33 GMT-07:00 Victor Stinner : > I was able to find a real keyboard, so here is a more complete code: > --- > class Noop: > def __call__(self, *args, **kw): > return self > def _

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Koos Zevenhoven
On Sat, Sep 9, 2017 at 10:54 PM, Victor Stinner wrote: > I always wanted this feature (no kidding). > > Would it be possible to add support for the context manager? > > with noop(): ... > > Maybe noop can be an instance of: > > class Noop: > def __enter__(self, *args, **kw): return self > def

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Oleg Broytman
On Sat, Sep 09, 2017 at 02:33:18PM -0700, Victor Stinner wrote: > I was able to find a real keyboard, so here is a more complete code: > --- > class Noop: > def __call__(self, *args, **kw): > return self > def __enter__(self, *args, **kw): > return self > def __exit__(

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Victor Stinner
I was able to find a real keyboard, so here is a more complete code: --- class Noop: def __call__(self, *args, **kw): return self def __enter__(self, *args, **kw): return self def __exit__(self, *args): return def __repr__(self): return 'nope' --- Ex

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Antoine Pitrou
On Sat, 9 Sep 2017 11:46:30 -0700 Barry Warsaw wrote: > > Rationale > = > > It is trivial to implement a no-op function in Python. It's so easy in fact > that many people do it many times over and over again. It would be useful in > many cases to have a common built-in function that do

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Serhiy Storchaka
09.09.17 21:46, Barry Warsaw пише: One use case would be for PEP 553, where you could set the breakpoint environment variable to the following in order to effectively disable it:: $ setenv PYTHONBREAKPOINT=noop Are there other use cases? PEP 553 still is not approved, and you could use o

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Victor Stinner
I always wanted this feature (no kidding). Would it be possible to add support for the context manager? with noop(): ... Maybe noop can be an instance of: class Noop: def __enter__(self, *args, **kw): return self def __exit__(self, *args): pass def __call__(self, *args, **kw): return self

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Ben Hoyt
I don't think the rationale justifies an entire builtin. You could just use "PYTHONBREAKPOINT=int" to disable, or support "PYTHONBREAKPOINT=0" as I think someone else suggested. I personally can't remember the last time I needed a noop() function. I've more often needed an identity() function, and

Re: [Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread MRAB
On 2017-09-09 19:46, Barry Warsaw wrote: I couldn’t resist one more PEP from the Core sprint. I won’t reveal where or how this one came to me. -Barry PEP: 559 Title: Built-in noop() Author: Barry Warsaw Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 2017-09-08 Python-V

[Python-Dev] PEP 559 - built-in noop()

2017-09-09 Thread Barry Warsaw
I couldn’t resist one more PEP from the Core sprint. I won’t reveal where or how this one came to me. -Barry PEP: 559 Title: Built-in noop() Author: Barry Warsaw Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 2017-09-08 Python-Version: 3.7 Post-History: 2017-09-09 Abst

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Nathaniel Smith
On Sep 8, 2017 4:06 PM, "Eric Snow" wrote: run(code): Run the provided Python code in the interpreter, in the current OS thread. If the interpreter is already running then raise RuntimeError in the interpreter that called ``run()``. The current interpreter (which ca

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Nathaniel Smith
On Sep 9, 2017 9:07 AM, "Nick Coghlan" wrote: To immediately realise some level of efficiency benefits from the shared memory space between the main interpreter and subinterpreters, I also think these low level FIFOs should be defined as accepting any object that supports the PEP 3118 buffer pro

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Nick Coghlan
On 9 September 2017 at 01:04, Paul Moore wrote: > On 9 September 2017 at 00:04, Eric Snow wrote: >>add_recv_fifo(name=None): >> >> Create a new FIFO, associate the two ends with the involved >> interpreters, and return the side associated with the interpreter >> in which "ad

Re: [Python-Dev] PEP 557: Data Classes

2017-09-09 Thread Gustavo Carneiro
Hi, it is not clear whether anything is done to total_cost: def total_cost(self) -> float: Does this become a property automatically, or is it still a method call? To that end, some examples of *using* a data class, not just defining one, would be helpful. If it remains a normal method, why

Re: [Python-Dev] PEP 556: Threaded garbage collection

2017-09-09 Thread Nick Coghlan
On 8 September 2017 at 12:40, Nathaniel Smith wrote: > Would it make sense to also move signal handlers to run in this > thread? Those are the other major source of nasty re-entrancy > problems. Python level signal handlers are already only run in the main thread, so applications that want to ens

Re: [Python-Dev] PEP 557: Data Classes

2017-09-09 Thread Stéfane Fermigier
Hi, first post here. My two cents: Here's a list of "prior arts" that I have collected over the years, besides attrs, that address similar needs (and often, much more): - https://github.com/bluedynamics/plumber - https://github.com/ionelmc/python-fields - https://github.com/frasertweedale/elk -

Re: [Python-Dev] PEP 539 v3: A new C API for Thread-Local Storage in CPython

2017-09-09 Thread Erik Bray
On Fri, Sep 8, 2017 at 4:37 PM, Nick Coghlan wrote: > On 8 September 2017 at 00:30, Masayuki YAMAMOTO > wrote: >> Hi folks, >> >> I submit PEP 539 third draft for the finish. Thank you for all the advice >> and the help! > > Thank you Erik & Yamamoto-san for all of your work on this PEP! > > The

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Antoine Pitrou
On Fri, 8 Sep 2017 16:04:27 -0700 Eric Snow wrote: > > The module provides the following functions: > > ``list()``:: > >Return a list of all existing interpreters. It's called ``enumerate()`` in the threading module. Not sure there's a point in choosing a different name here. > The modul

Re: [Python-Dev] PEP 539 v3: A new C API for Thread-Local Storage in CPython

2017-09-09 Thread Masayuki YAMAMOTO
2017-09-09 2:09 GMT+09:00 Nick Coghlan : > [...] > No, we genuinely want to consolidate that state into a single shared > location. However, the struct definition can be adjusted as needed as > part of the PEP 539 implementation (and we'll get Eric Snow to be one > of the PR reviewers). > I see. I

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Antoine Pitrou
On Sat, 9 Sep 2017 09:04:59 +0100 Paul Moore wrote: > On 9 September 2017 at 00:04, Eric Snow wrote: > >add_recv_fifo(name=None): > > > > Create a new FIFO, associate the two ends with the involved > > interpreters, and return the side associated with the interpreter > > in

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Paul Moore
On 9 September 2017 at 00:04, Eric Snow wrote: >add_recv_fifo(name=None): > > Create a new FIFO, associate the two ends with the involved > interpreters, and return the side associated with the interpreter > in which "add_recv_fifo()" was called. A FIFOReader gets tied to >