maybe clearer
class Address(object):
def __init__(self, name, value, towndetail):
self.name = name
self.value = value
self.towndetail = towndetail
@classmethod
def __composite_constructor__(cls, name, value, town_name, town_value):
"""given name, value, name, value return Address(... TownDetail)"""
return Address(name, value, TownDetail(town_name, town_value))
def __composite_values__(self):
"""express Address(... TownDetail) in terms of name, value, name, value"""
return (self.name, self.value) + self.towndetail.__composite_values__()
def __eq__(self, other):
return isinstance(other, self.__class__) and\
make_dump(self) == make_dump(other)
def __ne__(self, other):
return not self.__eq__(other)
On Thu, Dec 13, 2018 at 8:47 AM Tolstov Sergey <[email protected]> wrote:
>
> That is my fault, sorry)
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.