[Python-ideas] Re: Different exceptions for assert

2021-09-07 Thread Steven D'Aprano
On Tue, Sep 07, 2021 at 11:12:37AM -0400, Juancarlo Añez wrote: > I won't propose a syntax, but I think it would be useful if *assert* could > raise an exception different from *AssertionError*. > > This is in the context of "Design by contrast" (DBC) as a useful companion > to "Test-driven develop

[Python-ideas] Re: __name__ for partial functions

2021-09-07 Thread Kevin Mills
I'm not sure what you're proposing. What should its `__name__` be set to? If you have a value you want its `__name__` to be, you can just set it yourself. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ide

[Python-ideas] Re: open functions in dbm submodule need to support path-like object

2021-09-07 Thread Guido van Rossum
If someone posted a Pull Request that added this, it would be looked upon favorably I'm sure. On Tue, Sep 7, 2021 at 8:31 AM Christopher Barker wrote: > it looks like this as had a BPO for over a year: > > https://bugs.python.org/issue40563 > > I suggest pinging that (and maybe python-dev) to se

[Python-ideas] Re: Different exceptions for assert

2021-09-07 Thread Christopher Barker
On Tue, Sep 7, 2021 at 8:37 AM Simão Afonso < simao.afo...@powertools-tech.com> wrote: > On 2021-09-07 11:12:37, Juancarlo Añez wrote: > > Basically, the proposal is to allow for an exception type and value to be > > specified in *assert*, instead of the customary: > > > > if not assertion: > >

[Python-ideas] Re: Different exceptions for assert

2021-09-07 Thread Simão Afonso
On 2021-09-07 11:12:37, Juancarlo Añez wrote: > Basically, the proposal is to allow for an exception type and value to be > specified in *assert*, instead of the customary: > > if not assertion: > > raise ValueError('a message') What's wrong with: > if __debug__: > if not assertion: >

[Python-ideas] Re: open functions in dbm submodule need to support path-like object

2021-09-07 Thread Christopher Barker
it looks like this as had a BPO for over a year: https://bugs.python.org/issue40563 I suggest pinging that (and maybe python-dev) to see what's up. NOTE: first check 3.10 :-) -CHB On Tue, Sep 7, 2021 at 5:05 AM Evan Greenup via Python-ideas < python-ideas@python.org> wrote: > Currently, in P

[Python-ideas] Different exceptions for assert

2021-09-07 Thread Juancarlo Añez
I won't propose a syntax, but I think it would be useful if *assert* could raise an exception different from *AssertionError*. This is in the context of "Design by contrast" (DBC) as a useful companion to "Test-driven development" and other forms of external tests. Basically, the proposal is to a

[Python-ideas] Re: Add @parametrize decorator to unittest library

2021-09-07 Thread Wes Turner
unittest.subTest, hypothesis @given + pytest From https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests : ``` When there are very small differences among your tests, for instance some parameters, unittest allows you to distinguish them inside the body of a t

[Python-ideas] Re: Add @parametrize decorator to unittest library

2021-09-07 Thread Filipe Laíns
On Tue, 2021-09-07 at 02:31 +, Leonardo Freua wrote: > When writing some unit tests with the standard Unittest library, I missed > being > able to create parameterized tests. This functionality exists in PyTest > (https://docs.pytest.org/en/6.2.x/parametrize.html) and there is also a > librar

[Python-ideas] open functions in dbm submodule need to support path-like object

2021-09-07 Thread Evan Greenup via Python-ideas
Currently, in Python 3.9, `dbm.open()`, `dbm.gnu.open()` and `dbm.ndbm.open()` doesn't support path-like object, class defined in `pathlib`. It would be nice to add support with it. Sent with ProtonMail Secure Email. ___ Python-ideas mailing list -- py

[Python-ideas] __name__ for partial functions

2021-09-07 Thread Henry Harutyunyan
functools introduces partial function. As I can see from the implementation, partial functions are instance of `partial` class, and that __call__ is used to "emulate" a function call. On the other hand I guess people usually treat those as ordinary functions. The thing here is that for functions