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

2018-06-17 Thread Mikhail V
On Sun, Jun 17, 2018 at 2:52 AM, Steven D'Aprano wrote: > On Sat, Jun 16, 2018 at 08:21:42PM +0300, Mikhail V wrote: > >> By L[] there is some mnemonical hint because [] is used to create >> new empty list. > > How is that a hint? What is the connection between "append an item" and > "create a ne

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

2018-06-17 Thread Stephen J. Turnbull
Folks. There are standards. "1252" *is not* an alias for "windows-1252" according to the IANA, while "866" *is* an alias for "IBM866" according to the same authority. Most 3-digit "IBMxxx" ARE aliased to both "cpxxx" and just "xxx", but not all. None of "IBM874", "874", or "cp874" exists accord

Re: [Python-ideas] Meta-PEP about C functions

2018-06-17 Thread Nick Coghlan
On 14 June 2018 at 01:15, Jeroen Demeyer wrote: > I have finished my "meta-PEP" for issues with built-in (implemented in C) > functions and methods. This is meant to become an "informational" (not > standards track) PEP for other PEPs to refer to. > > You can read the full text at > https://github

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

2018-06-17 Thread Steven D'Aprano
On Sun, Jun 17, 2018 at 02:43:16PM +0300, Mikhail V wrote: > On Sun, Jun 17, 2018 at 2:52 AM, Steven D'Aprano wrote: > > On Sat, Jun 16, 2018 at 08:21:42PM +0300, Mikhail V wrote: > > > > >> By L[] there is some mnemonical hint because [] is used to create > >> new empty list. > > > > How is that

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

2018-06-17 Thread Pål Grønås Drange
Mikhail, this thread is getting quite long, and difficult to follow. It's quite clear that a new operator won't be introduced for list insertion. Furthermore, this thread has now become a hard-to-follow and impossible-to-participate-in debate. If you have other ideas, could you maybe formulate t

[Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Mikhail V
[by request I've made new subject and summary of proposal] The idea is to introduce new syntax for the list.append() method. Syntax: Variant 1. Use special case of index, namely omitted index: mylist[] = item Examples: mylist = [1, 2, 3]--> [1, 2, 3] mylist[] = x

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Michael Selik
On Sun, Jun 17, 2018, 10:01 AM Mikhail V wrote: > The idea is to introduce new syntax for the list.append() method. > While you have summarized your proposal, you haven't included a summary of the criticism. Also, one thing that's very common for proposals to change syntax and create new uses f

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Robert Vanden Eynde
Some api (in c++ at least) use "<<" for appending. A = [1,2,7,2] A <<= 5 A == [1,2,7,2,5] The A[] = syntax has it's benefits being used in php (and I think some other lang). Le dim. 17 juin 2018 à 19:12, Michael Selik a écrit : > On Sun, Jun 17, 2018, 10:01 AM Mikhail V wrote: > >> The idea i

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

2018-06-17 Thread Ronald Oussoren
> On 17 Jun 2018, at 14:02, Stephen J. Turnbull > wrote: > > Folks. There are standards. "1252" *is not* an alias for > "windows-1252" according to the IANA, while "866" *is* an alias for > "IBM866" according to the same authority. Most 3-digit "IBMxxx" ARE > aliased to both "cpxxx" and jus

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

2018-06-17 Thread Chris Angelico
On Sun, Jun 17, 2018 at 11:38 PM, Steven D'Aprano wrote: > As for "frequent operation", there are lots of frequent operations in > Python. Does every one of them deserve special syntax to make it clean? > I just opened one of my modules at random, and I don't have a single > append in that module,

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Chris Angelico
On Mon, Jun 18, 2018 at 3:01 AM, Mikhail V wrote: > The idea is to introduce new syntax for the list.append() method. > > > Syntax: > > Variant 1. > Use special case of index, namely omitted index: > > mylist[] = item Creation of syntax cannot be done for just one type. So what would this mea

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

2018-06-17 Thread Jelle Zijlstra
2018-06-17 13:09 GMT-07:00 Chris Angelico : > > kwargs.pop("some_key") could plausibly be spelled del > kwargs["some_key"] if del were (like yield) upgraded to expression. > Whether that is an improvement or not, I don't know, but at least it's > logical. > That already works. It calls the __delit

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

2018-06-17 Thread Chris Angelico
On Mon, Jun 18, 2018 at 6:52 AM, Jelle Zijlstra wrote: > > > 2018-06-17 13:09 GMT-07:00 Chris Angelico : >> >> >> kwargs.pop("some_key") could plausibly be spelled del >> kwargs["some_key"] if del were (like yield) upgraded to expression. >> Whether that is an improvement or not, I don't know, but

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Clint Hepner
> On Jun 17, 2018, at 4:18 PM, Chris Angelico wrote: > >> On Mon, Jun 18, 2018 at 3:01 AM, Mikhail V wrote: >> The idea is to introduce new syntax for the list.append() method. >> >> >> Syntax: >> >> Variant 1. >> Use special case of index, namely omitted index: >> >>mylist[] = item >

Re: [Python-ideas] Check type hints in stack trace printing

2018-06-17 Thread Ivan Levkivskyi
On 14 June 2018 at 12:03, Daniel Sánchez Fábregas < [email protected]> wrote: > My idea consist in: > Adding a method to perform type checking in traceback objects > When printing stack traces search for mistyped arguments and warn about > them to the user. > > Don't know if it is

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Alexandre Brault
On 2018-06-17 7:36 PM, Clint Hepner wrote: On Jun 17, 2018, at 4:18 PM, Chris Angelico wrote: On Mon, Jun 18, 2018 at 3:01 AM, Mikhail V wrote: The idea is to introduce new syntax for the list.append() method. Syntax: Variant 1. Use special case of index, namely omitted index: myl

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Chris Angelico
On Mon, Jun 18, 2018 at 9:36 AM, Clint Hepner wrote: > > >> On Jun 17, 2018, at 4:18 PM, Chris Angelico wrote: >> >>> On Mon, Jun 18, 2018 at 3:01 AM, Mikhail V wrote: >>> The idea is to introduce new syntax for the list.append() method. >>> >>> >>> Syntax: >>> >>> Variant 1. >>> Use special cas

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

2018-06-17 Thread Steven D'Aprano
> Sure, but for at least one user Python 3.6 fails to start because > initialising the sys.std* streams fails due to not finding a “874” > encoding. That doesn't mean that the bug is best fixed by adding an alias. If the error was failing to find encoding "ltain-1", would we add an alias or fi

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

2018-06-17 Thread Greg Ewing
Chris Angelico wrote: kwargs.pop("some_key") could plausibly be spelled del kwargs["some_key"] if del were (like yield) upgraded to expression. Except that "delete" is a really misleading name for such an operation! -- Greg ___ Python-ideas mailing

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

2018-06-17 Thread Chris Angelico
On Mon, Jun 18, 2018 at 9:28 AM, Greg Ewing wrote: > Chris Angelico wrote: > >> kwargs.pop("some_key") could plausibly be spelled del >> kwargs["some_key"] if del were (like yield) upgraded to expression. > > > Except that "delete" is a really misleading name for such > an operation! > Is it? It'

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Steven D'Aprano
On Mon, Jun 18, 2018 at 10:07:07AM +1000, Chris Angelico wrote: > On Mon, Jun 18, 2018 at 9:36 AM, Clint Hepner wrote: [...] > > That’s false. @ was added solely for matrix multiplication. > > Ah, confusing bit of language there. It certainly is. You are talking about *types* and Clint is talkin

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Chris Angelico
On Mon, Jun 18, 2018 at 10:50 AM, Steven D'Aprano wrote: >> (It's also worth noting that the @ operator is unique in being created >> solely for the benefit of third-party types. Every other operator is >> supported by the core types - usually by many of them. > > That's not quite correct: althoug

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Steven D'Aprano
On Sun, Jun 17, 2018 at 08:01:09PM +0300, Mikhail V wrote: > The idea is to introduce new syntax for the list.append() method. Before trying to justify any specific syntax, you need to justify the idea of using syntax in the first place. > Motivation > --- > > 1. Assignment form reduc

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-17 Thread Robert Vanden Eynde
I understand the view from the poster, most basic list operations are using brackets, ie reading and writing with [], delete with del L[], why not append ? And being used extensively, that brackets are annoying. And yes, += [] is more "concise" than .append() so some people would think it's more