I was reading
https://stackoverflow.com/questions/7406102/create-sane-safe-filename-from-any-unsafe-string
and was thinking that functionality to create safe paths from unsafe paths and
check if a Path would work on a given filesystem would well in Pathlib.
When I have needed this I have added a separate _factory keyword argument
to my function - so the user can specify a value to or a callable to
_factory with the doc string clearly spelling out the semantics - and
what happens if neither is passed - yes another argument but the semantics are
On Mon, 20 Jul 2020 at 03:26, Jonathan Goble wrote:
>> One use case that comes up in xarray and pandas is support for indicating
>> indexing "modes". For example, when indexing with floating point numbers
>> it's convenient to be able to opt-in to approximate indexing, e.g.,
>> something like:
On Fri, 17 Jul 2020 at 20:58, Christopher Barker wrote:
> So what would the “key object” be I the proposed case:
>
> d2[a=1, b=2]
>
> A namedtuple? Or namedtuple-like object?
This was already discussed in PEP-472 as the "namedtuple" strategy,
but among the various negative points were the
What you're running into is how Python handles default arguments.
Take this for example:
def my_func(seq=[]):
print(seq)
seq.append(42)
print(seq)
my_func()
# []
# [42]
my_func()
# [42]
# [42, 42]
___
Python-ideas
Yes exactly. datetime.datetime.now() would call the function and
datetime.datetime.now would pass the function. So it would be nice to have a
way to pass a deferred call.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an
Ok my thoughts was that python is such an elegant language, a process that
could add a non static value (a callable or generator for example) to a
function's default parameter would add more elegance to the default handling.
what a decorator and a helper function do is to double the amount of
S.O post was this one.
https://stackoverflow.com/questions/50653182/can-a-lambda-or-other-method-be-used-as-a-default-parameter-in-python
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to