Like repr and string the file system path is used alot and something like
path!p might be handy.
>>> class MyClass:
... def __fspath__(self):
... return "/home/batuhan"
...
>>> assert f"{mc!p}" == f"{os.fspath(mc)}"
Also it saves us to unnecessarily import os for only fspath().
__
On Fri, May 10, 2019 at 2:33 PM Steven D'Aprano wrote:
> On Mon, May 06, 2019 at 08:10:44PM +0300, Serge Matveenko wrote:
> > Personally, I would definitely use this in a number of places in the
> > real-life code I contribute to.
> >
> > The problem that I have with this idea is it's not clear ho
I think a Python version of longjmp() and setjmp() might be easier to
understand.
On Sun, May 12, 2019 at 6:23 PM David Mertz wrote:
> On Sun, May 12, 2019, 5:36 PM Paul Moore wrote:
>
>> On Sun, 12 May 2019 at 21:06, David Mertz wrote:
>> > I thought of 'as' initially, and it reads well as En
On Sun, May 12, 2019, 5:36 PM Paul Moore wrote:
> On Sun, 12 May 2019 at 21:06, David Mertz wrote:
> > I thought of 'as' initially, and it reads well as English. But it felt
> to me like the meaning was too different from the other meanings of 'as' in
> Python. I might be persuaded otherwise.
>
On Sun, 12 May 2019 at 21:06, David Mertz wrote:
> I thought of 'as' initially, and it reads well as English. But it felt to me
> like the meaning was too different from the other meanings of 'as' in Python.
> I might be persuaded otherwise.
If you think in terms of "named loops" rather than "l
On Sun, May 12, 2019, 3:33 PM Gustavo Carneiro wrote:
> # Hypothetical future labelled break:
>> def find_needle_in_haystacks():
>> for haystack in glob.glob('path/to/stuff/*') label HAYSTACKS:
>> fh = open(fname)
>> header = fh.readline()
>> if get_format(header) == '
I thought of "we could return immediately" shortly after I posted it. Yes,
that's true in the example I wrote. But it's easy enough to vary it so that
something happens after the loop as well. I also noticed that for the
simple version, it might be slightly shorter to put the conditional inside
the
On Mon, May 13, 2019 at 3:26 AM David Mertz wrote:
>
> To be clear in this thread, I don't think I'm really ADVOCATING for a
> multi-level break. My comments are simply noting that I personally fairly
> often encounter the situation where they would be useful. At the same time,
> I worry abou
On Sun, 12 May 2019 at 18:26, David Mertz wrote:
> To be clear in this thread, I don't think I'm really ADVOCATING for a
> multi-level break. My comments are simply noting that I personally fairly
> often encounter the situation where they would be useful. At the same
> time, I worry about Pyth
To be clear in this thread, I don't think I'm really ADVOCATING for a
multi-level break. My comments are simply noting that I personally fairly
often encounter the situation where they would be useful. At the same
time, I worry about Python gaining sometimes-useful features that
complicate the ov
On Sat, May 11, 2019 at 8:23 PM Eric V. Smith wrote:
>
>> https://www.python.org/dev/peps/pep-0557/#why-not-just-use-namedtuple
>>
>
> you would know, but that reference talks about why they are not the same
> as NamedTuple.
>
>
> That section mentions why they’re not iterable. Search on “iterabl
On 2019-05-12 10:44, Steven D'Aprano wrote:
On Sun, May 12, 2019 at 11:16:21AM +0200, Oleg Broytman wrote:
On Sun, May 12, 2019 at 01:36:28AM -0700, Elias Tarhini
wrote:
> If I may propose `break n` as a replacement for the original message's
> `break break ... break`, where n>0 is the number
The concrete example I was working on when I started to miss double
break. This is an implementation of polynomial long division in Galois
field. Almost unmodified.
With outer break, I would't need to use the `running` variable. In fact,
for mathematical clarity, I would like to put a test
What if labels are placed in comments beside the loops, like how type is,
at least, being used by analyzers?
for x in range(100): # label: outer
for y in range(3): # label: inner
On Sun, May 12, 2019 at 5:45 PM Steven D'Aprano wrote:
> On Sun, May 12, 2019 at 11:16:21AM +0200, Oleg Broy
On Sun, May 12, 2019 at 11:16:21AM +0200, Oleg Broytman wrote:
> On Sun, May 12, 2019 at 01:36:28AM -0700, Elias Tarhini
> wrote:
> > If I may propose `break n` as a replacement for the original message's
> > `break break ... break`, where n>0 is the number of contiguous loops to
> > break out of
On Sun, May 12, 2019 at 01:36:28AM -0700, Elias Tarhini
wrote:
> If I may propose `break n` as a replacement for the original message's
> `break break ... break`, where n>0 is the number of contiguous loops to
> break out of and `break 1` is synonymous with `break`. Seems easier on my
> eyes/nogg
If I may propose `break n` as a replacement for the original message's
`break break ... break`, where n>0 is the number of contiguous loops to
break out of and `break 1` is synonymous with `break`. Seems easier on my
eyes/noggin than counting out the individual `break` statements.
Eli
On Sat, May
17 matches
Mail list logo