Class Variable Access and Assignment

Paul Rubin http
Sat Nov 5 01:06:45 CET 2005


Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
> A basic usage case:
> 
> class Paper:
>     size = A4
>     def __init__(self, contents):
>         # it makes no sense to have class contents,
>         # so contents go straight into the instance
>         self.contents = contents

So add:

         self.size = Paper.size

and you've removed the weirdness.  What do you gain here by inheriting?



More information about the Python-list mailing list