Max Noel said unto the world upon 2005-01-02 19:43:
On Jan 2, 2005, at 23:00, Danny Yoo wrote:
(Aside: one nonobvious example where copying can be avoided is in
Conway's
Game of Life: when we calculate what cells live and die in the next
generation, we can actually use the 'Command' design patter
Hi,
I have a couple of questions about a program I've been working on. Here's a
overview of what the program does.
Calculates the following data about HVAC/Plumbing pipe:
A). Total volume of water inside the pipe (US gallons).
B). The weight of the water inside the pipe.
C). The actua
> I want to explore some mailman config files, e.g.
> config.pck. Some quick searches informed me that these
> contain pickled configuration info.
>
> My first naive attempt to dump what was in them failed:
>
> >>> import pickle
> >>> pickle.load(open("config.pck"))
> traceback
> ImportError
I want to explore some mailman config files, e.g.
config.pck. Some quick searches informed me that these
contain pickled configuration info.
My first naive attempt to dump what was in them failed:
>>> import pickle
>>> pickle.load(open("config.pck"))
traceback
ImportError: No module named Ma
Bernard Lebel wrote:
Okay here comes the next question.
In that class, I have 3 functions. Actually, one of them calls the two
others.
However when I call these functions (wich are placed before the caller
in the file), I get an error saying that the global name x (the function
name) is not def
Okay here comes the next question.
In that class, I have 3 functions. Actually, one of them calls the two
others.
However when I call these functions (wich are placed before the caller
in the file), I get an error saying that the global name x (the function
name) is not defined.
What am I doin
This is my second script (if you don't include the last time I
programmed (20 years ago...)
it's a nasty hack but it works...
---
-
- http://www.filemaker.com/fmpdsoresult";>
0
Workflow01.fp7
-
yourSoLuckyJob
> I needed to copy this matrix to 'self.old_data', so I have been
using
> .deepcopy(), which works OK but is SLOW (12+ secs)
Are you sure you need to copy it./ A simple reassignment should work
and then reconstruct the structure using fresh lists/dictionary etc.
That should work faster.
Alan
> You might want to try:
>
> x in list
Blush, I forgot about 'in'. And being in C it should be faster
than the sort/loop combination. Silly me... :-(
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
> I have a list consisting of about 250 items, I need to know if a
> particular item is in the list. I know this is better suited to a
> dictionary but thats not the way it ended up ;-)
>
> I could do a for loop to scan the list & compare each one, but I
have a
> suspission that there is a better
On Jan 2, 2005, at 23:00, Danny Yoo wrote:
(Aside: one nonobvious example where copying can be avoided is in
Conway's
Game of Life: when we calculate what cells live and die in the next
generation, we can actually use the 'Command' design pattern to avoid
making a temporary copy of the world. We
Hi folks...
I was thinking about this the other day while prepping to write up
another CGI thing.
It occurred to me to wonder how other folks prepare an app, script,
whatever.
So the question is, and I am not looking for a "right answer" here. (I
doubt ther eis one, to be honest.)
How do you
All righty, thanks a lot!
Bernard
tanja pislar wrote:
hi Bernard,
you have to specify the module as well:
let's say your module is called rtModule.py,
then in your case you'd do:
import rtModule
testClass = rtModule.rt()
testClass.walk()
or:
from rtModule import rt
testClass = rt()
testClass.walk()
hi Bernard,
you have to specify the module as well:
let's say your module is called rtModule.py,
then in your case you'd do:
import rtModule
testClass = rtModule.rt()
testClass.walk()
or:
from rtModule import rt
testClass = rt()
testClass.walk()
regards,
tanja
On Sun, 02 Jan 2005 17:43:07
Hello,
An easy one to start the year.
Trying to write my first class, already running into problems after 3
lines! :-(
So have this little class:
class rt:
def walk(self):
print 'yeah'
So if I write this in the Python shell, instantiate rt and call walk(),
I get the prope
On Sun, 2 Jan 2005, Dave S wrote:
> My matrix 'self.data' consists of a list of 110 items, each item is a
> dictionary of 250 keys, each key holds two lists, one of four items, one
> of 12 items.
Hi Dave,
Hmmm... what kind of data is being copied here? Python's data structures
are desigined f
Hi there again,
My matrix 'self.data' consists of a list of 110 items, each item is a
dictionary of 250 keys, each key holds two lists, one of four items, one
of 12 items.
I needed to copy this matrix to 'self.old_data', so I have been using
.deepcopy(), which works OK but is SLOW (12+ sec
Patrick Hall wrote:
Hi Dave,
I have a list consisting of about 250 items, I need to know if a
particular item is in the list. I know this is better suited to a
dictionary but thats not the way it ended up ;-)
I could do a for loop to scan the list & compare each one, but I have a
suspis
Hi Dave,
> I have a list consisting of about 250 items, I need to know if a
> particular item is in the list. I know this is better suited to a
> dictionary but thats not the way it ended up ;-)
> I could do a for loop to scan the list & compare each one, but I have a
> suspission that there is
You might want to try:
x in list
this will return true if, for example, list = [x,y,z,w], false if list
= [y,y,y,y]
Bill
Dave S wrote:
OK simple query,
I have a list consisting of about 250 items, I need to know if a
particular item is in the list. I know this is better suited to a
dictionary
OK simple query,
I have a list consisting of about 250 items, I need to know if a
particular item is in the list. I know this is better suited to a
dictionary but thats not the way it ended up ;-)
I could do a for loop to scan the list & compare each one, but I have a
suspission that there is
Alan Gauld wrote:
Also, anything I can do... Presently, since I'm running windows xp,
I would
have to hunt for the command prompt and type in the command
Start->Run
Type cmd,
Hit OK
:-)
Or drag the icon from accessories into the start menu or to
the desktop.
Or drag the icon to the left side of th
Jacob S. wrote:
Even so, doctest doesn't seem to recognize the module level docstring.
It will run the test inside the functions, but it says there isn't a test on
the module level.
I put the docstring just like in the example at the link you provided...
Please post the code for the module you are
> Also, anything I can do... Presently, since I'm running windows xp,
I would
> have to hunt for the command prompt and type in the command
Start->Run
Type cmd,
Hit OK
:-)
Or drag the icon from accessories into the start menu or to
the desktop.
> '"C:\python24\python.exe" "C:\documents and
sett
> > >>> for x in ['string', 10, True, [1,2,3] ]:
> > ... print '%s' %x
> > ...
> > string
> > 10
> > True
> > [1, 2, 3]
>
> That's cool! I didn't know that. I guess I'm crazy... : )
> (We already knew that here.)
The difference is in how the formatting details work.
For numbers the format
25 matches
Mail list logo