Just as feedback, I went back to the __init__ style routine, weeded
out a few things, installed python 2.6.1, and it works great. Thanks
for all your help. Now I've got to convince 1000 people at my company
to switch. That's going to be the tough part.
--
http://mail.python.org/mailman/listinfo
On Mon, 30 Mar 2009 18:57:01 +0100, wrote:
Thanks Scott. I think you are saying don't try to subclass from type
long, because it is immutable (cannot be changed). If I subclass from
type object, then the value can be changed, but I still can't print
without explicitely casting back to long in
Sorry, I meant I took out the stuff *before* the definition of class
myclass, and also those things that referred to it. I didn't want to
import ctypes, because it couldn't have any effect on the problem at hand.
Since then I see that you've succeeded with the __int__() method call,
and your
On Mar 30, 12:05 pm, mark.sea...@gmail.com wrote:
> On Mar 30, 12:01 pm, mark.sea...@gmail.com wrote:
>
>
>
>
>
> > On Mar 30, 11:53 am, Dave Angel wrote:
>
> > > After taking out the class myclass stuff, the code worked for me in
> > > Python 2.6.1, through the cat line. Could you please tell u
On Mar 30, 12:01 pm, mark.sea...@gmail.com wrote:
> On Mar 30, 11:53 am, Dave Angel wrote:
>
> > After taking out the class myclass stuff, the code worked for me in
> > Python 2.6.1, through the cat line. Could you please tell us what
> > version of Python you're running this on?
>
> > import sy
On Mar 30, 11:53 am, Dave Angel wrote:
> After taking out the class myclass stuff, the code worked for me in
> Python 2.6.1, through the cat line. Could you please tell us what
> version of Python you're running this on?
>
> import sys
> print "Python version: ", sys.version
>
> yielded (on my m
After taking out the class myclass stuff, the code worked for me in
Python 2.6.1, through the cat line. Could you please tell us what
version of Python you're running this on?
import sys
print "Python version: ", sys.version
yielded (on my machine)
Python version: 2.6.1 (r261:67517, Dec 4
If I cast it long then it prints fine, but I was hoping there would be
a slicker way (to accomplish this in the class itself).
print 'bird val = 0x%016X' % long(bird)
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 30, 10:53 am, David Bolen wrote:
> mark.sea...@gmail.com writes:
> > class myclass(object):
> > #
> > # def __new__(class_, init_val, size, reg_info):
> > def __init__(self, init_val, size, reg_info):
>
> > # self = object.__new__(class_)
> > self.reg_info = reg_info
On Mar 30, 9:40 am, Scott David Daniels wrote:
> mark.sea...@gmail.com wrote:
> > ...
> > It seems like there's no way to do what I'm trying. I am confined to
> > Python 2.5.3 for business reasons.
>
> > So I want a class ShadowRegister, which just has a value that I can do
> > get/set bit sel an
mark.sea...@gmail.com writes:
> class myclass(object):
> #
> # def __new__(class_, init_val, size, reg_info):
> def __init__(self, init_val, size, reg_info):
>
> # self = object.__new__(class_)
> self.reg_info = reg_info
> print self.reg_info.message
> self.
mark.sea...@gmail.com wrote:
...
It seems like there's no way to do what I'm trying. I am confined to
Python 2.5.3 for business reasons.
So I want a class ShadowRegister, which just has a value that I can do
get/set bit sel and slice ops. I got that working with __init__. It
was subclass from
mark.sea...@gmail.com wrote:
Here again is example:
from ctypes import *
class REG_INFO(Structure):
_fields_ = [
('address', c_ubyte),
('message', c_char * 256),
('size', c_ubyte)
]
class myclass(object):
#
# def __new__(class_, init_val, size, reg_info
Here again is example:
from ctypes import *
class REG_INFO(Structure):
_fields_ = [
('address', c_ubyte),
('message', c_char * 256),
('size', c_ubyte)
]
class myclass(object):
#
# def __new__(class_, init_val, size, reg_info):
def __init__(self, init_
It needs to read HW reg and adjust ChipRegister value, or
ShadowRegister and change the HW value (order was reversed). I will
look at MyHDL again though to see if there is some reason it can print
class subclassed from intbv, or if it even has a class subclassed from
intbv, without casting as a l
On Mar 30, 2:30 am, Jan Decaluwe wrote:
> mark.sea...@gmail.com wrote:
> > Python 2.5.3 for business reasons.
>
> > So I want a class ShadowRegister, which just has a value that I can do
> > get/set bit sel and slice ops. I got that working with __init__. It
> > was subclass from "object". Then
mark.sea...@gmail.com wrote:
Python 2.5.3 for business reasons.
So I want a class ShadowRegister, which just has a value that I can do
get/set bit sel and slice ops. I got that working with __init__. It
was subclass from "object". Then I wanted a RegisterClass that was a
subclass of ShadowRe
mark.sea...@gmail.com writes:
> So I want a class ShadowRegister, which just has a value that I can
> do get/set bit sel and slice ops. I got that working with __init__.
> It was subclass from "object". Then I wanted a RegisterClass that
> was a subclass of ShadowRegister, which would read a har
On Mar 29, 11:16 pm, Chris Rebert wrote:
> 2009/3/29 Scott David Daniels :
>
> > mark.sea...@gmail.com wrote:
>
> >> On Mar 29, 9:52 pm, Chris Rebert wrote:
>
> >>> On Sun, Mar 29, 2009 at 9:18 PM, wrote:
>
> ...
>
> >>> ... Also, you shouldn't use `class_ ` as the name of the first argume
2009/3/29 Scott David Daniels :
> mark.sea...@gmail.com wrote:
>>
>> On Mar 29, 9:52 pm, Chris Rebert wrote:
>>>
>>> On Sun, Mar 29, 2009 at 9:18 PM, wrote:
...
>>>
>>> ... Also, you shouldn't use `class_ ` as the name of the first argument
>>> to
>>> __new__(). Use `cls` instead since
mark.sea...@gmail.com wrote:
On Mar 29, 9:52 pm, Chris Rebert wrote:
On Sun, Mar 29, 2009 at 9:18 PM, wrote:
...
... Also, you shouldn't use `class_ ` as the name of the first argument to
__new__(). Use `cls` instead since that's the conventional name for
it.
Actually, according to PEP 8,
On Mar 29, 9:52 pm, Chris Rebert wrote:
> On Sun, Mar 29, 2009 at 9:18 PM, wrote:
> > Hi. So now I have this class that works to allow me to pass in my
> > reg_info struct. However when I try to make it part of my class it
> > gets an error "global name 'self
On Sun, Mar 29, 2009 at 9:18 PM, wrote:
> Hi. So now I have this class that works to allow me to pass in my
> reg_info struct. However when I try to make it part of my class it
> gets an error "global name 'self' is not defined. I've never seen
> this error be
Hi. So now I have this class that works to allow me to pass in my
reg_info struct. However when I try to make it part of my class it
gets an error "global name 'self' is not defined. I've never seen
this error before. If I comment out the line below 'self.reg_info
Evan wrote:
> A few questions: Why does python use the double underscore (__main__ or
> if __name__)? I've only been using python for about 3 weeks, and I see
> this syntax a lot, but haven't found an explanation for it so far?
to quote the language reference, "System-defined names. These names
Hi Dennis, to answer your questions:
1) So far as I can see ipython generates .pyc files.
2) This morning I ran the scripts, and got the same problem using
ipython as in my earlier post. I then deleted the .pyc file, ran the
calling script and this time it works. I then replaced the .pyc file I
nt estoc
/home/evan/python/mapping/canaryPlaces_test.py in estocStn()
5 return estoc
6
7 def addme(a,b):
8sumAb=a+b
9return sumAb
NameError: global name 'self' is not defined
WARNING: Failure executing file:
In [98]:
On my system this err
Evan wrote:
> So I have deleted the 'old' script2 and renamed the new one, and
> no problem.
Pity. Next time try using diff (or something similar).
Regards,
Björn
--
BOFH excuse #115:
your keyboard's space bar is generating spurious keycodes.
--
http://mail.python.org/mailman/listinfo/pyt
gt;>> import noself
| >>> noself.foo()
Traceback (most recent call last):
File "", line 1, in
File "noself.py", line 2, in foo <<<=== location of error-causing
line
return self <<<=== contents of error-causing line
NameError: global name
In answer to the 2 replies, I had no references anywhere to 'self'. In
order to post my code I rewrote 2 scripts containing just the relevant
parts of the problem; these work. However, they are identical to my
original code. So I have deleted the 'old' script2 and renamed the new
one, and no pro
gt;sumAb=a+b
>return sumAb
>
> def estocStn():
>estoc={'lat':29.15,'lon':-15.667,'place':'ESTOC'}
> return estoc
>
> Why is it that the first call works fine, but the second tells me
> 'global name
On 2 Dec 2006 10:42:28 -0800, Evan <[EMAIL PROTECTED]> wrote:
> Why is it that the first call works fine, but the second tells me
> 'global name 'self' is not defined'? What I want is to have the
> dictionary 'estoc' available in my calling script
x27;:29.15,'lon':-15.667,'place':'ESTOC'}
return estoc
Why is it that the first call works fine, but the second tells me
'global name 'self' is not defined'? What I want is to have the
dictionary 'estoc' available in my calling scr
33 matches
Mail list logo