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().
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
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, 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
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
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
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
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
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
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
>
12 matches
Mail list logo