[Python-ideas] A subclassing API for named tuples?
Antoine Pitrou
solipsis at pitrou.net
Fri Feb 15 08:03:45 CET 2013
On Fri, 15 Feb 2013 10:17:32 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
>
> class MyClassWithAnExtremelyLongName(
> collections.namedtuple("Cheese",
> ("cheddar swiss ricotta camembert gouda parmesan brie limburger havarti"
> " danish_blue roquefort greek_feta provolone mozzarella edam maasdam"
> " stilton wensleydale red_leicester american colby monterey_jack kapiti"
> " casu_marzu")
> )
> ):
> pass
I don't find that readable at all. Having many indentations in a
single declaration line makes things quite messy in my opinion, and
your important class declaration is now drowning in a sea of literals.
The equivalent __fields__ *would* be readable, if properly formatted.
Regards
Antoine.
More information about the Python-ideas
mailing list