* 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
"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
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
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?
"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
> 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
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
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
* 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
>
> 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?
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
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
"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
* 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
* 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
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
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
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],
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
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
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
* 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
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
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
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
"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
"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
27 matches
Mail list logo