There's already:
for i in range(j):
if i > 5:
...
else:
...
else:
...
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://m
Excuse me, ignore my previous post, this is the correct implementation. It
works for every iterable:
import itertools as itools
def segment(it, n=1):
if n < 1:
raise ValueError(f"Number of segment must be > 0")
try:
len_it = len(it)
import itertools as itools
def segment(it, n=1):
try:
len_it = len(it)
it_true = it
except TypeError:
it_true = tuple(it)
len_it = len(it_true)
size, rest = divmod(len_it, n)
sizes = [size] * n
for i in range(rest):
sizes[-i] +=
Well, I suppose it wants simlink=False.
Anyway, why not change the signature of move to
def move(src, dst, **kwargs):
and change the call of copytree to
copytree(src, real_dst, **kwargs)
?
___
Python-ideas mailing list -- python-ideas@python.org
To
On Dec 24, 2019, at 05:34, Andrew T wrote:
>
> This is a feature PHP has had since PHP7 and is what I use all the time with
> PHP. It works on a file by file basis (I guess for backward compatibility), a
> declare line needs to be at the top of a file `declare(strict_types=1);` If
> this line
You can do this without having to change the language by writing a
decorator that enforces the types. The type information is all recoverable
from __attributes__.
Be aware though that while enforcing types like int or str is easy,
enforcing something list List[int] is less obvious -- you probably
This is a feature PHP has had since PHP7 and is what I use all the time with
PHP. It works on a file by file basis (I guess for backward compatibility), a
declare line needs to be at the top of a file `declare(strict_types=1);` If
this line is at the top of the file, then a TypeError is thrown o