Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44226

Re: What is the reason for defining classes within classes in Python?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.01; 'subject:Python': 0.06; 'class,': 0.07; 'orm': 0.09; 'python:': 0.09; 'django': 0.11; '23,': 0.16; 'namespace.': 0.16; 'peewee,': 0.16; 'wrote:': 0.18; 'example': 0.22; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'class': 0.32; 'another': 0.32; 'subject:the': 0.34; 'received:google.com': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'simple': 0.61; 'within': 0.65; 'saw': 0.77; 'url:latest': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=fUgPidEqExfj/6TTr0RPoGulALgoVj4s8hYiNLbzohk=; b=nx1QCVyQwLvsY0b1CytrE0AJ4NJBG0uEiSXq/QMeGf1UMdZ7erwKj/FgUy24swbWBQ MlFDPqQqxxdZvOfT9SfrjgrLfoonrGNiyHZ7nEzOrjJbg6EnnH91ct/y7JRkvNOVmk+B 1YdhmiBx8imeVdswP3cG0L+VP2TaKiWPzdW2yVtJAR/ZLsET84lGwLH9R62l4k3bQnef R+04PvfFBw5hcGO7BA3Sc+/rKidp4225xB3SjCGEL6PmzhpRREsuufLxpj3wqtThpWjU HCKAXEyUr+ijlr69XcgNBXz2tW65w/adD7tFZivr/W+bv7grDetMcgcxch1kjvGePWYh R7gQ==
X-Received by 10.66.248.227 with SMTP id yp3mr19341500pac.158.1366755817605; Tue, 23 Apr 2013 15:23:37 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <4e46cc04-248e-4594-a24a-b272648a5e66@googlegroups.com>
References <4e46cc04-248e-4594-a24a-b272648a5e66@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 23 Apr 2013 16:22:57 -0600
Subject Re: What is the reason for defining classes within classes in Python?
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1001.1366755826.3114.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366755826 news.xs4all.nl 2179 [2001:888:2000:d::a6]:33453
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44226

Show key headers only | View raw


On Tue, Apr 23, 2013 at 3:50 PM, vasudevram <vasudevram@gmail.com> wrote:
>
> Hi list,
>
> I saw an example of defining a class within another class, here, in the docs for peewee, a simple ORM for Python:
>
> http://peewee.readthedocs.org/en/latest/peewee/quickstart.html
>
> In what way is this useful?

In that particular case they're just using it as a namespace.  Django
does the same thing.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What is the reason for defining classes within classes in Python? vasudevram <vasudevram@gmail.com> - 2013-04-23 14:50 -0700
  Re: What is the reason for defining classes within classes in Python? Ian Kelly <ian.g.kelly@gmail.com> - 2013-04-23 16:22 -0600
    Re: What is the reason for defining classes within classes in Python? vasudevram <vasudevram@gmail.com> - 2013-04-23 16:13 -0700
      Re: What is the reason for defining classes within classes in Python? alex23 <wuwei23@gmail.com> - 2013-04-23 17:50 -0700
        Re: What is the reason for defining classes within classes in Python? vasudevram <vasudevram@gmail.com> - 2013-04-24 04:01 -0700
          Re: What is the reason for defining classes within classes in Python? Peter Otten <__peter__@web.de> - 2013-04-24 14:00 +0200
            Re: What is the reason for defining classes within classes in Python? vasudevram <vasudevram@gmail.com> - 2013-04-24 06:29 -0700

csiph-web