Re: [Tutor] imported module/global

2007-04-15 Thread Andreas Kostyrka
* Cecilia Alm <[EMAIL PROTECTED]> [070416 07:45]: > OK, apologies if my terminology and wording was unfortunate and unclear. > > (Setting aside for now if this is preferred practice or not) In > regards to modifying a global mutable list/dictionary (for example > appending to a global list), the n

Re: [Tutor] Protected in Python

2007-04-15 Thread Alan Gauld
"Nader Alrawahi" <[EMAIL PROTECTED]> wrote > in Python. We know that methods can be private or public , but is > there a > way we can make them protected in Python, something similar to Java? No, Python does not support protected. However a common conventionis to use a single underscore before

[Tutor] Protected in Python

2007-04-15 Thread Nader Alrawahi
Hello everyone, I have been working on an object-oriented project using Python and I was browsing through the manual looking for some information about data-hiding in Python. We know that methods can be private or public , but is there a way we can make them protected in Python, something similar

Re: [Tutor] imported module/global

2007-04-15 Thread Cecilia Alm
OK, apologies if my terminology and wording was unfortunate and unclear. (Setting aside for now if this is preferred practice or not) In regards to modifying a global mutable list/dictionary (for example appending to a global list), the name does not need defined within the local namespace, right?

Re: [Tutor] imported module/global

2007-04-15 Thread Alan Gauld
"Cecilia Alm" <[EMAIL PROTECTED]> wrote > Hm, I'm confused by your post. Within the global's module, the > "global > z" syntax works for bothh modifying and accessing, and makes the > code > clearer to read in my opinion. You seem to be confused about the role of the global keyword. It is pure

Re: [Tutor] imported module/global

2007-04-15 Thread Cecilia Alm
> difficult to understand, but sometimes it is useful. For example you > might have a shared configuration module, or a module might have > configuration parameters that can be changed. Yes, this is exactly the case I got. (Otherwise, I'd rather avoid "globals" all together.) Thanks for your resp

Re: [Tutor] imported module/global

2007-04-15 Thread Cecilia Alm
Well, your example still seems to be about accessing or modifying a global variable *within* its own module. Then it can't hurt to prepend 'global' even when just accessing, right? (even if not *necessary*, one could argue make the code clearer). But, my question related specifically to another ca

Re: [Tutor] imported module/global

2007-04-15 Thread Kent Johnson
Cecilia Alm wrote: >> attributes of the module object. When you import the module in another >> module, you gain access to the imported module's attributes using the >> normal dot notation for attribute access. > > By " attribute access", you also mean modifying/assigning to, right? Yes, you can

Re: [Tutor] imported module/global

2007-04-15 Thread Andreas Kostyrka
* Cecilia Alm <[EMAIL PROTECTED]> [070415 23:19]: > 2007/4/15, Andreas Kostyrka <[EMAIL PROTECTED]>: > >* Cecilia Alm <[EMAIL PROTECTED]> [070415 18:21]: > >> If a module "x" imports module "y" with a global variable "z", then > >> this global can be referred or assigned to in "x" with the syntax >

Re: [Tutor] imported module/global

2007-04-15 Thread Cecilia Alm
> attributes of the module object. When you import the module in another > module, you gain access to the imported module's attributes using the > normal dot notation for attribute access. By " attribute access", you also mean modifying/assigning to, right?

Re: [Tutor] imported module/global

2007-04-15 Thread Cecilia Alm
2007/4/15, Andreas Kostyrka <[EMAIL PROTECTED]>: > * Cecilia Alm <[EMAIL PROTECTED]> [070415 18:21]: > > If a module "x" imports module "y" with a global variable "z", then > > this global can be referred or assigned to in "x" with the syntax > > "y.z" (no "global" keyword preceding) and changes ar

Re: [Tutor] beautifulSoup and .next iteration

2007-04-15 Thread Jon Crump
Daniel, It was kind of you to respond, and your response was a model of clarity. You correctly surmised from my awkward framing of the question, that what I wanted was a list of sibling elements between one named anchor and the next. My problem was, in part, that I still don't think in terms of

Re: [Tutor] DOTNETNUKE 4.5

2007-04-15 Thread Alan Gauld
"Gene Astley" <[EMAIL PROTECTED]> wrote > I am an administrator in charge of creating and maintaining > our web site. I use Dreamweaver/Front Page composition tools. Fairly conventional, good tools. > I am being urged to convert to DOTNETNUKE 4.5. By whom and why? Is there a rational reason

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Andreas Kostyrka
* Kent Johnson <[EMAIL PROTECTED]> [070415 20:30]: > Washakie wrote: > > Thanks so much! Now another task, associated with this one... what I > > actually ultimately want is to just pull out several fields from the > > text file in the zip archive (there is actually only one file).. so, my > > g

Re: [Tutor] imported module/global

2007-04-15 Thread Andreas Kostyrka
* Cecilia Alm <[EMAIL PROTECTED]> [070415 18:21]: > If a module "x" imports module "y" with a global variable "z", then > this global can be referred or assigned to in "x" with the syntax > "y.z" (no "global" keyword preceding) and changes are accessible to > class methods in "y" referring to "glob

Re: [Tutor] imported module/global

2007-04-15 Thread Kent Johnson
Cecilia Alm wrote: > If a module "x" imports module "y" with a global variable "z", then > this global can be referred or assigned to in "x" with the syntax > "y.z" (no "global" keyword preceding) and changes are accessible to > class methods in "y" referring to "global z". Yes. > I assume this i

Re: [Tutor] DOTNETNUKE 4.5

2007-04-15 Thread Gene Astley
I am an administrator in charge of creating and maintaining our web site. I use Dreamweaver/Front Page composition tools. I am being urged to convert to DOTNETNUKE 4.5. This is a open source Framework for Creating Enterprise Web Applications. They say it is built on Microsoft ASP.net (VB,Net) pl

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Kent Johnson
Washakie wrote: > Thanks so much! Now another task, associated with this one... what I > actually ultimately want is to just pull out several fields from the > text file in the zip archive (there is actually only one file).. so, my > goal is the to create a file that looks like: > > t[0], x[0],

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Washakie
Thanks so much! Now another task, associated with this one... what I actually ultimately want is to just pull out several fields from the text file in the zip archive (there is actually only one file).. so, my goal is the to create a file that looks like: t[0], x[0], y[0] t[1], x[1], y[1] t[2], x

[Tutor] imported module/global

2007-04-15 Thread Cecilia Alm
If a module "x" imports module "y" with a global variable "z", then this global can be referred or assigned to in "x" with the syntax "y.z" (no "global" keyword preceding) and changes are accessible to class methods in "y" referring to "global z". I assume this is related to namespace/scope? Than

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Kent Johnson
John W wrote: > Kent and Alan: better? > .j > > import zipfile > import os > import pylab as P > iFile = raw_input("Which file to process?") > > def openarchive(filename): > """ open the cmet archive and read contents of file into memory """ > z = zipfile.ZipFile(filename, "r") > for

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Andreas Kostyrka
* Washakie Wyoming <[EMAIL PROTECTED]> [070415 14:25]: > Thank you both! That seems to make my code much more clear... I thought > it was foolish writing files, but I just couldn't determine how to > parse the data! > > Kent, one thing, regarding: > x = [] > t = [] > for l

[Tutor] read text file in zip archive, process, plot

2007-04-15 Thread John W
Kent and Alan: better? .j import zipfile import os import pylab as P iFile = raw_input("Which file to process?") def openarchive(filename): """ open the cmet archive and read contents of file into memory """ z = zipfile.ZipFile(filename, "r") for filename in z.namelist(): print f

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Washakie Wyoming
Thank you both! That seems to make my code much more clear... I thought it was foolish writing files, but I just couldn't determine how to parse the data! Kent, one thing, regarding: x = [] t = [] for l in data[stind:-1]: l = l.split() # Split on whitespace

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Kent Johnson
Washakie Wyoming wrote: > Greetings all! > > I'm including here a first python program! Very nice. It's written to > read in a text file which resides in a .zip archive, extract two fields > and plot them. It uses some bits from pylab for the plotting. > > I'm writing to ask for ways to improve i

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Alan Gauld
"Washakie Wyoming" <[EMAIL PROTECTED]> wrote > I'm writing to ask for ways to improve it. I feel like the > writing and reading from 'jnk' files is definitely a hack! Yup! I'm not sure why you do it, at least the first time. You read the file into memory, why not just process it there? You can s

Re: [Tutor] Seeking python projects

2007-04-15 Thread Alan Gauld
"Asrar Kadri" <[EMAIL PROTECTED]> wrote > I want to practice Python programming by developing > complete applications. The best way is to think of an application you want tro use yourself and build it. But if you can't think of one you can try searching SourceForge for projects using Python