On Tue, Nov 12, 2019, at 20:00, Samuel Muldoon wrote:
>
> *Currently, the `in` operator (also known as `__contains__`) always
> uses the rightmost argument's implementation.*
minor bikeshed: I've always considered the "r" in these to mean "reverse", not
"right".
more serious issue: method pai
Hello everybody,
today I tried to open four files simultaneously by writing
with (
open(fname1) as f1,
open(fname2) as f2,
open(fname3) as f3,
open(fname4) as f4
):
...
However, this results in a SyntaxError which is caused by the extra brackets.
Is there a reason that brack
This has being thought, asked, and even agreed as nice thing before,
however, it is blocked due
to ambiguity on the syntax for some corner cases - and, I may be wrong n
that, it would not be possible
to do with the current parser (and Python is not shifting to a more complex
parser for this featur
The syntax error is coming from finding "as" in a place it's unexpected.
(Additionally, if you were to drop the `as fn`, you'd get an AttributeError
as tuple.__enter__ isn't defined).
There's a contextlib helper that you might consider:
https://docs.python.org/3/library/contextlib.html#contextlib.
I would not recommend ExitStack for this scenario -- it's meant for
situations where the cleanup is *dynamic* (see examples in the docs:
https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack).
On Wed, Nov 13, 2019 at 10:53 AM James Edwards wrote:
> The syntax error is coming fro
On Nov 13, 2019, at 10:26, [email protected] wrote:
>
> Hello everybody,
>
> today I tried to open four files simultaneously by writing
>
> with (
>open(fname1) as f1,
>open(fname2) as f2,
>open(fname3) as f3,
>open(fname4) as f4
> ):
>...
>
> However, this results in a
On 2019-11-13 18:26, [email protected] wrote:
Hello everybody,
today I tried to open four files simultaneously by writing
with (
open(fname1) as f1,
open(fname2) as f2,
open(fname3) as f3,
open(fname4) as f4
):
...
However, this results in a SyntaxError which is ca
Correct, bad typo. :)
On Tue, Nov 12, 2019 at 2:31 PM Eric V. Smith wrote:
>
> *PEP 328 doesn’t seem to mention any of the names detailed below.*
>>
>
> I strongly advise reading PEPs as documentation once their work has
> landed. At that point they are mostly historical documents and will not b
On Wed, Nov 13, 2019 at 11:26 AM MRAB wrote:
> "with" expression ["as" name] ":"
>
> but the expression itself can start with a parenthesis, so if it saw a
> parenthesis after the "with" it would be ambiguous
>
I have used 'with' for so long that I was under the impression that the
as-targe
On Thu, Nov 14, 2019 at 8:48 AM Eric Fahlgren wrote:
> I have used 'with' for so long that I was under the impression that the
> as-target was just a name as in MRAB's simplified syntax above, so imagine my
> surprise when I tried putting parentheses around the target and didn't get a
> syntax
What Eric Fahlgren wants is basically the deprecated contextlib.nested
function, that function should have the right semantics. See
https://github.com/python/cpython/blob/2.7/Lib/contextlib.py#L88-L129
On Wed, Nov 13, 2019 at 6:55 PM Chris Angelico wrote:
> On Thu, Nov 14, 2019 at 8:48 AM Eric F
On Wed, Nov 13, 2019 at 2:09 PM Sebastian Kreft wrote:
> What Eric Fahlgren wants is basically the deprecated contextlib.nested
> function, that function should have the right semantics. See
> https://github.com/python/cpython/blob/2.7/Lib/contextlib.py#L88-L129
>
Oh, no, I don't want it. :) I
On Nov 13, 2019, at 10:26, [email protected] wrote:
with (
open(fname1) as f1,
open(fname2) as f2,
open(fname3) as f3,
open(fname4) as f4
):
Maybe you should be able to do something like
with:
open(fname1) as f1:
open(fname2) as f2:
open(fname3)
13 matches
Mail list logo