Re: [Python-ideas] socket module: plain stuples vs named tuples - Thank you

2017-06-22 Thread Thomas Güttler
thank you! I am happy that Guido is open for a pull request ... There were +1 votes, too (and some concern about python startup time). I stopped coding in spare time, since my children are more important at the moment .. if some wants to try it ... go ahead and implement named tuples for the

Re: [Python-ideas] Language proposal: variable assignment in functional context

2017-06-22 Thread Sven R. Kunze
On 17.06.2017 17:51, Nick Coghlan wrote: You've pretty much hit on why that PEP's been deferred for ~5 years or so - I'm waiting to see use cases where we can genuinely say "this would be so much easier and more readable if we had a given construct!" :) This PEP accepted, we would have 3 ways o

[Python-ideas] Improving Catching Exceptions

2017-06-22 Thread Sven R. Kunze
Hi folks, just one note I'd like to dump here. We usually teach our newbies to catch exceptions as narrowly as possible, i.e. MyModel.DoesNotExist instead of a plain Exception. This works out quite well for now but the number of examples continue to grow where it's not enough. There are at

Re: [Python-ideas] Improving Catching Exceptions

2017-06-22 Thread Steven D'Aprano
On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote: > Hi folks, > > just one note I'd like to dump here. > > We usually teach our newbies to catch exceptions as narrowly as > possible, i.e. MyModel.DoesNotExist instead of a plain Exception. This > works out quite well for now but the

Re: [Python-ideas] Improving Catching Exceptions

2017-06-22 Thread Cameron Simpson
On 23Jun2017 06:55, Steven D'Aprano wrote: On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote: We usually teach our newbies to catch exceptions as narrowly as possible, i.e. MyModel.DoesNotExist instead of a plain Exception. This works out quite well for now but the number of example

Re: [Python-ideas] Improving Catching Exceptions

2017-06-22 Thread Andy Dirnberger
> On Jun 22, 2017, at 7:29 PM, Cameron Simpson wrote: > >> On 23Jun2017 06:55, Steven D'Aprano wrote: >>> On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote: >>> We usually teach our newbies to catch exceptions as narrowly as >>> possible, i.e. MyModel.DoesNotExist instead of a plai

Re: [Python-ideas] [Python-Dev] Language proposal: variable assignment in functional context

2017-06-22 Thread Michał Żukowski
I've implemented a PoC of `where` expression some time ago. https://github.com/thektulu/cpython/commit/9e669d63d292a639eb6ba2ecea3ed2c0c23f2636 just compile and have fun. 2017-06-17 2:27 GMT+02:00 Steven D'Aprano : > Welcome Robert. My response below. > > Follow-ups to Python-Ideas, thanks. Y

Re: [Python-ideas] Improving Catching Exceptions

2017-06-22 Thread Nick Coghlan
On 23 June 2017 at 09:29, Cameron Simpson wrote: > This is so common that I actually keep around a special hack: > >def prop(func): > ''' The builtin @property decorator lets internal AttributeErrors > escape. > While that can support properties that appear to exist > conditional

Re: [Python-ideas] Improving Catching Exceptions

2017-06-22 Thread Cameron Simpson
On 22Jun2017 19:47, Andy Dirnberger wrote: On Jun 22, 2017, at 7:29 PM, Cameron Simpson wrote: try: foo(bah[5]) except IndexError as e: ... infer that there is no bah[5] ... Of course, it is possible that bah[5] existed and that foo() raised an IndexError of its own. One might

Re: [Python-ideas] Improving Catching Exceptions

2017-06-22 Thread MRAB
On 2017-06-23 00:29, Cameron Simpson wrote: On 23Jun2017 06:55, Steven D'Aprano wrote: On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote: We usually teach our newbies to catch exceptions as narrowly as possible, i.e. MyModel.DoesNotExist instead of a plain Exception. This works out