there should definitely be an "isempty" accessor, but from SQLA's naming conventions we prefer to have "is_empty" as the official name. There's a bunch of precedent for this. overall people should be able to use either one.
On Sun, Dec 4, 2022, at 12:05 PM, Lele Gaifax wrote: > Federico Caselli <cfederic...@gmail.com> writes: > > > On Thursday, 1 December 2022 at 22:50:11 UTC+1 leleg...@gmail.com wrote: > > > >> "Mike Bayer" <mik...@zzzcomputing.com> writes: > >> > > >> > well ".isempty" is not the kind of naming convention we like to use > >> > these days, so that should likely be an alias. ".empty" might be > >> > named ".is_empty". Did I get ".empty" from asyncpg's API ? > >> > >> I agree with "is_empty", but both asyncpg [...] and psycopg [...] and > >> psycopg2 [...] call it "isempty", as a @property. > >> > > Postgresql does use isempty for the function that test if a range is empty > > https://www.postgresql.org/docs/current/functions-range.html#RANGE-OPERATORS-TABLE > > It seems that, given we are aiming to reduce a (PG expert) dev's suprise > when using the class, "isempty" wins. > > As I cannot really find a decisive advantage between renaming the > existing attribute vs providing a compatibility property over it, can > you help me please, even by tossing your own coin? > > Facts: a property is surely easier, but OTOH that dual way will have to > stay there forever. Renaming is not a big deal, there are actually just > a dozen places in the source tree where it used: > > $ git grep empty= > lib/sqlalchemy/dialects/postgresql/asyncpg.py: > empty=value.empty, > lib/sqlalchemy/dialects/postgresql/asyncpg.py: > empty=empty, > lib/sqlalchemy/dialects/postgresql/asyncpg.py: > empty=value.empty, > lib/sqlalchemy/dialects/postgresql/asyncpg.py: > empty=empty, > lib/sqlalchemy/dialects/postgresql/psycopg.py: > empty=not value._bounds, > lib/sqlalchemy/dialects/postgresql/psycopg.py: > empty=not elem._bounds, > lib/sqlalchemy/dialects/postgresql/psycopg2.py: > empty=not value._bounds, > lib/sqlalchemy/dialects/postgresql/ranges.py: self, > lower=None, upper=None, *, bounds="[)", empty=False > lib/sqlalchemy/dialects/postgresql/ranges.py: return > Range(None, None, empty=True) > lib/sqlalchemy/dialects/postgresql/ranges.py: return > Range(None, None, empty=True) > lib/sqlalchemy/dialects/postgresql/ranges.py: return > Range(None, None, empty=True) > test/dialect/postgresql/test_types.py: lambda **kw: > Range(empty=True), > test/dialect/postgresql/test_types.py: lambda l, r: > Range(empty=True), > test/dialect/postgresql/test_types.py: lambda r, e: > Range(empty=True), > test/dialect/postgresql/test_types.py: > is_false(bool(Range(empty=True))) > test/dialect/postgresql/test_types.py: eq_(data, > [(self._data_obj().__class__(empty=True),)]) > test/dialect/postgresql/test_types.py: eq_(data, > [(self._data_obj().__class__(empty=True),)]) > > thanks&bye, lele. > -- > nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri > real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. > l...@metapensiero.it | -- Fortunato Depero, 1929. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com > <mailto:sqlalchemy%2bunsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/871qpfqeu8.fsf%40metapensiero.it. > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/e7dac811-0f36-48cc-acbd-c6da6be7765c%40app.fastmail.com.