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] Give regex operations more sugar

2018-06-13 Thread Clint Hepner
> On 2018 Jun 13 , at 4:43 p, Michel Desmoulin > wrote: > > > > Le 13/06/2018 à 19:11, Mike Miller a écrit : >> >> On 2018-06-13 06:33, Michel Desmoulin wrote: >>> >>> I often wished for findall and sub to be string methods, so +1 on that. >>> >> >> Agreed, and there are a few string

Re: [Python-ideas] Give regex operations more sugar

2018-06-13 Thread Clint Hepner
> On 2018 Jun 13 , at 7:06 a, Ken Hilton wrote: > > Hi all, > > Regexes are really useful in many places, and to me it's sad to see the > builtin "re" module having to resort to requiring a source string as an > argument. It would be much more elegant to simply do "s.search(pattern)" than

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

2018-06-12 Thread Clint Hepner
> On 2018 Jun 12 , at 10:54 a, Mikhail V wrote: > > I think it would be logical to have the insert operator for lists. > Similar to list extend operator += , it could use one of augmented > assignment operators, e,g, /=. > >L = ["aa"] > >L[0] /= "bb" > >-> ["bb", "aa"] > >

Re: [Python-ideas] datetime.timedelta literals

2018-06-04 Thread Clint Hepner
> On 2018 Jun 4 , at 9:08 a, Giampaolo Rodola' wrote: > > > > > > IMO datetimes are not common enough to deserve their own literals. It would > make the language more complex and harder to learn for a relatively little > benefit. This would probably make more sense as a third party lib:

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-18 Thread Clint Hepner
> On 2018 May 18 , at 7:37 a, Steven D'Aprano wrote: > > On Fri, May 18, 2018 at 11:17:13AM +0200, Stephan Houben wrote: > >> And the alternative is to replace all occurrences of >> spam with 퐬퐩퐚퐦 , which has the same effect and also is >> backward-compatible with 3.x for

Re: [Python-ideas] Syntax idea: escaping names to avoid keyword ambiguity

2018-05-14 Thread Clint Hepner
> On 2018 May 14 , at 6:47 a, Daniel Moisset wrote: > > Following up some of the discussions about the problems of adding keywords > and Guido's proposal of making tokenization context-dependent, I wanted to > propose an alternate way to go around the problem. My

Re: [Python-ideas] Should __builtins__ have some kind of pass-through print function, for debugging?

2018-04-27 Thread Clint Hepner
> On 2018 Apr 27 , at 9:05 a, Steven D'Aprano wrote: > > Actually, I think I can think of a way to make this work, if we're > willing to resurrect some old syntax. > > On Fri, Apr 27, 2018 at 09:27:34PM +1000, Steven D'Aprano wrote: >> I think that this is either a great

Re: [Python-ideas] Default values in multi-target assignment

2018-04-12 Thread Clint Hepner
> On 2018 Apr 12 , at 5:54 a, Serhiy Storchaka wrote: > > Yet one crazy idea. What if allow default values for targets in multi-target > assignment? > >>>> (a, b=0) = (1, 2) >>>> a, b >(1, 2) >>>> (a, b=0) = (1,) >>>> a, b >(1, 0) >>>> (a, b=0)

Re: [Python-ideas] PEP 572: Assignment Expressions (post #4)

2018-04-11 Thread Clint Hepner
> On 2018 Apr 11 , at 1:32 a, Chris Angelico wrote: > > Wholesale changes since the previous version. Statement-local name > bindings have been dropped (I'm still keeping the idea in the back of > my head; this PEP wasn't the first time I'd raised the concept), and > we're now

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-05 Thread Clint Hepner
> On 2018 Apr 5 , at 12:52 p, Peter O'Connor wrote: > > Dear all, > > In Python, I often find myself building lists where each element depends on > the last. This generally means making a for-loop, create an initial list, > and appending to it in the loop, or

Re: [Python-ideas] Sets, Dictionaries

2018-03-29 Thread Clint Hepner
> On 2018 Mar 29 , at 12:06 p, Chris Angelico wrote: > > On Fri, Mar 30, 2018 at 3:00 AM, Stephan Houben wrote: >> Perhaps one day we will be able to use >> >> ∅ >> >> for the empty set. >> That would actually match conventional notation. >> > >

Re: [Python-ideas] Sets, Dictionaries

2018-03-29 Thread Clint Hepner
> On 2018 Mar 29 , at 11:42 a, Julia Kim wrote: > > My suggestion is to change the syntax for creating an empty set and an empty > dictionary as following. > > an_empty_set = {} > an_empty_dictionary = {:} If you are willing to accept {:} as an empty dict, then

Re: [Python-ideas] Split, slice, join and return "syntax" for str

2018-03-04 Thread Clint Hepner
> On 2018 Mar 4 , at 12:59 p, Andrés Delfino wrote: > > Hi! > > I was thinking: perhaps it would be nice to be able to quicky split a string, > do some slicing, and then obtaining the joined string back. > > Say we have the string: "docs.python.org", and we want to change

Re: [Python-ideas] Should Python have user-defined constants?

2017-11-21 Thread Clint Hepner
> On Nov 21, 2017, at 5:40 AM, Stéfane Fermigier wrote: > > for i in range(0, 100): >const foo = f(i) >const bar = g(i, foo) >do_something_with(bar) This wouldn’t work, since a for loop doesn’t introduce a new scope for variables, and allowing a constant to be

Re: [Python-ideas] Python 4: Concatenation

2017-06-30 Thread Clint Hepner
> On Jun 30, 2017, at 8:43 AM, Steven D'Aprano wrote: > >> On Fri, Jun 30, 2017 at 12:51:26PM +0100, Jamie Willis wrote: >> >> Alternatively >> "<>" is an alternative, being the monoidal append operator in Haskell, >> which retains a certain similarly. > > "<>" is

Re: [Python-ideas] add __contains__ into the "type" object

2017-03-02 Thread Clint Hepner
> On 2017 Mar 2 , at 2:53 a, Stephan Houben wrote: > > A crucial difference between a set and a type is that you cannot > explicitly iterate over the elements of a type, so while we could implement > > x in int > > to do something useful, we cannot make > > for x in

Re: [Python-ideas] for/except/else

2017-03-01 Thread Clint Hepner
> On 2017 Mar 1 , at 4:37 a, Wolfgang Maier > wrote: > > I know what the regulars among you will be thinking (time machine, high bar > for language syntax changes, etc.) so let me start by assuring you that I'm > well aware of all of this, that I did