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


Groups > comp.lang.python > #36034

Re: Can't seem to start on this

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-3.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <msirenef@lightbird.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'linear': 0.07; 'python': 0.09; '"a"': 0.09; 'imported': 0.09; 'python:': 0.09; 'gui': 0.11; '"b"': 0.16; '"d",': 0.16; '11:32': 0.16; 'a.py': 0.16; 'b.py': 0.16; 'guessing': 0.16; 'instantiate': 0.16; 'length,': 0.16; 'parameters,': 0.16; 'paste.': 0.16; 'possible?': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:start': 0.16; 'wrote:': 0.17; 'typing': 0.17; 'variables': 0.17; 'creates': 0.18; 'code,': 0.18; 'module': 0.19; 'import': 0.21; 'error.': 0.21; 'help.': 0.22; 'example': 0.23; 'allows': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'separate': 0.27; 'run': 0.28; 'class': 0.29; 'classes': 0.30; 'error': 0.30; 'file': 0.32; 'to:addr:python- list': 0.33; 'likely': 0.33; 'another': 0.33; 'pm,': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'modules': 0.36; 'method': 0.36; 'being': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'object': 0.38; 'skip:l 20': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'most': 0.61; 'places': 0.61; 'provide': 0.62; 'started.': 0.65; 'sounds': 0.71; 'manner': 0.74; 'subject:this': 0.84; 'etc,': 0.84; 'do:': 0.91
Date Wed, 02 Jan 2013 23:46:00 -0500
From Mitya Sirenef <msirenef@lightbird.net>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: Can't seem to start on this
References <kc31l4$27v$1@ger.gmane.org>
In-Reply-To <kc31l4$27v$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.17.1357188364.2939.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357188364 news.xs4all.nl 6977 [2001:888:2000:d::a6]:47305
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36034

Show key headers only | View raw


On 01/02/2013 11:32 PM, Kene Meniru wrote:
> This sounds so simple but being  new to python I am finding it hard to get
 > started. I want to create a module which I will call "B". There will be
 > other modules called "C", "D", etc, which will most likely be 
imported in
 > "B". Then I want the user to import "B" ONLY into another file I will 
call
 > "A" in which commands such as the following will be entered:
 >
 > snap_size = 10
 > LinearMark(name)
 > LinearMark.put(name, length, rotation, (x,y,z))
 >
 > The file "A" allows the user to enter commands that provide global 
variables
 > as well as to use classes provided in modules "C", "D", etc, in the 
manner
 > shown in the sample above. For example snap_size is a global setting.
 > LinearMark(name) creates a linear mark of the provided name.
 > LinearMark.put(...) places the LinearMark object using the provided
 > parameters, etc.
 >
 > How can I make this possible? I am guessing I have to instantiate the
 > classes in file "B" but typing LinearMark(name) in file "A" generates an
 > error. Eventually I will provide a gui but I want to separate usage 
so there
 > is no dependence on the gui to run this application.
 >
 > Please help.
 >
 >


Where is snap_size from? Where is LinearMark from? You don't need to
instantiate LinearMark in B, do it in A.

What error do you get when you instantiate LinearMark in A? Please
paste.

If LinearMark is imported in from C, you can do:

B.py
from C import LinearMark

A.py
from B import LinearMark

lmark = LinearMark(name)
lmark.put(...)

Or do you want to use class method of LinearMark?

Since you don't provide any code, it's really hard to tell what you're
doing....

  HTH, -m



-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

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


Thread

Re: Can't seem to start on this Mitya Sirenef <msirenef@lightbird.net> - 2013-01-02 23:46 -0500

csiph-web