Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-16 Thread Tim Peters
[Steven D'Aprano ] > Thanks Tim! > You're welcome ;-) > Reading your digressions on the minutia of floating point maths is > certainly an education. It makes algebra and real-valued mathematics > seem easy in comparison. > Hard to say, really. The problem with floating point is that it's so

Re: [Python-ideas] Python Decorator Improvement Idea

2018-06-16 Thread Eric V. Smith
On 6/16/2018 8:22 PM, Michael Selik wrote: The idea of having a dunder to introspect the bound variable name has been discussed before. You can find the past discussions in the mailing list archive. If I recall correctly, there were very few use cases beyond namedtuple. With dataclasses

Re: [Python-ideas] Python Decorator Improvement Idea

2018-06-16 Thread Michael Selik
The idea of having a dunder to introspect the bound variable name has been discussed before. You can find the past discussions in the mailing list archive. If I recall correctly, there were very few use cases beyond namedtuple. With dataclasses available in 3.7, there may be even less interest

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-16 Thread Steven D'Aprano
On Sat, Jun 16, 2018 at 08:21:42PM +0300, Mikhail V wrote: > For example, such code: > > L = [] > L[] = x > L[] = y Should be written as L = [x, y]. > imo has more chance to be understood correctly than e.g.: > > L = [] > L ^= x > L ^= y I disagree. The first syntax

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-16 Thread Cameron Simpson
On 16Jun2018 20:21, Mikhail V wrote: On Sat, Jun 16, 2018 at 4:44 AM, Cameron Simpson wrote: On 16Jun2018 02:42, Mikhail V wrote: Some things _should_ be syntax errors. Particularly things which may be typing errors. Suppose I'd meant to type: L[0] = item Silent breakage, requiring

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-16 Thread Michael Selik
On Sat, Jun 16, 2018, 10:22 AM Mikhail V wrote: > Plus it does not introduce overloading of the operator. Now you're critizing duck typing. And overloading has weakness in this - e.g. " var1 += var2 " does not > have mnemonics, other than + character (it could be two integers as well). >

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-16 Thread Mikhail V
On Sat, Jun 16, 2018 at 4:44 AM, Cameron Simpson wrote: > On 16Jun2018 02:42, Mikhail V wrote: >> > Some things _should_ be syntax errors. Particularly things which may be > typing errors. Suppose I'd meant to type: > > L[0] = item > > Silent breakage, requiring runtime debugging. Not sure

Re: [Python-ideas] Python Decorator Improvement Idea

2018-06-16 Thread Brian Allen Vanderburg II via Python-ideas
On 06/16/2018 01:22 AM, Steven D'Aprano wrote: > Some of the information would be available in all >> contexts, while other information may only be available in certain >> contexts.The parameter's value cannot be explicitly specified, defaults >> to Null except when called as a decorator, and can

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-16 Thread Steven D'Aprano
On Thu, Jun 14, 2018 at 01:44:34PM -0500, Tim Peters wrote: > I should note that numeric code "that works" is often much subtler than it > appears at first glance. So, for educational purposes, I'll point out some > of what _wasn't_ said about this crucial function: [...] Thanks Tim! Reading

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-16 Thread Chris Angelico
On Sat, Jun 16, 2018 at 9:09 PM, Steven D'Aprano wrote: > On Sat, Jun 16, 2018 at 01:06:45PM +1200, Greg Ewing wrote: >> Michael Selik wrote: >> >The += operator was meant as an alias for ``x = x + 1``. The >> >fact that it mutates a list is somewhat of a surprise. >> >> That's very much a matter

Re: [Python-ideas] Approximately equal operator

2018-06-16 Thread Chris Angelico
On Sat, Jun 16, 2018 at 8:51 PM, Steven D'Aprano wrote: >> Python is *very* stingy with adding new operators; IIRC only 3 have >> been added over the last ~30 years (**, //, @). I don't think ~= is >> going to make it. > > Exponentiation ** goes back to Python 1.5, so I think that's only two >

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-16 Thread Steven D'Aprano
On Sat, Jun 16, 2018 at 01:06:45PM +1200, Greg Ewing wrote: > Michael Selik wrote: > >The += operator was meant as an alias for ``x = x + 1``. The > >fact that it mutates a list is somewhat of a surprise. > > That's very much a matter of opinion. For every person who > thinks this is a surprise,

Re: [Python-ideas] [issue33865] [EASY] Missing code page aliases: "unknown encoding: 874"

2018-06-16 Thread Steven D'Aprano
> It is easy to test it. Encoding/decoding with '874' should give the > same result as with 'cp874'. I know it is too late to remove that feature, but why do we support digit-only IDs for encodings? They can be ambiguous. If Wikipedia is correct, cp874 (also known as ibm874) and Windows-874

Re: [Python-ideas] Approximately equal operator

2018-06-16 Thread Steven D'Aprano
On Fri, Jun 15, 2018 at 05:31:57PM -0700, Nathaniel Smith wrote: > On Fri, Jun 15, 2018 at 3:56 PM, Andre Roberge > wrote: > > * people doing heavy numerical work and wanting code as readable as possible > > IME serious numerical work doesn't use approximate equality tests at > all, except in

Re: [Python-ideas] Loosen 'as' assignment

2018-06-16 Thread Nick Coghlan
On 16 June 2018 at 15:49, Rin Arakaki wrote: > Hi, > I'm wondering if it's possible and consistent that loosen 'as' assignment, > for example: > > >>> import psycopg2 as pg > >>> import psycopg2.extensions as pg.ex > > You can't now assign to an attribute in as statement but are there some >