Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66665
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jonnojohnson@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'architect': 0.04; 'essentially': 0.04; 'syntax': 0.04; 'classes,': 0.05; 'that?': 0.05; 'class,': 0.07; 'nested': 0.07; 'arguments': 0.09; 'attributes': 0.09; 'indicates': 0.09; 'objects:': 0.09; 'pointers': 0.09; 'subject:module': 0.09; 'way:': 0.09; 'cc:addr :python-list': 0.11; 'subject:Help': 0.11; 'python': 0.11; 'suggest': 0.14; '(yes': 0.16; 'attributes.': 0.16; 'ben,': 0.16; 'class).': 0.16; 'creation.': 0.16; 'docstring': 0.16; 'docstrings': 0.16; 'finney': 0.16; 'foo,': 0.16; 'methods*': 0.16; 'modules,': 0.16; 'of"': 0.16; 'rather,': 0.16; 'subject: \n ': 0.16; 'subject:class': 0.16; 'subject:which': 0.16; 'tab': 0.16; 'thereby': 0.16; 'elements': 0.16; 'for?': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'basically': 0.19; 'feb': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'bar.': 0.24; 'enhanced': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; '>': 0.26; 'class.': 0.26; 'distribute': 0.26; 'asking': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'point': 0.28; 'function': 0.29; 'appreciated.': 0.29; 'external': 0.29; 'resolution': 0.29; 'properties': 0.29; 'needed.': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'comments': 0.31; 'reply.': 0.31; '(perhaps': 0.31; 'changed.': 0.31; 'though.': 0.31; 'writes:': 0.31; 'allows': 0.31; 'class': 0.32; 'this.': 0.32; 'figure': 0.32; 'another': 0.32; "i'd": 0.34; 'subject:from': 0.34; 'tool': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'accessing': 0.36; 'functions.': 0.36; 'opposed': 0.36; 'doing': 0.36; 'thanks': 0.36; "i'll": 0.36; 'possible': 0.36; 'changing': 0.37; 'requirements': 0.37; 'list': 0.37; 'clear': 0.37; 'architecture': 0.38; 'subject:new': 0.38; 'skip:& 10': 0.38; 'ben': 0.38; 'generic': 0.38; 'pm,': 0.38; 'rather': 0.38; 'little': 0.38; 'anything': 0.39; 'explain': 0.39; 'structure': 0.39; 'sure': 0.39; 'how': 0.40; 'chain': 0.60; 'eventually': 0.60; 'skip:n 30': 0.60; 'forum': 0.61; 'new': 0.61; 'skip:* 10': 0.61; 'strictly': 0.61; "you're": 0.61; 'act': 0.63; 'kind': 0.63; 'real': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'within': 0.65; 'below.': 0.71; 'unusual': 0.74; 'completion': 0.78; 'introduce': 0.78; 'skip:n 40': 0.81; 'objectives': 0.83; '*new': 0.84; 'taken.': 0.84; 'those?': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ukjHhfgXfDVcyH3INDJh/rr92jOoXljgV2R5fJNKx7Q=; b=k+PbTyGmdYLorPEyZ3361eXVj+smmGtE4zN6l8pcaDqF/quNs329FqRczQRI+TTRNy 2dycd/JYAbaXy2rfJNs/mCSjErRsGhPLSYKUR7kDtgHDczdI2G/auJxaqhK0bi92hIUB Aa6WM4fb46PBcePYPC1IJhh05TAycHF1/zJ+VzLAgCKwl0a+tGPE9KPSB2aO+0mC9W+B GUMA5BiGVraKoRdFS5dv5+T1WbHrRSDn2ZEkfYkIMQ7O3887JLbi+SgOVxWaRqJIYdjb bGR69geniycZ43qNtlmohccopAG41+v8nS+5yhMQLOjIG3a3ClS8PtYw/fdn+acGmfZJ KVAQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.229.98.129 with SMTP id q1mr47871665qcn.3.1392783400955; Tue, 18 Feb 2014 20:16:40 -0800 (PST) |
| In-Reply-To | <85fvng407b.fsf@benfinney.id.au> |
| References | <CAGz2ECZLVTTAKTY9-Syz=VsxmwS-xfEODkfZFZemYPRdY8FKNA@mail.gmail.com> <85fvng407b.fsf@benfinney.id.au> |
| Date | Tue, 18 Feb 2014 22:16:40 -0600 |
| Subject | Re: Help creating new module which inherits existing class from another module. |
| From | Jonno <jonnojohnson@gmail.com> |
| To | Ben Finney <ben+python@benfinney.id.au> |
| Content-Type | multipart/alternative; boundary=001a11c28f8adcf2c604f2baa766 |
| Cc | python-list@python.org |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7135.1392783409.18130.python-list@python.org> (permalink) |
| Lines | 273 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1392783409 news.xs4all.nl 2845 [2001:888:2000:d::a6]:53187 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:66665 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Ben,
Thanks for your reply. I'll try to ellaborate a little more in the comments
below.
On Tue, Feb 18, 2014 at 2:47 PM, Ben Finney <ben+python@benfinney.id.au>wrote:
> Jonno <jonnojohnson@gmail.com> writes:
>
> > I'm not sure if this list is a suitable place to ask for this kind of
> > help so if it's not please just suggest another forum which might be
> > more suitable.
>
> Welcome! Asking for help with writing Python code is definitely suitable
> here.
>
> > I'm looking for help/suggestions how to architect a module (perhaps
> > just a class).
>
> Right, I don't see anything in your request that indicates why a new
> module would be needed.
>
Only that eventually I might want to distribute this and include some other
features.
>
> > There is an existing module I want to use which has a class we'll call
> > *Existing Class*.
> >
> > I want to create a python module which allows me to create
> > *new_objects*
>
> This is all rather abstract. Can you explain what the existing class is
> for? What the new class is for?
>
> Well I was trying to keep it as generic as possible and only introduce the
necessary features. It's possible I've left out something important though.
> > with the following properties:
> >
> > - The new_objects have all the attributes of the Existing_Class
> (simply
> > create a class that inherits from Existing_Class)
>
> The syntax for that is::
>
> class Bar(Foo):
> ...
>
> where "Foo" is the existing class, "Bar" is the class you're defining.
>
> It's not strictly true to say that Bar will thereby "have all the
> attributes of" the existing class. Rather, the resolution chain will
> mean that accessing attributes on Bar will fall-back to looking at Foo
> for attributes not found in Bar.
>
> Point taken.
> > - I then want to create a nested structure under the new_objects
> > something like:
> >
> > new_object.foo
> > new_object.foo.bar
> > new_object.foo.bar.baz
>
> Again, it's not clear why you're doing this. What are these attributes for?
>
I tried to explain the necessary properties in the requirements below.
Really the main function of creating this new module is to add the
docstring & tab completion capabilities. Essentially it's a way to create
an explorable structure of elements with documentation. If you have other
suggestions how to achieve that I'd be interested.
.
>
> > Where foo, bar, baz have the following properties:
> >
> > - All have *docstrings*
>
> Docstrings are only for code objects: modules, classes, functions. Will
> each of those attributes be one of those?
>
> Only because I'd like them to have docstring attributes.
> > - All are available for *tab completion* tools upon new_object
> creation.
>
> Tab completion is up to the interactive tool you're using. Which tool is
> that?
>
>
For me ipython but I'd like it to work in other tools so the more general
the better.
> > -
> > Some of which will have *new methods* which act in the following way:
> > - new_object.foo.bar()
> >
> > calls
> > - new_object.existing_method("foo.bar", *args)
>
> This would be an unusual semantic. Why not call the existing method?
>
> Basically right now the user has to look up external documentation to
figure out which arguments (foo, bar etc) are necessary and there are many
of them in a nested structure. I'd like to create a module that they can
explore within an enhanced python editor/interpreter.
> > Any pointers would be greatly appreciated.
>
> I am smelling the likelihood that you have a strange design that needs
> to be examined and changed. Can you describe what your purpose is that
> you think needs this strange architecture?
>
>
Hopefully my comments help some.
I'm definitely not opposed to changing the architecture but the main
objectives of documentation & explorability (yes I know that's not a real
word) are top priority.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Help creating new module which inherits existing class from another module. Jonno <jonnojohnson@gmail.com> - 2014-02-18 22:16 -0600
csiph-web