Re: [Python-ideas] [Python-Dev] Drastically improving list.sort() for lists of strings/ints

2016-09-12 Thread Tim Peters
[Elliot Gorokhovsky ] > Wow, Tim himself! And Elliot himself! It's a party :-) > Regarding performance on semi-ordered data: we'll have to > benchmark to see, but intuitively I imagine radix would meet Timsort > because verifying that a list of strings is sorted

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Rob Cliffe
On 13/09/2016 01:45, Rob Cliffe wrote: On 12/09/2016 16:37, Guido van Rossum wrote: For the record, I still really don't like PEP 463. We should strive to catch fewer exceptions, not make it easier to catch them. Can you please clarify what you are saying in the last sentence? The first

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Ethan Furman
On 09/12/2016 08:37 AM, Guido van Rossum wrote: For the record, I still really don't like PEP 463. We should strive to catch fewer exceptions, not make it easier to catch them. I certainly agree with the first part, slightly reworded: we should strive to generate fewer exceptions that we

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Paul Moore
On 12 September 2016 at 21:47, Eric Snow wrote: > Note that there's a subtle difference here when multiple lookups are > involved. Given: > > def f(spam): > return spam().eggs().ham > > With null-coalescing: > > def f(spam): > return

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Eric Snow
On Mon, Sep 12, 2016 at 1:05 AM, Michel Desmoulin wrote: > There is also an alternative to this operator, and it's allowing a > shortcut to do: > > try: > val = do_thing() > except ThingError: > val = "default" > > In the form of: > > val = do_thing() except

Re: [Python-ideas] An exciting opportunity to update PEP 3156

2016-09-12 Thread Guido van Rossum
On Sun, Sep 11, 2016 at 11:54 PM, Andrew Svetlov wrote: > Should Task.current_task() be declared as a part of supported public API? Sure. > Should we declare that every asyncio coroutine is executed in a task > context? What importance does this have?

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 12:03 AM, Rob Cliffe wrote: > Assuming you can't break existing code that already traps TypeError, > AttributeError, etc., I don't see how you can do this without > having separated kinds of NoneError which were subclasses of TypeError, >

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Rob Cliffe
On 12/09/2016 08:05, Michel Desmoulin wrote: I messed up my answer and replied to one person instead of the list, so I'll post it again. There is also an alternative to this operator, and it's allowing a shortcut to do: try: val = do_thing() except ThingError: val = "default" In

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Ivan Levkivskyi
On 12 September 2016 at 09:05, Michel Desmoulin wrote: > In the form of: > > val = do_thing() except ThingError: "default" > > [...] > > But it also can deal with many common operations in Python without the > need to add more operators or variants: > > val =

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Ethan Furman
On 09/12/2016 12:05 AM, Michel Desmoulin wrote: There is also an alternative to this operator, and it's allowing a shortcut to do: try: val = do_thing() except ThingError: val = "default" In the form of: val = do_thing() except ThingError: "default" I was debated, and rejected,