[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Steven D'Aprano
There are at least three existing ways to already do this. (foo["bar"] ["baz"] ["eggs"] ["spam"]) = 1 foo["bar"][ "baz"][ "eggs"][ "spam"] = 1 foo["bar"]\ ["baz"]\ ["eggs"]\ ["spam"] = 1 I think the first

[Python-ideas] Re: Expand the try-expect syntax to support conditional expect block

2022-05-24 Thread Andre Delfino
I believe this would make the code more legible. Serhiy's take is very confusing to me (I get it, but don't think one should write like to get this behavior). ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to pytho

[Python-ideas] Re: Would it be desirable to save the state of functools.cache?

2022-05-24 Thread Paul Moore
Conceivably. I know I've had cases where this would be helpful. (But on the other hand, it's not *that* hard to write your own persistent cache for your specific use case if you need it). I think this is a case where someone should just create a PR and submit it. No need for a big debate, the core

[Python-ideas] Would it be desirable to save the state of functools.cache?

2022-05-24 Thread Neil Girdhar
Would it be desirable to save the state of functools.cache between program executions? For example, by providing cache_state property on the cache that is pickle-able.___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Benedict Verhegghe
Op 24/05/2022 om 18:46 schreef Chris Angelico: (foo["bar"] ["baz"] ["eggs"] ["spam"] = 1) Not for assignment, unfortunately. And you can't cheat with := either, since only simple names are permitted. This would work: (foo["bar"] ["baz"] ["eggs"] ["spam"]) =

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Chris Angelico
On Wed, 25 May 2022 at 01:08, Jeremiah Paige wrote: > > While that formatting does look nice, this would be a huge change to the > parser just to allow a new formatting style. Right now lines are only > logically joined if they appear between a pair of () [] or {}, or if the line > ends in a \.

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Paul Moore
On Tue, 24 May 2022 at 15:42, Jan Costandius wrote: > > I think that it would be beneficial for PEP 8 conformance, in the case of > large nested dicts, if one were able to separate dict indices by a newline. > What I mean is shown below: > > foo["bar"] > ["baz"] > ["eggs"] > ["spa

[Python-ideas] Re: Whitespace handling for indexing

2022-05-24 Thread Jeremiah Paige
While that formatting does look nice, this would be a huge change to the parser just to allow a new formatting style. Right now lines are only logically joined if they appear between a pair of () [] or {}, or if the line ends in a \. Besides the complication of joining lines under new circumstances

[Python-ideas] Whitespace handling for indexing

2022-05-24 Thread Jan Costandius
I think that it would be beneficial for PEP 8 conformance, in the case of large nested dicts, if one were able to separate dict indices by a newline. What I mean is shown below: foo["bar"] ["baz"] ["eggs"] ["spam"] = 1 ___ Python-ideas m

[Python-ideas] Re: TextIOBase: Make tell() and seek() pythonic

2022-05-24 Thread Chris Angelico
On Tue, 24 May 2022 at 23:03, wrote: > > seek() and tell() works with opaque values, called cookies. > This is close to low level details, but it is not pythonic. > (Non-pythonic and non-portable behaviour) > Currently feeding seek() with wrong values could lead to unexpected behaviour. > There sh

[Python-ideas] TextIOBase: Make tell() and seek() pythonic

2022-05-24 Thread mguinhos
seek() and tell() works with opaque values, called cookies. This is close to low level details, but it is not pythonic. (Non-pythonic and non-portable behaviour) Currently feeding seek() with wrong values could lead to unexpected behaviour. There should be a safer abstraction to these two basic fun