Re: Question about modules documentation

2017-09-15 Thread Tobiah
>> 'next sentence' is the operative piece. I think that if the bit >> about placement was moved to the end of the paragraph the whole >> thing would be more readable and I wouldn't have stumbled on it. > > If it had meant "the imported module's names" or indeed "the imported > modules' names", I

Re: Question about modules documentation

2017-09-15 Thread Rhodri James
On 15/09/17 18:05, Tobiah wrote: On 09/15/2017 09:25 AM, Stefan Ram wrote:> Tobiah writes: Modules can import other modules. It is customary but not required to place all import statements at the beginning of a module (or script, for that matter). The imported mo

Re: Question about modules documentation

2017-09-15 Thread Tobiah
On 09/15/2017 09:25 AM, Stefan Ram wrote:> Tobiah writes: >> Modules can import other modules. It is customary but not >> required to place all import statements at the beginning >> of a module (or script, for that matter). The imported >> module names are placed > .. >> When i

Re: Question about modules documentation

2017-09-15 Thread Tobiah
Re-reading I guess the plural refers to the multiple modules referenced in the first sentence. It was probably written that way before someone inserted the bit about the customary placement, which greatly clouds the connection. On 09/15/2017 09:03 AM, Tobiah wrote: > In this doc: > > ht

Re: Question about modules documentation

2017-09-15 Thread Chris Angelico
On Sat, Sep 16, 2017 at 2:03 AM, Tobiah wrote: > It seems that if the statement read: > > the imported module's name (singular) is placed in the > importing module's global symbol table. > > That it would be more accurate. That implies that you only import one module. Consider: i

Question about modules documentation

2017-09-15 Thread Tobiah
In this doc: https://docs.python.org/2/tutorial/modules.html Near the top it states: Modules can import other modules. It is customary but not required to place all import statements at the beginning of a module (or script, for that matter). The imported m

Embedding: Question about modules

2005-01-20 Thread smilechaser
Hi All, A question about embedding: If I take the example code on embedding (Section 5.3 of Extending and Embedding the Python Interpreter 2.4) and add the lines: PyRun_SimpleString("import sys"); PyRun_SimpleString("print globals()"); Just after the part where the code loads the module, and th

capwords (WAS: [Newby] question about modules)

2004-12-10 Thread Steven Bethard
Jon wrote: As far as I can tell from the online docs, "capwords" should be defined in the built-in "regex" module. Why is it telling me that capwords is not defined? Hmm... are you looking instead for "capwords" from the string module? >>> s = """\ ... Well, he's... ... he's, ah... ... probably pi

Re: [Newby] question about modules

2004-12-10 Thread Steven Bethard
Jon wrote: The following four lines of code: import sys, os, re sentence = raw_input("Enter a sentence: ") capwords (sentence) print sentence gives me the following error: NameError: name 'capwords' is not defined As far as I can tell from the online docs, "capwords" should be defined in the buil

Re: question about modules

2004-12-10 Thread Reinhold Birkenfeld
Jon wrote: > Hi Jeff, > > That makes sense -- thanks. However now when I use "re.capwords (sentence)" > I get a different error message: > > AttributeError: 'module' object has no attribute 'capwords' > > Each of the other two suggested implimentations produce a similar error > message. Is the

Re: question about modules

2004-12-10 Thread Jon
Hi Jeff, That makes sense -- thanks. However now when I use "re.capwords (sentence)" I get a different error message: AttributeError: 'module' object has no attribute 'capwords' Each of the other two suggested implimentations produce a similar error message. Is there something even more basic

Re: [Newby] question about modules

2004-12-10 Thread James Stroud
Is it in "regex" or "re"? If in "re" then: re.capwords(sentence) If in "regex", then: regex.capwords(sentence) You can also do from re import * then you will not have to prefix. But careful not to clutter your namespace. On Friday 10 December 2004 10:29 am, Jon wrote: > Hi, > > The followin

Re: question about modules

2004-12-10 Thread Jeffrey Maitland
Jon writes: Hi, The following four lines of code: import sys, os, re sentence = raw_input("Enter a sentence: ") capwords (sentence) print sentence gives me the following error: NameError: name 'capwords' is not defined As far as I can tell from the online docs, "capwords" should be defi

RE: [Newby] question about modules

2004-12-10 Thread Batista, Facundo
Title: RE: [Newby] question about modules [Jon] #- gives me the following error:  NameError: name 'capwords' is #- not defined #- #- As far as I can tell from the online docs, "capwords" should #- be defined in #- the built-in "regex" module.  Why is it t

[Newby] question about modules

2004-12-10 Thread Jon
Hi, The following four lines of code: import sys, os, re sentence = raw_input("Enter a sentence: ") capwords (sentence) print sentence gives me the following error: NameError: name 'capwords' is not defined As far as I can tell from the online docs, "capwords" should be defined in the built-i