[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-19 Thread Sylvain Marie
Sylvain Marie <sylvain.ma...@schneider-electric.com> added the comment: Very much interested by the topic. For reference I tried to summarize the status of inline type and value validation here: https://smarie.github.io/python-valid8/why_validation/ And I proposed a solution with a l

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Sylvain Marie
Sylvain Marie <sylvain.ma...@schneider-electric.com> added the comment: Thanks ! 1. > ok 2. > ok 3. > That's simply 'the latest state' in the discussion. I guess that having Boolean in numbers is better than it being in its own module, since it is consistent with the other

[issue32886] new Boolean ABC in numbers module

2018-02-22 Thread Sylvain Marie
Sylvain Marie <sylvain.ma...@schneider-electric.com> added the comment: @Mark : the '__invert__' method is out of the game since Josh comment (and my reply https://bugs.python.org/issue32886#msg312478 ) So the remaining operations *are* an abstraction of both python bool and numpy

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-20 Thread Sylvain Marie
New submission from Sylvain Marie <sylvain.ma...@schneider-electric.com>: This issue is created following the discussion [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module. The following items are suggested: - adding a 'Boolean' ABC class to the 'numbers'

[issue32886] new Boolean ABC in numbers module

2018-02-22 Thread Sylvain Marie
Change by Sylvain Marie <sylvain.ma...@schneider-electric.com>: Added file: https://bugs.python.org/file47457/proposal.py ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Sylvain Marie
Sylvain Marie <sylvain.ma...@schneider-electric.com> added the comment: @Mark: you are right. That's why the proposed ABC does NOT inherit from Integral/Integer and focuses on boolean logic in its simplest form (not, and, or, xor). This one is common to both python bool and np.bool_. @

[issue32886] new Boolean ABC in numbers module

2018-04-17 Thread Sylvain Marie
Sylvain Marie <sylvain.ma...@schneider-electric.com> added the comment: Mark I get your point. Mine is just to have a common abstraction between python's primitive bool and numpy bool (and possibly other future alternate booleans) for consistency with `numbers` and to be used in commo

[issue36553] inspect.is_decorator_call(frame)

2019-04-08 Thread Sylvain Marie
New submission from Sylvain Marie : Python decorators are frequently proposed by libraries as an easy way to add functionality to user-written functions: see `attrs`, `pytest`, `click`, `marshmallow`, etc. A common pattern in most such libraries, is that they do not want to provide users

[issue30129] functools.partialmethod should look more like what it's impersonating.

2019-09-20 Thread Sylvain Marie
Sylvain Marie added the comment: For future reference if this topic re-opens, there is now an alternative here: https://smarie.github.io/python-makefun/#removing-parameters-easily Note: it relies on a dynamic `compile` statement so of course it is less optimal than the one in functools

[issue36553] inspect.is_decorator_call(frame)

2019-10-10 Thread Sylvain Marie
Sylvain Marie added the comment: Quick update on this feature: for the following example to work: from inspect import is_decorator_call def set_hello_tag(tag='world'): if is_decorator_call(): # called without parenthesis! # the decorated object is `tag` return

[issue44452] Allow paths to be joined without worrying about a leading slash

2021-09-10 Thread Sylvain Marie
Sylvain Marie added the comment: +1 on this, I am totally in line with the original post. The / operator semantics should not imply any notion of drive or of "cd" command on a shell. It should simply stick to "concatenate", i.e. "create child path" (and actual

[issue47187] locale module example is wrong for some platforms

2022-04-01 Thread Sylvain Marie
New submission from Sylvain Marie : The example in the doc shows ```python >>> import locale >>> loc = locale.getlocale() # get current locale # use German locale; name might vary with platform >>> locale.setlocale(locale.LC_ALL, 'de_DE') >>> locale