Ben wrote:
Ah... my list is a string. That explains the len() results, but not why
it is a string in the dirst place.
I have a dictionary containing a number of instances of the following
class as values:
class panel:
mops =[]
This one is a class attribute - it's shared between all
Ben wrote:
Using Fredericks advice I managed to track down the problem - it was
really very stupid. I had accidentally cast the list to a string
There's nothing like type casting in Python. You did not cast the
list to a string, you created a string from a list.
--
bruno desthuilliers
python
Ben wrote:
(OT : Ben, please stop top-posting, it's really annoying)0
Ah - I found out why I had cast it to a string.
cf my previous anwser on this point.
I had not, at that
point, worked out ho to pass the list by value rather than reference,
There's nothing like 'pass by value/pass by
Hello...hopefully my last question :-)
I ave a dictionary, where each value is a class instance. I access it
using:
for k, v in self.panels.panel_list.items():
print Number:\t,v.number
print Level:\t,v.level
print Location:\t,v.location
Ben wrote:
The output from this would be (for a given key value):
Number: 181
Level:ovride+supvis
Location: mons=4 v8.0 3rd floor
MOPS: ['287', '288', '289', '290']
List Length: 28
Ah... my list is a string. That explains the len() results, but not why
it is a string in the dirst place.
I have a dictionary containing a number of instances of the following
class as values:
class panel:
mops =[]
def __init__(self,number,level,location,mops,matrix):
...and when I print out the string, it is still formatted as one would
expect a list to be:
type 'str' ['01', '02', '03', '04']
Ben wrote:
Ah... my list is a string. That explains the len() results, but not why
it is a string in the dirst place.
I have a dictionary containing a number of
Ben wrote:
Ah... my list is a string. That explains the len() results, but not why
it is a string in the dirst place.
I have a dictionary containing a number of instances of the following
class as values:
class panel:
mops =[]
def
Ben wrote:
Ah... my list is a string. That explains the len() results, but not why
it is a string in the dirst place.
I have a dictionary containing a number of instances of the following
class as values:
class panel:
mops =[]
def
Thanks for the advice - I'm already doing just that, so hopefully will
soon be sorted :-p
John Machin wrote:
Ben wrote:
Ah... my list is a string. That explains the len() results, but not why
it is a string in the dirst place.
I have a dictionary containing a number of instances of the
Ben wrote:
...and when I print out the string, it is still formatted as one would
expect a list to be:
type 'str' ['01', '02', '03', '04']
We know that. Fredrik deduced it and told you well over an hour ago.
Show us the code that is creating instances of the panel class ...
panel1 =
Using Fredericks advice I managed to track down the problem - it was
really very stupid. I had accidentally cast the list to a string
earlier in another part of the code. Its a bit of an anticlimax really
- not mysterious at all (just mysteriously remiss on my part)
Apologies for not simple
On 8 Oct 2006 06:12:48 -0700, John Machin [EMAIL PROTECTED] wrote:
Show us the code that is creating instances of the panel class ...
panel1 =
panel(number=?,level=?,location=?,mops=,matrix=?)
What are you passing as the 4th positional arg
^^^ ???
This
Theerasak Photha wrote:
On 8 Oct 2006 06:12:48 -0700, John Machin [EMAIL PROTECTED] wrote:
Show us the code that is creating instances of the panel class ...
panel1 =
panel(number=?,level=?,location=?,mops=,matrix=?)
What are you passing as the 4th positional arg
Ah - I found out why I had cast it to a string. I had not, at that
point, worked out ho to pass the list by value rather than reference,
and so was casting to a string as a stopgap measure that I then forgot
about. Now the problem is fixed after this group told me how to pass a
list by value (by
Ben wrote:
Ah - I found out why I had cast it to a string. I had not, at that
point, worked out ho to pass the list by value rather than reference,
and so was casting to a string as a stopgap measure that I then forgot
about. Now the problem is fixed after this group told me how to pass a
Ben wrote:
Ah - I found out why I had cast it to a string. I had not, at that
point, worked out ho to pass the list by value rather than reference,
and so was casting to a string as a stopgap measure that I then forgot
about. Now the problem is fixed after this group told me how to pass a
17 matches
Mail list logo