Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88181
| Date | 2015-03-27 20:24 +0000 |
|---|---|
| Subject | Proposal for new minor syntax |
| From | Jamie Willis <jw14896.2014@my.bristol.ac.uk> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.275.1427487867.10327.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
I would like to propose a new piece of syntax for the python language; .= In short, the operator is form of syntactic sugar, for instance consider the following code: hello = "hello world " hello = hello.strip() This could be written as: hello = "hello world " hello .= strip() In this slightly contrived example, the programmer saved (a small amount of) time when writing the code. With code with longer variable names, or lots of similar statements all in a row, this helps to keep code more concise. The operator would be constricted to one method or field on the right-hand side, which must belong to the object on the left hand side. Another example could be when using Linked Lists, instead of writing something like: loop_node = loop_node.next you could write: loop_node .= next Does this idea have any chance of acceptance if submitted as a PEP? What are the potential concerns I could consider with the syntax? Thanks, Jamie
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Proposal for new minor syntax Jamie Willis <jw14896.2014@my.bristol.ac.uk> - 2015-03-27 20:24 +0000 Proposal for new minor syntax Sayth <flebber.crue@gmail.com> - 2015-03-28 20:13 -0700
csiph-web