Proposal: Python Class Files

Michal Wallace sabren at manifestation.com
Fri Oct 6 21:14:18 EDT 2000


On Sat, 7 Oct 2000 echuck at mindspring.com wrote:

> In article <mailman.970844952.10953.python-list at python.org>,
>   Michal Wallace <sabren at manifestation.com> wrote:
> > Class files would work like this:
> >
> > 1. Each class file contains one and only one class.
> 
> Why? If we have Foo.pc, but the Foo class requires some supporting
> internal classes, I should be allowed to create them in the same
> module. However, they wouldn't get put in the containing name space.

You can still do that. Just make the internal class... well,
internal.. :)

>>> class Foo:
>>>    class Bar:
>>>        x = 1
>>>    def __init__(self):
>>>        aBar = Foo.Bar()
>>>        print aBar.x
>>>
>>> f = Foo()
1

Then the Bar class is just a member of Foo.
I guess I should say one and only one TOP LEVEL class..

Cheers,

- Michal
------------------------------------------------------------------------
www.manifestation.com  www.sabren.com  www.linkwatcher.com  www.zike.net
------------------------------------------------------------------------





More information about the Python-list mailing list