Re: [Python-Dev] PEP 561 rework

2017-11-12 Thread Ethan Smith
On Sun, Nov 12, 2017 at 8:07 PM, Nathaniel Smith wrote: > On Sun, Nov 12, 2017 at 11:21 AM, Ethan Smith wrote: > > > > > > On Sun, Nov 12, 2017 at 9:53 AM, Jelle Zijlstra < > jelle.zijls...@gmail.com> > > wrote: > >> > >> 2017-11-12 3

Re: [Python-Dev] Standardise the AST (Re: PEP 563: Postponed Evaluation of Annotations)

2017-11-13 Thread Nathaniel Smith
Can you give any examples of problems caused by the ast not being standardized? The original motivation of being able to distinguish between foo(x: int) foo(x: "int") isn't very compelling – it's not clear it's a problem in the first place, and even if it is then all we need is some kind of boo

Re: [Python-Dev] PEP 565: Show DeprecationWarning in __main__

2017-11-13 Thread Nathaniel Smith
On Mon, Nov 13, 2017 at 6:09 AM, Serhiy Storchaka wrote: > 13.11.17 14:29, Antoine Pitrou пише: >> >> On Mon, 13 Nov 2017 22:37:46 +1100 >> Chris Angelico wrote: >>> >>> On Mon, Nov 13, 2017 at 9:46 PM, Antoine Pitrou >>> wrote: >>>>

Re: [Python-Dev] PEP 561 rework

2017-11-13 Thread Ethan Smith
On Mon, Nov 13, 2017 at 3:50 PM, Sebastian Rittau wrote: > Hello everyone, > > > Am 14.11.2017 um 00:29 schrieb Guido van Rossum: > >> This is a nice piece of work. I expect to accept it pretty much verbatim >> (with some small edits, see https://github.com/python/peps/pull/467). I >> agree with

Re: [Python-Dev] PEP 561 rework

2017-11-14 Thread Ethan Smith
A note was added [1] about the solution for module only distributions and is live on Python.org. [1] https://github.com/python/peps/pull/468 Ethan Smith On Tue, Nov 14, 2017 at 1:02 AM, Sebastian Rittau wrote: > Am 14.11.2017 um 02:38 schrieb Guido van Rossum: > > On Mon, Nov 13, 201

Re: [Python-Dev] module customization

2017-11-15 Thread Nathaniel Smith
ted attributes to show up in tab completion. For other use cases like lazy imports, you would implement __dir__ too.) Example usage: https://github.com/python-trio/trio/blob/master/trio/__init__.py#L66-L98 -n -- Nathaniel J. Smith -- https://vorpus.org ___

Re: [Python-Dev] module customization

2017-11-15 Thread Nathaniel Smith
rt __getattr__, __dir__ auto_import_modules = {"foo", "bar"} # auto_importer.py def __getattr__(self, name): if name in self.auto_import_modules: ... -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python

Re: [Python-Dev] module customization

2017-11-15 Thread Nathaniel Smith
On Wed, Nov 15, 2017 at 10:14 PM, Nathaniel Smith wrote: > On Wed, Nov 15, 2017 at 4:27 PM, Ethan Furman wrote: >> The second way is fairly similar, but instead of replacing the entire >> sys.modules entry, its class is updated to be the class just created -- >> something li

Re: [Python-Dev] PEP 565: Show DeprecationWarning in __main__

2017-11-19 Thread Nathaniel Smith
ough people have updated their code that the screams die down. I'm pretty sure we'll be changing our policy at some point, possibly to always use FutureWarning for everything. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mai

Re: [Python-Dev] Tricky way of of creating a generator via a comprehension expression

2017-11-24 Thread Nathaniel Smith
ld` and `await` use two separate, unrelated channels. So there's no confusion or problem with having `await` inside a comprehension. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/ma

Re: [Python-Dev] Tricky way of of creating a generator via a comprehension expression

2017-11-24 Thread Nathaniel Smith
x27;t this a really confusing way of writing def example(): return [(yield '1st'), (yield '2nd')], [(yield '3rd'), (yield '4th')] ? -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing l

Re: [Python-Dev] Tricky way of of creating a generator via a comprehension expression

2017-11-24 Thread Nathaniel Smith
On Fri, Nov 24, 2017 at 9:39 PM, Nick Coghlan wrote: > On 25 November 2017 at 15:27, Nathaniel Smith wrote: >> On Fri, Nov 24, 2017 at 9:04 PM, Nick Coghlan wrote: >>> def example(): >>> comp1 = yield from [(yield x) for x in ('1st', '2nd&#

Re: [Python-Dev] Tricky way of of creating a generator via a comprehension expression

2017-11-26 Thread Nathaniel Smith
utine never awaited" warnings would be obnoxious (it's totally fine to instantiate a parser and then throw it away without using it!), and the global state issues would make us very nervous (wsproto is absolutely designed to be used alongside a library like asyncio or trio). But that'

Re: [Python-Dev] Using async/await in place of yield expression

2017-11-27 Thread Nathaniel Smith
7;t a huge deal in practice... -n [1] https://github.com/dabeaz/curio/blob/bd0e2cb7741278d1d9288780127dc0807b1aa5b1/curio/traps.py#L48-L156 [2] https://github.com/python-trio/trio/blob/2b8e297e544088b98ff758d37c7ad84f74c3f2f5/trio/_core/_run.py#L1521-L1530 -- Nathaniel J. Smith -- https://vorpus

Re: [Python-Dev] PEP 565: Show DeprecationWarning in __main__

2017-11-29 Thread Nathaniel Smith
On Nov 28, 2017 3:55 PM, "Guido van Rossum" wrote: On Sun, Nov 19, 2017 at 5:40 AM, Nathaniel Smith wrote: > Eh, numpy does use FutureWarning for changes where the same code will > transition from doing one thing to doing something else without > passing through a state

Re: [Python-Dev] Issues with PEP 526 Variable Notation at the class level

2017-12-08 Thread Nathaniel Smith
On Dec 7, 2017 12:49, "Eric V. Smith" wrote: The reason I didn't include it (as @dataclass(slots=True)) is because it has to return a new class, and the rest of the dataclass features just modifies the given class in place. I wanted to maintain that conceptual simplicity. But

Re: [Python-Dev] PEP 567 -- Context Variables

2017-12-13 Thread Nathaniel Smith
esents the value of one ContextVar, not the whole Context. This could maybe be clearer in the PEP, but it has to be this way or you'd get weird behavior from code like: with decimal.localcontext(...): # sets and then restores numpy.seterr(...) # sets without any plan to restore # after

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-14 Thread Nathaniel Smith
On Dec 14, 2017 21:30, "Raymond Hettinger" wrote: > On Dec 14, 2017, at 6:03 PM, INADA Naoki wrote: > > If "dict keeps insertion order" is not language spec and we > continue to recommend people to use OrderedDict to keep > order, I want to optimize OrderedDict for creation/iteration > and mem

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-15 Thread Nathaniel Smith
On Dec 15, 2017 10:50, "Tim Peters" wrote: [Eric Snow ] > Does that include preserving order after deletion? Given that we're blessing current behavior: - At any moment, iteration order is from oldest to newest. So, "yes" to your question. - While iteration starts with the oldest, .popitem()

Re: [Python-Dev] Usefulness of binary compatibility accross Python versions?

2017-12-17 Thread Nathaniel Smith
On Dec 16, 2017 11:44 AM, "Guido van Rossum" wrote: On Sat, Dec 16, 2017 at 11:14 AM, Antoine Pitrou wrote: > On Sat, 16 Dec 2017 19:37:54 +0100 > Antoine Pitrou wrote: > > > > Currently, you can pass a `module_api_version` to PyModule_Create2(), > > but that function is for specialists only :

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Nathaniel Smith
rlying semantics!) be a breaking change? Are you suggesting it shouldn't be changed in 3.7? -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscri

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-18 Thread Nathaniel Smith
On Mon, Dec 18, 2017 at 7:58 PM, Steven D'Aprano wrote: > On Mon, Dec 18, 2017 at 07:37:03PM -0800, Nathaniel Smith wrote: >> On Mon, Dec 18, 2017 at 7:02 PM, Barry Warsaw wrote: >> > On Dec 18, 2017, at 21:11, Chris Barker wrote: >> > >> >> Will cha

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-19 Thread Nathaniel Smith
vide an accurate repr. There are reasonable arguments for both positions, but no-one's suggesting anything in the same solar system as "all users of dict have to be updated". Am I missing some underlying nerve that this is hitting for some reason? -n -

Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017-12-19 Thread Nathaniel Smith
On Tue, Dec 19, 2017 at 4:56 PM, Steve Dower wrote: > On 19Dec2017 1004, Chris Barker wrote: >> >> Nathaniel Smith has pointed out that eval(pprint(a_dict)) is supposed to >> return the same dict -- so documented behavior may already be broken. > > > Two relevant

[Python-Dev] Supporting functools.singledispatch with classes.

2017-12-24 Thread Ethan Smith
patch needs to be called as the __func__ in classmethod, but __func__ is readonly. So at the moment, I don't think it is possible to implement singledispatch on classmethod or staticmethod decorated functions. I look forward to people's thoughts on these issues. Cheers, Ethan Smith _

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-27 Thread Ethan Smith
mber 2017 at 12:32, Ethan Smith wrote: >> > So at the moment, I don't think it is possible to implement >> singledispatch >> > on classmethod or staticmethod decorated functions. >> >> I've posted this to the PR, but adding it here as well: I

Re: [Python-Dev] PEP 567 v2

2017-12-28 Thread Nathaniel Smith
xt. The first sets the value in all contexts that currently exist, and all empty contexts created in the future. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-

[Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
lks have related to this. Cheers, ~>Ethan Smith ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 7:02 AM, Nick Coghlan wrote: > On 28 December 2017 at 04:22, Ethan Smith wrote: > > Okay, if there is no further feedback, I will work on a > singledispatchmethod > > decorator like partialmethod. > > > > For the future perhaps, would it no

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 2:45 AM, Antoine Pitrou wrote: > On Fri, 29 Dec 2017 02:23:56 -0800 > Ethan Smith wrote: > > > > In a few cases I want to override the repr of the AST nodes. I wrote a > > __repr__ and ran the code but lo and behold I got a type error. I >

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 11:37 AM, Ethan Furman wrote: > On 12/29/2017 02:23 AM, Ethan Smith wrote: > > The first is that needing both a keyword and method is duplicative and >> unnecessary. Eric agreed it was a hassle, but >> felt it was justified considering someone may ac

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman wrote: > On 12/29/2017 11:55 AM, Ethan Smith wrote: > >> On Fri, Dec 29, 2017 at 11:37 AM, Ethan Furman wrote: >> > > It is possible to determine whether an existing __repr__ is from 'object' >>> >&g

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Nathaniel Smith
work for one's use-case, use the keyword > parameter to specify what you want. What does attrs do here? -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/li

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
attrs just silently overwrites any user provided __repr__ unless you provide repr=False to attr.s. I think we can all agree that if nothing else, silently overwriting unconditionally is not what we want for dataclasses. On Fri, Dec 29, 2017 at 4:38 PM, Nathaniel Smith wrote: > On Fri, Dec

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
ementation? > On Dec 29, 2017 5:43 PM, "Nathaniel Smith" wrote: > >> On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman >> wrote: >> > Good point. So auto-generate a new __repr__ if: >> > >> > - one is not provided, and >> > - e

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
Okay, I think Guido's proposal is a good compromise. I already have a branch of dataclasses that should implement that behavior, so perhaps it was meant to be. :) ~>Ethan Smith On Fri, Dec 29, 2017 at 5:13 PM, Nick Coghlan wrote: > > > On 30 Dec. 2017 11:01 am, &qu

Re: [Python-Dev] [ssl] The weird case of IDNA

2017-12-30 Thread Nathaniel Smith
n't possible with pure ASCII, and this requires some care: https://unicode.org/faq/idn.html#16 This is mostly a UI issue, though; there's not much that the socket or ssl modules can do to help here. -n -- Nathaniel J. Smith -- https://vorpus.org __

Re: [Python-Dev] [ssl] The weird case of IDNA

2017-12-30 Thread Nathaniel Smith
rname.encode("ascii").decode("idna") return cb(sslobj, servername, sslctx) self.set_servername_callback2(shim_cb) We can bikeshed what the new name should be. Maybe set_sni_callback? or set_server_hostname_callback, since the corresponding client-mode argument is server_hostname? -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] [ssl] The weird case of IDNA

2017-12-31 Thread Nathaniel Smith
On Dec 31, 2017 7:37 AM, "Stephen J. Turnbull" < turnbull.stephen...@u.tsukuba.ac.jp> wrote: Nathaniel Smith writes: > Issue 1: Python's built-in IDNA implementation is wrong (implements > IDNA 2003, not IDNA 2008). Is "wrong" the right word here? I&#x

Re: [Python-Dev] [ssl] The weird case of IDNA

2017-12-31 Thread Nathaniel Smith
On Sun, Dec 31, 2017 at 5:39 PM, Steven D'Aprano wrote: > On Sun, Dec 31, 2017 at 09:07:01AM -0800, Nathaniel Smith wrote: > >> This is another reason why we ought to let users do their own IDNA handling >> if they want... > > I expect that letting users do their own

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2018-01-01 Thread Ethan Smith
ht" __repr__ now if you derive a datacalss from a > dataclass? That would be a nice feature. > The __repr__ will be generated by the child dataclass unless the user overrides it. So I believe this is the "right" __repr__. ~>Ethan Smith > > -CHB > > -- > > Christ

Re: [Python-Dev] PEP 567 v2

2018-01-03 Thread Nathaniel Smith
e there's no harm in it and it's probably useful for debuggers. (Note that I didn't say anything about HAMTs here, because that's orthogonal implementation detail. It would make perfect sense to have Context be an opaque wrapper around a regular dict;

Re: [Python-Dev] PEP 567 (contextvars) idea: really implement the current context

2018-01-03 Thread Nathaniel Smith
ed on it. This isn't a big problem for contextvars.get_context(), which returns a snapshot of the current context -- in a PEP 550 world it would return a snapshot of the current "effective" (flattened) context. Maybe it would help a little to rename get_context() to something like sna

Re: [Python-Dev] Discussion about the proposed ignore_modules argument for traceback functions

2018-01-03 Thread Nathaniel Smith
On Jan 3, 2018 18:38, "Dmitry Kazakov" wrote: Hello! I'd like to draw some attention to the feature(s) proposed in the issue 31299. https://bugs.python.org/issue31299 It's a dependency of the other issue, it still needs discussion, and it hasn't received any comments from committers since last S

Re: [Python-Dev] PEP 567 v2

2018-01-04 Thread Nathaniel Smith
On Thu, Jan 4, 2018 at 8:30 AM, Guido van Rossum wrote: > On Wed, Jan 3, 2018 at 6:35 PM, Nathaniel Smith wrote: >> - Context is a mutable object representing a mapping >> - BUT it doesn't allow mutation through the MutableMapping interface; >> instead, the only way

Re: [Python-Dev] PEP 567 v2

2018-01-04 Thread Nathaniel Smith
And it might also help address Paul's reasonable complaint about "unstated requirements".) -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] Whatever happened to 'nonlocal x = y'?

2018-01-05 Thread Nathaniel Smith
e" for more information. >>> def f(): ... x = 1 ... def g(): ... nonlocal x = 2 File "", line 4 nonlocal x = 2 ^ SyntaxError: invalid syntax Was this just an oversight, or did it get rejected at some point an

Re: [Python-Dev] Whatever happened to 'nonlocal x = y'?

2018-01-05 Thread Nathaniel Smith
trio.open_nursery() as nursery: for i in range(len(aiterators)): nursery.start_soon(fill_in, i) if done: break yield tuple(items) -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev

Re: [Python-Dev] PEP 567 v2

2018-01-05 Thread Nathaniel Smith
On Thu, Jan 4, 2018 at 3:18 PM, Nathaniel Smith wrote: > I think the fix is a little bit cumbersome, but straightforward, and > actually *simplifies* caching. [...] > And then the caching in get() becomes: > > def get(self): > if tstate->current_context

Re: [Python-Dev] PEP 567 v2

2018-01-05 Thread Nathaniel Smith
gt; [Even later] Re: your other suggestion, why couldn't the threadstate contain > just the Context? It seems one would just write > tstate->current_context->_data everywhere instead of > tstate->current_context_data. Yeah, that's probably be

Re: [Python-Dev] PEP 567 v2

2018-01-05 Thread Nathaniel Smith
from contextvars import ContextVar var = ContextVar(...) var.set(value) value = var.get() In particular, you can't reasonably do 'from contextvars import get, set'; that'd be gross :-). But 'from contextvars import ContextVar' is fine and gives you the whole user-or

[Python-Dev] PEP 568: how we could extend PEP 567 to handle generator contexts

2018-01-07 Thread Nathaniel Smith
er, it helps to know how such an extension would work. There's a rendered version at: https://www.python.org/dev/peps/pep-0568 (very slightly out of date compared to the version pasted below) -n -- PEP: 568 Title: Generator-sensitivity for Context Variables Author: Nathaniel J. Smi

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Nathaniel Smith
o > write explicitely dict.get(default=None). But that's not how dict.get works? In [1]: d = {} In [2]: print(d.get(1)) None -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Nathaniel Smith
ility. But I'd prefer either of them to the current PEP 567, which seems like an internally-contradictory hybrid of these ideas. It makes sense if you know how the code and Contexts work. But if I was talking to someone who wanted to ignore those details and just use a ContextVar, and they asked me for a one sentence summary of how it worked, I wouldn't know what to tell them. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 567 v2

2018-01-08 Thread Nathaniel Smith
On Thu, Jan 4, 2018 at 9:42 PM, Guido van Rossum wrote: > On Thu, Jan 4, 2018 at 7:58 PM, Nathaniel Smith wrote: >> This does make me think that I should write up a short PEP for >> extending PEP 567 to add context lookup, PEP 550 style: it can start >> out in Status: def

Re: [Python-Dev] PEP 567 v2

2018-01-10 Thread Nathaniel Smith
On Tue, Jan 9, 2018 at 2:59 AM, Yury Selivanov wrote: > > >> On Jan 9, 2018, at 11:18 AM, Nathaniel Smith wrote: >> The approach I took in PEP 568 is even simpler, I think. The PEP is a >> few pages long because I wanted to be exhaustive to make sure we >> weren

Re: [Python-Dev] PEP 567 pre v3

2018-01-10 Thread Nathaniel Smith
On Tue, Jan 9, 2018 at 3:41 AM, Yury Selivanov wrote: > On Tue, Jan 9, 2018 at 11:02 AM, Nathaniel Smith wrote: >> Right now, the set of valid states for a ContextVar are: it can hold >> any Python object, or it can be undefined. However, the only way it >> can be in the &q

Re: [Python-Dev] PEP 567 v3

2018-01-16 Thread Nathaniel Smith
pass in the name of variable where it will be stored as the 'name' argument to ContextVar.__init__. I tend to agree that this is something to worry about for 3.8 though. (If we need to retrofit pickle support, we could add a pickleable=False argument to ContextVar, and require people

Re: [Python-Dev] PEP 567 v3

2018-01-16 Thread Nathaniel Smith
the broken version. That's level 10 on Rusty's scale, and gives a simpler implementation too. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-d

Re: [Python-Dev] PEP 567 v3

2018-01-18 Thread Nathaniel Smith
nd suddenly pickling raises an error (because the new library internally uses a ContextVar that happens not to be pickleable). -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] LibreSSL support

2018-01-18 Thread Nathaniel Smith
On Jan 18, 2018 07:34, "Christian Heimes" wrote: On 2018-01-16 21:17, Christian Heimes wrote: > FYI, master on Travis CI now builds and uses OpenSSL 1.1.0g [1]. I have > created a daily cronjob to populate Travis' cache with OpenSSL builds. > Until the cache is filled, Linux CI will take an extra

Re: [Python-Dev] Drop support for old unsupported FreeBSD and Linux kernels?

2018-01-18 Thread Nathaniel Smith
tle surprising to see a Redhat employee suggest dropping support for RHEL 6. Hopefully you know what you're doing :-) -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python

Re: [Python-Dev] GH-NNNN vs #NNNN in merge commit

2018-01-25 Thread Nathaniel Smith
keep things moving. Anyway, I don't know if it's exactly what cpython wants, but it's at the least got some really interesting ideas. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https:

Re: [Python-Dev] Deprecate crypt module and revert PR 3854

2018-02-02 Thread Nathaniel Smith
On Feb 2, 2018 7:24 AM, "Christian Heimes" wrote: Shortly after the PR has landed, I was made aware that glibc has deprecated crypt(3) API [2] and favor of an external library called libxcrypt [3] from OpenWall Linux. I have patched Python 3.7 [4] to support libxcrypt. In light of deprecation of

Re: [Python-Dev] Dataclasses and correct hashability

2018-02-05 Thread Nathaniel Smith
utomatically generated for classes with freezable=True foo.freeze() # Now object is immutable, and hash(foo) is allowed assertRaises(foo.__setattr__, "blah", 2) hash(foo) I don't know if it's worth the complexity, but I guess it would cover at least some of the use

Re: [Python-Dev] libxml2 installation/binding issue

2018-02-05 Thread Ethan Smith
This list is for the discussion of development *of* Python. For discussion of development *with* Python, you want python-list. On Mon, Feb 5, 2018 at 2:41 PM, Priest, Matt wrote: > Hello, > > > > I am not sure if this is the correct place to post an issue/question like > this, but here goes… > >

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-21 Thread Nathaniel Smith
On Mar 21, 2018 05:40, "Steven D'Aprano" wrote: I don't want to change the behaviour of pow(), but we shouldn't dismiss the possibility of some other numeric function wanting to treat values N.0 and N the same. Let's say, an is_prime(x) function that supports floats as well as ints: is_prim

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-28 Thread Nathaniel Smith
mat users could opt into, that only promises compatibility within a given 3.X release cycle? Like version=-2 or version=pickle.NONPORTABLE or something? (This is orthogonal to Antoine's PEP.) -n -- Nathaniel J. Smith -- https://vorpus.org ___

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Nathaniel Smith
On Thu, Mar 29, 2018 at 12:56 AM, Chris Jerdonek wrote: > On Wed, Mar 28, 2018 at 6:15 PM, Nathaniel Smith wrote: >> On Wed, Mar 28, 2018 at 1:03 PM, Serhiy Storchaka >> wrote: >>> 28.03.18 21:39, Antoine Pitrou пише: >>>> I'd like to submit this PEP

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Nathaniel Smith
On Thu, Mar 29, 2018, 02:02 Chris Angelico wrote: > On Thu, Mar 29, 2018 at 7:56 PM, Paul Moore wrote: > > On 29 March 2018 at 09:49, Chris Angelico wrote: > >> On Thu, Mar 29, 2018 at 7:18 PM, Nathaniel Smith wrote: > >>> Another example is the multiproces

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-30 Thread Nathaniel Smith
uishable by user code, at least in principle. If we want to change the language spec, I guess it would be with text like: "if bool(obj) would be called twice in immediate succession, with no other code in between, then the interpreter may assume that both calls would return the same value and e

Re: [Python-Dev] Python version numbers

2018-04-03 Thread Nathaniel Smith
bt there's much appetite for fiddling with it... -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Soliciting comments on the future of the cmd module (bpo-33233)

2018-04-07 Thread Nathaniel Smith
.. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] PEP 561 implemented and minor clarification

2018-04-12 Thread Ethan Smith
lways, the PEP text is replicated below. Cheers! Ethan == PEP: 561 Title: Distributing and Packaging Type Information Author: Ethan Smith Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 09-Sep-2017 Python-Version: 3.7 Post-History: 10-Sep-2017, 12-Sep-2017, 06-Oc

Re: [Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

2018-04-24 Thread Nathaniel Smith
ut how the code worked (apart > from possibly clobbering a local name). I thought this was what q was for :-) https://pypi.org/project/q/ -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.py

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-24 Thread Nathaniel Smith
Disadvantages: Answers only a fraction > of possible use-cases, even in ``if``/``while`` statements. It does only cover a fraction of possible use-cases, but interestingly, the fraction it covers includes: - two of the three real examples given in the rationale section - exactly the cases that

Re: [Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

2018-04-26 Thread Nathaniel Smith
ide existing expressions. Expecting new users to realize that this is possible, and a good idea, and to implement it, and get it right, while they're in the middle of being confused about basic python things, is not terribly reasonable, so it's probably underuse

Re: [Python-Dev] Python startup time

2018-05-02 Thread Nathaniel Smith
On Wed, May 2, 2018, 09:51 Gregory Szorc wrote: > Correct me if I'm wrong, but aren't there downsides with regards to C > extension compatibility to not having a shared libpython? Or does all the > packaging tooling "just work" without a libpython? (It's possible I have my > wires crossed up with

Re: [Python-Dev] [RELEASE] Python 2.7.15

2018-05-02 Thread Nathaniel Smith
I would guess that the folks who end up supporting python 2 past 2020 (either as distributors or as library authors) will have an easier time of it if python 2's ssl module gets resynced with python 3 before the eol. But I suppose it's up to them to do the work... and probably other changes like tl

Re: [Python-Dev] Python startup time

2018-05-03 Thread Nathaniel Smith
On Wed, May 2, 2018, 20:59 INADA Naoki wrote: > Recently, I reported how stdlib slows down `import requests`. > https://github.com/requests/requests/issues/4315#issuecomment-385584974 [...] > * Add faster and simpler http.parser (maybe, based on h11 [1]) and avoid > using email module in http m

Re: [Python-Dev] Process to remove a Python feature

2018-05-04 Thread Nathaniel Smith
On Fri, May 4, 2018, 11:50 Serhiy Storchaka wrote: > > Ideally any deprecated feature should have a replacement, and this > replacement should be available in at least one version before adding > the deprecation warning. > > X.Y: added a replacement > > X.Y+1: added a deprecation warning. Many us

Re: [Python-Dev] A fast startup patch (was: Python startup time)

2018-05-04 Thread Nathaniel Smith
What are the obstacles to including "preloaded" objects in regular .pyc files, so that everyone can take advantage of this without rebuilding the interpreter? Off the top of my head: We'd be making the in-memory layout of those objects part of the .pyc format, so we couldn't change that within a

Re: [Python-Dev] A fast startup patch (was: Python startup time)

2018-05-05 Thread Nathaniel Smith
On Sat, May 5, 2018, 11:34 Toshio Kuratomi wrote: > > > On Sat, May 5, 2018, 10:40 AM Eric Fahlgren > wrote: > >> On Sat, May 5, 2018 at 10:30 AM, Toshio Kuratomi >> wrote: >> >>> On Fri, May 4, 2018, 7:00 PM Nathaniel Smith wrote: >>>

Re: [Python-Dev] please help triage VSTS failures

2018-05-18 Thread Nathaniel Smith
formation to go on besides that build log. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] My fork lacks a 3.7 branch - can I create it somehow?

2018-05-22 Thread Nathaniel Smith
;s very unlikely that anyone looking for a 3.7 branch would go to your fork and expect to find it there. As far as git is concerned, the main repo on github, your fork on github, and your local repo are 3 independent repositories, equally valid. The relationships between them are purely a matte

Re: [Python-Dev] PEP 574 (pickle 5) implementation and backport available

2018-05-25 Thread Nathaniel Smith
x27;re transmitting pickles between two processes on the same system – they still add extra memory copies. And that's a very common use case. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://

Re: [Python-Dev] Troubles to merge changes in the 2.7 branch: PR "out-of-date" branch

2018-05-28 Thread Nathaniel Smith
Isn't that what happens if someone enables the check box at Repository Settings -> Branches -> Branch protection rules -> [pick a branch] -> Require branches to be up to date before merging ? On Mon, May 28, 2018, 09:11 Brett Cannon wrote: > Ryan is right that there's no special setting in GitHu

Re: [Python-Dev] Withdraw PEP 546? Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2018-05-30 Thread Nathaniel Smith
On Wed, May 30, 2018, 07:30 Victor Stinner wrote: > Does anyone would benefit of MemoryBIO in Python 2.7? Twisted, > asyncio, trio, urllib3, anyone else? Asyncio and trio are strongly py3-only. Twisted's TLS functionality is built around pyopenssl, so the stdlib ssl module doesn't affect them.

Re: [Python-Dev] Withdraw PEP 546? Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2018-05-31 Thread Nathaniel Smith
On Wed, May 30, 2018, 14:21 Victor Stinner wrote: > 2018-05-30 18:02 GMT+02:00 Nathaniel Smith : > > On Wed, May 30, 2018, 07:30 Victor Stinner wrote: > >> > >> Does anyone would benefit of MemoryBIO in Python 2.7? Twisted, > >> asyncio, trio, urllib3, anyon

Re: [Python-Dev] PyIndex_Check conflicts with PEP 384

2018-06-01 Thread Nathaniel Smith
Indeed, that sounds like a pretty straightforward bug in the stable ABI. You should file an issue on bugs.python.org so it doesn't get lost (and if it's the main new stable ABI break in 3.7 then you should probably mark that bug as a release blocker so that Ned notices it). Unfortunately, very few

Re: [Python-Dev] A more flexible task creation

2018-06-13 Thread Nathaniel Smith
How about: async def wait_to_run(async_fn, *args): await wait_for_something() return await async_fn(*args) task = loop.create_task(wait_to_run(myfunc, ...)) - Whatever strategy you use, you should also think about what semantics you want if one of these delayed tasks is cancelled be

Re: [Python-Dev] A more flexible task creation

2018-06-14 Thread Nathaniel Smith
If you create all those Task objects up front, then that front-loads a chunk of work (i.e., allocating all those objects!) that otherwise would be spread throughout the queue processing. So you'll see a noticeable pause up front before the code starts working. -n -- Nathaniel J

Re: [Python-Dev] About [].append == [].append

2018-06-21 Thread Nathaniel Smith
se where it matters whether the 'self' comparison uses == or 'is', but the method object doesn't know whether 'self' is mutable, so it has to either work in general or not work in general. -n -- Nathaniel J. Smith -- https://vorpus.org _

Re: [Python-Dev] We now have C code coverage!

2018-06-22 Thread Nathaniel Smith
;s just a service for aggregation and reporting. The coverage information is being gathered while running CPython's regular CI tests, and then uploaded to codecov.io to view. So if you want to run the gui tests -- which seems like a good idea if possible! -- then the way to do that would be to

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Nathaniel Smith
ad out in text space) and the process (spread out in time) as trivial as possible." It's very disheartening that not only is PEP 572 apparently going to be accepted, but as far as I can tell neither the text nor its proponents have even addressed this basic issue. -n -- Nathaniel J. S

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Nathaniel Smith
to-common-complaints sections, and I'd be happy to write up something for that, except that despite all the electrons that have been spilled I actually do not know what the PEP authors response would be to the issues that bother me :-(. -n -- Nathaniel J. Smith -- https://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Nathaniel Smith
On Wed, Jul 4, 2018, 09:09 Steven D'Aprano wrote: > On Wed, Jul 04, 2018 at 12:10:11AM -0700, Nathaniel Smith wrote: > > > Right, Python has a *very strong* convention that each line should > > have at most one side-effect, > > import math, fractions, decimal &g

Re: [Python-Dev] Assignment expression and coding style: the while True case

2018-07-04 Thread Nathaniel Smith
nse to try to define some Official Universal Rule about when := is appropriate and when it isn't. That said, FWIW, my current feeling is that this simplest case is the only one where I would use :=; for your other examples I'd stick with the loop-and-a-half style. -n -- Nathaniel J. Smith -- h

Re: [Python-Dev] Don't assign to a variable used later in the expression

2018-07-04 Thread Nathaniel Smith
On Wed, Jul 4, 2018 at 4:10 PM, Ivan Pozdeev via Python-Dev wrote: > On 04.07.2018 10:10, Nathaniel Smith wrote: >> Right, Python has a *very strong* convention that each line should >> have at most one side-effect, and that if it does have a side-effect >> it should be a

Re: [Python-Dev] On the METH_FASTCALL calling convention

2018-07-07 Thread Nathaniel Smith
be spending their time on. But kwargs do improve readability, and it's nice when we can make readable code fast, so people aren't tempted to obfuscate things in the name of speed. -n -- Nathaniel J. Smith -- https://vorpus.org ___

<    2   3   4   5   6   7   8   9   10   11   >