Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Killing is stupid; useless! -- McCoy, "A Private Little War", stardate 4211.8


devel / comp.lang.python / Re: Silly (maybe) question re imported module(s)

SubjectAuthor
o Re: Silly (maybe) question re imported module(s)Alan Gauld

1
Re: Silly (maybe) question re imported module(s)

<mailman.115.1684516719.13552.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27717&group=comp.lang.python#27717

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: learn2program@gmail.com (Alan Gauld)
Newsgroups: comp.lang.python
Subject: Re: Silly (maybe) question re imported module(s)
Date: Fri, 19 May 2023 18:18:35 +0100
Lines: 46
Message-ID: <mailman.115.1684516719.13552.python-list@python.org>
References: <64671ABC.387.1AA74D@RealGrizzlyAdams.vivaldi.net>
<13f3d040-2bc0-ae68-1263-0ac3b6b29c31@yahoo.co.uk>
<64676D37.5321.7D27AC@RealGrizzlyAdams.vivaldi.net>
<80964874-2c69-9969-1699-35b57e75ab7b@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de Rrn2IipF4qVk2h7Gzdvjkwt0nnWzqIxsahuNbk4qjMqw==
Return-Path: <learn2program@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=f9t2ahaE;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'traceback':
0.04; '(most': 0.05; 'last):': 0.05; 'skip:= 10': 0.05;
'subject:module': 0.07; '27,': 0.09; 'import': 0.15; '125,': 0.16;
'64,': 0.16; '>>>>': 0.16; 'consol': 0.16; 'flickr': 0.16;
'from:name:alan gauld': 0.16; 'photo-blog': 0.16; 'url-
ip:79.170.44.132/32': 0.16; 'url-ip:79.170.44/24': 0.16; 'url-
ip:79.170/16': 0.16; 'url-ip:79/8': 0.16; 'url:alan-g': 0.16;
'url:alan_gauld': 0.16; 'url:alangauldphotos': 0.16; 'wrote:':
0.16; 'subject:question': 0.17; 'message-id:@gmail.com': 0.18;
'url:amazon': 0.19; 'to:addr:python-list': 0.20; 'run': 0.23;
"i'd": 0.24; 'to:name:python-list@python.org': 0.24; 'tried':
0.26; 'function': 0.27; 'expect': 0.28; 'header:User-Agent:1':
0.30; 'program': 0.31; '"",': 0.32; 'received:192.168.1': 0.32;
'but': 0.32; "i'm": 0.33; 'there': 0.33; 'header:In-Reply-To:1':
0.34; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'using': 0.37; 'received:209.85': 0.37; 'author': 0.37;
'received:192.168': 0.37; 'file': 0.38; 'received:209': 0.39;
'use': 0.39; 'alan': 0.40; 'learn': 0.40; 'should': 0.40;
'follow': 0.62; 'subject:(': 0.64; 'well': 0.65; 'url:author':
0.69; 'site': 0.70; 'yes': 0.76; 'skip:d 30': 0.86; 'adams': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1684516717; x=1687108717;
h=content-transfer-encoding:in-reply-to:from:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=/jqn3J5azqhmfdE9bwJ1lcZaosLAhBYOyuj6ywiH3P8=;
b=f9t2ahaEdVKlJnBLtX8urfm2rQf9J1Gm4blndjmtynz90sJh74Mv/pjT6qSL6lNCGu
QXcMhS/zg748RAkvNl0RpIdMP2JnHzylZ1KdRYBUZGcuM2dAIWyaj+FhmLT5zKkH0LEy
uM6639B/LdaevJqwElZ3wk/fRVyVMVLaba3KTV0T4Uq52+Y/ycNABcmf846zphkUoNyD
KPg49emOzpxj7YATodLBMDit2trB5N/QE6spFiwPmqJLE5i/EK5aunD5uUHkl5hlTGbp
UY1mBbwsDK0PPLGcF7IBm6eoOy5SBeCeN2dqdtNID8zyZC28fRrtrUsBoDEqdC+Z4/Fa
Y8Fw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1684516717; x=1687108717;
h=content-transfer-encoding:in-reply-to:from:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=/jqn3J5azqhmfdE9bwJ1lcZaosLAhBYOyuj6ywiH3P8=;
b=WeDIL2Q6u4QIdSapDDscaBIYg1wYCDQZdaKQcoB8PFVXo3dXbZ5SoLvLNNAj1+4iAa
fFdF2UInwQ38w0uCOM8VIeO0nnIhwNGyYsR9hxj9Pq9affxTK3B2fbPuENCtDM0GJWpI
/dJFGywfFoRdD2/3IzJ63cOfhJFrtTZNWTdu7qssKmTL++yGdG0Jm5CYNWCHHxfv7ZB8
k8cKzSVzQcj0qgEYWUgWB+EVAb3CrcToqlBqF3c46muw1I3WTwB4VdBxe09bWWPDP4/9
XyhEADu/T7d645SlF35y/5bD6jmhYaoDfebq/D8YjM9iF+IfQavyRIR5rrOWavQDlDo7
uOLQ==
X-Gm-Message-State: AC+VfDzBVUpaJ+MxFEjjXPxPa2SFr9oFBPg0ddtM3SBXGxD8/xhQFQiV
6cf/SdlUZgYu+K9GKYepxyU=
X-Google-Smtp-Source: ACHHUZ7adKFjuZpNHpKK2DNEY7dCd5Ok8oJAlJalQ0YUqsCSa9ZlL4RiUTE9T/Q61w7ceUVHXhAcHg==
X-Received: by 2002:a5d:4b89:0:b0:306:3711:11d7 with SMTP id
b9-20020a5d4b89000000b00306371111d7mr2069428wrt.48.1684516716801;
Fri, 19 May 2023 10:18:36 -0700 (PDT)
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-GB
In-Reply-To: <64676D37.5321.7D27AC@RealGrizzlyAdams.vivaldi.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <80964874-2c69-9969-1699-35b57e75ab7b@gmail.com>
X-Mailman-Original-References: <64671ABC.387.1AA74D@RealGrizzlyAdams.vivaldi.net>
<13f3d040-2bc0-ae68-1263-0ac3b6b29c31@yahoo.co.uk>
<64676D37.5321.7D27AC@RealGrizzlyAdams.vivaldi.net>
 by: Alan Gauld - Fri, 19 May 2023 17:18 UTC

On 19/05/2023 13:36, Grizzy Adams wrote:

>> Looks like you are using IDLE?
>
> Yes
>
>
> From consol
>
>>>> import cube
>>>> cubes
> Traceback (most recent call last):
> File "<pyshell#1>", line 1, in <module>
> cubes
> NameError: name 'cubes' is not defined

You imported cube but tried to use cubes. I'm guessing
cubes is defined inside cube so you would need

cube.cubes

> File->Open mymodule.module into the editor, then F5 to run all is well
>
>>>>
> ================ RESTART: D:\Shades\Tools\Python\Temp\cube.py ================
>>>> cubes
> [0, 1, 8, 27, 64, 125, 216, 343, 512, 729]

cubes looks like it should be a function but in that case there
should be parens after it. So I'm not sure how that is working!

I'd expect that you need to do:

import cube
cube.cubes()

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


devel / comp.lang.python / Re: Silly (maybe) question re imported module(s)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor