Andrew Barnert wrote:
> On Dec 25, 2019, at 14:57, python-ideas--- via Python-ideas
> python-ideas@python.org wrote:
> > If I can spend my two cents, I think the fact the
> > most of you prefer | is because is already how sets works. And IMHO it's a
> > bit i
Well, `json` and the other modules could add another standard: `serialize` and
`deserialize`
As an example, this is how I deserialize from a custom class:
def __init__(self, source):
path = None
try:
# most common case: JSON string
self._data_raw = js
If I can spend my two cents, I think the fact the most of you prefer | is
because is already how sets works. And IMHO it's a bit illogical, since sets
also support -. So I do not understand why | was chosen instead of +.
Furthermore, sets supports < operator, that gives you the false hope that se
Excuse me again, I just relized that my algorithm was flawed. I just inserted
in my function the brilliant algorithm of Mark Dickinson and now it works:
import itertools as itools
def segment(it, n=1):
if n < 1:
raise ValueError(f"Number of segment must be > 0, {n} found"
See my implementation, is generic and not only for strings. It could be added
to more-itertools, I suppose:
https://mail.python.org/archives/list/python-ideas@python.org/message/E452LQGA3XKU5ADPTG54XP36ENXDZN2B/
___
Python-ideas mailing list -- python-i
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