[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-20 Thread Michael Selik
On Wed, Oct 20, 2021 at 9:18 AM Piotr Waszkiewicz wrote: > Do you think about something along those lines? > ``` > phone = book.publisher.owner.phone except AttributeError: None > ``` > Yes, that seems reasonable. > I don't mind this syntax but it would have to be supported by static type >

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-20 Thread Michael Selik
On Wed, Oct 20, 2021 at 1:16 AM Piotr Waszkiewicz wrote: > On Wed, Oct 20, 2021 at 2:33 AM Michael Selik wrote: > >> In case it saves anyone a couple clicks: >> https://www.python.org/dev/peps/pep-0463/ >> I also prefer more syntactic help with exceptions, rather than mo

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Michael Selik
On Tue, Oct 19, 2021 at 9:39 AM Chris Angelico wrote: > On Wed, Oct 20, 2021 at 3:25 AM Baptiste Carvello > wrote: > > > > Le 18/10/2021 à 20:26, Guido van Rossum a écrit : > > > > > > y = None # Default > > > if config is not None: > > > handler = config.get("handler") > > > if handler is

Re: [Python-Dev] How about updating OrderedDict in csv and configparser to regular dict?

2019-01-31 Thread Michael Selik
Waiting on review https://github.com/python/cpython/pull/8014 On Thu, Jan 31, 2019, 12:04 AM INADA Naoki I'm sorry, configparser is changed already. > https://bugs.python.org/issue33504 > > On Thu, Jan 31, 2019 at 4:52 PM INADA Naoki > wrote: > > > > Hi, > > > > csv.DictReader uses OrderedDict

Re: [Python-Dev] Standard library vs Standard distribution?

2018-11-29 Thread Michael Selik
On Thu, Nov 29, 2018 at 5:48 PM Oscar Benjamin wrote: > There have been significant improvements in pip, pypi and the whole > packaging ecosystem in recent years thanks to the efforts of many > including Paul. I've been pushing students and others to Anaconda > simply because I knew that at

Re: [Python-Dev] Standard library vs Standard distribution?

2018-11-29 Thread Michael Selik
On Thu, Nov 29, 2018 at 1:33 PM Nathaniel Smith wrote: > > > https://anaconda.com/ > > > https://www.activestate.com/products/activepython/ > > > http://winpython.github.io/ > > > http://python-xy.github.io/ > > > https://www.enthought.com/product/canopy/ > > >

Re: [Python-Dev] Experiment an opt-in new C API for Python? (leave current API unchanged)

2018-11-09 Thread Michael Selik
On Fri, Nov 9, 2018 at 4:33 PM Victor Stinner wrote: > It uses an opt-in option (Py_NEWCAPI define -- I'm not sure about the > name) to get the new API. The current C API is unchanged. > While one can hope that this will be the only time the C API will be revised, it may be better to number it

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-22 Thread Michael Selik
This thread seems more appropriate for python-ideas than python-dev. On Mon, Oct 22, 2018 at 5:28 AM Sean Harrington wrote: > Michael - the initializer/globals pattern still might be necessary if you > need to create an object AFTER a worker process has been instantiated (i.e. > a database

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-19 Thread Michael Selik
On Fri, Oct 19, 2018 at 5:01 AM Sean Harrington wrote: > I like the idea to extend the Pool class [to optimize the case when only > one function is passed to the workers]. > Why would this keep the same interface as the Pool class? If its workers are restricted to calling only one function,

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-18 Thread Michael Selik
worried about unintended consequences. On Thu, Oct 18, 2018 at 9:00 AM Michael Selik wrote: > On Thu, Oct 18, 2018 at 8:35 AM Sean Harrington > wrote: > >> The most common use case comes up when passing instance methods (of >> really big objects!) to Pool.map(). &

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-18 Thread Michael Selik
On Thu, Oct 18, 2018 at 8:35 AM Sean Harrington wrote: > The most common use case comes up when passing instance methods (of really > big objects!) to Pool.map(). > This reminds me of that old joke: "A patient says to the doctor, 'Doctor, it hurts when I ...!' The doctor replies, 'Well, don't

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-17 Thread Michael Selik
If imap_unordered is currently re-pickling and sending func each time it's called on the worker, I have to suspect there was some reason to do that and not cache it after the first call. Rather than assuming that's an opportunity for an optimization, I'd want to be certain it won't have edge case

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-16 Thread Michael Selik
Would this change the other pool method behavior in some way if the user, for whatever reason, mixed techniques? imap_unordered will only block when nexting the generator. If the user mingles nexting that generator with, say, apply_async, could the change you're proposing have some side-effect?

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-04 Thread Michael Selik
rom a different module, testing w/o globals, etc...).. > > This would essentially be an efficient implementation of Pool.starmap(), > where kwargs are static, and passed to each application of "func" over our > iterable. > > Thoughts? > > > On Sat, Sep

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-09-29 Thread Michael Selik
On Sat, Sep 29, 2018 at 5:24 AM Sean Harrington wrote: >> On Fri, Sep 28, 2018 at 4:39 PM Sean Harrington wrote: >> > My simple argument is that the developer should not be constrained to make >> > the objects passed globally available in the process, as this MAY break >> > encapsulation for

Re: [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-09-28 Thread Michael Selik
On Fri, Sep 28, 2018 at 2:11 PM Sean Harrington wrote: > kwarg on Pool.__init__ called `expect_initret`, that defaults to False. When > set to True: > Capture the return value of the initializer kwarg of Pool > Pass this value to the function being applied, as a kwarg. The parameter name you

Re: [Python-Dev] switch statement

2018-09-21 Thread Michael Selik
First, this sounds like it belongs on python-ideas, not python-dev. Second, when you do send a message to python-ideas, it'll help to accompany it with a realistic example usage that motivates your proposal. On Fri, Sep 21, 2018 at 11:18 AM wrote: > > Hi, > > A humble proposal for a switch-like

Re: [Python-Dev] Comparisions for collections.Counters

2018-09-05 Thread Michael Selik
On Wed, Sep 5, 2018 at 3:13 AM Evpok Padding wrote: > According to the [doc][1], `collections.Counter` convenience intersection > and union functions are meant to help it represent multisets. However, it > currently lacks comparisons, which would make sense and seems > straightforward to

Re: [Python-Dev] Accessing mailing list archives

2018-07-31 Thread Michael Selik
Would it be possible to normalize by the number of mailing list members and also by "active" members? The latter would be tricky to define. On Mon, Jul 30, 2018 at 3:29 PM Victor Stinner wrote: > Hi Bob, > > I wrote a basic script to compute the number of emails per PEP. It > requires to

Re: [Python-Dev] Fuzzing the Python standard library

2018-07-17 Thread Michael Selik
On Tue, Jul 17, 2018 at 4:57 PM Jussi Judin wrote: > Quick answer: undocumented billion laughs/exponential entity expansion > type of an attack that is accessible through web through any library that > uses fractions module to parse user input (that are actually available on > Github). > Are

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-07-02 Thread Michael Selik
On Sun, Jul 1, 2018 at 8:21 PM Matt Arcidy wrote: > [...] Can anyone adequately explain why this specific modality of > learning, a student-in-a-seat based educator, must outweigh all other > modalities [...]? 1. It doesn't. 2. It's a proxy for the other modes. I hope this was an adequate

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-07-02 Thread Michael Selik
On Sun, Jul 1, 2018 at 11:36 PM Tim Peters wrote: > [Michael Selik] > > My worry is that assignment expressions will add about 15 to 20 > > minutes to my class and a slight discomfort. > > So not intractable - which is my high-order bit ;-) > > For those who want more

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-07-01 Thread Michael Selik
On Sun, Jul 1, 2018 at 5:28 PM Steven D'Aprano wrote: > On Sun, Jul 01, 2018 at 08:35:08AM -0700, Michael Selik wrote: > > On Sun, Jul 1, 2018 at 12:39 AM Tim Peters wrote: > > > > > So, ya, when someone claims [assignment expressions will] make Python > > > s

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-07-01 Thread Michael Selik
On Sun, Jul 1, 2018 at 12:39 AM Tim Peters wrote: > So, ya, when someone claims [assignment expressions will] make Python > significantly harder to teach, I'm skeptical of that claim. > I don't believe anyone is making that claim. My worry is that assignment expressions will add about 15 to 20

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-30 Thread Michael Selik
On Sat, Jun 30, 2018 at 9:43 AM Tim Peters wrote: > The attractions are instead in the areas of reducing redundancy, improving > clarity, allowing to remove semantically pointless indentation levels in > some cases, indeed trading away some horizontal whitespace in otherwise > nearly empty lines

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-24 Thread Michael Selik
On Sun, Jun 24, 2018 at 4:57 PM Guido van Rossum wrote: > On Sun, Jun 24, 2018 at 2:41 PM Michael Selik wrote: > >> This thread started with a request for educator feedback, which I took to >> mean observations of student reactions. I've only had the chance to test >

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-24 Thread Michael Selik
recommended as a beginner's language. On Fri, Jun 22, 2018 at 7:48 PM Steven D'Aprano wrote: > On Fri, Jun 22, 2018 at 10:59:43AM -0700, Michael Selik wrote: > > Of course they do -- they're less fluent at reading code. They don't > have the experience to judge good code fr

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-22 Thread Michael Selik
On Fri, Jun 22, 2018 at 10:19 AM Chris Angelico wrote: > On Sat, Jun 23, 2018 at 3:02 AM, Michael Selik wrote: > > On Fri, Jun 22, 2018 at 8:09 AM Antoine Pitrou > wrote: > >> > >> Thank you. Personally, I'd like to see feedback from > >> educators/te

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-22 Thread Michael Selik
On Fri, Jun 22, 2018 at 10:02 AM Michael Selik wrote: > On Fri, Jun 22, 2018 at 8:09 AM Antoine Pitrou > wrote: > >> Thank you. Personally, I'd like to see feedback from >> educators/teachers after they take the time to read the PEP and take >> some time to think ab

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-22 Thread Michael Selik
On Fri, Jun 22, 2018 at 8:09 AM Antoine Pitrou wrote: > Thank you. Personally, I'd like to see feedback from > educators/teachers after they take the time to read the PEP and take > some time to think about its consequences. > I've started testing the proposed syntax when I teach. I don't have

Re: [Python-Dev] Add __reversed__ methods for dict

2018-06-08 Thread Michael Selik
Am I correct in saying that the consensus is +1 for inclusion in v3.8? The last point in the thread was INADA Naoki researching various implementations and deciding that it's OK to include this feature in 3.8. As I understand it, Guido was in agreement with INADA's advice to wait for

Re: [Python-Dev] collections.Counter __add__ implementation quirk

2015-11-24 Thread Michael Selik
Raymond, I think you made a typographical error in your Counter.update example. >>> from collections import Counter >>> c = Counter(a=4, b=2, c=0, d=-2) >>> d = Counter(a=1, b=-5, c=-2, d=6) >>> c.update(d) >>> c Counter({'a': 5, 'd': 4, 'c': -2, 'b': -3}) Pair

Re: [Python-Dev] Rationale behind lazy map/filter

2015-11-04 Thread Michael Selik
> I'm not suggesting restarting at the top (I've elsewhere suggested that > many such methods would be better as an *iterable* that can be restarted > at the top by calling iter() multiple times, but that's not the same > thing). I'm suggesting raising an exception other than StopIteration, so >