Thanks Peter and 7stud. That is the solution that really works for
me.
--
http://mail.python.org/mailman/listinfo/python-list
not quite as elegant but here is a workaround... Thanks Virgil for
taking some time to think about it.
---
class Bugger (object):
def __init__ (self, module):
print "Entering __init__"
self.module = module
self.verb = 0
def instrument (module_name):
def wrapper(f)
I just need to keep the state around. I make a call to some function
that is pretty expensive so I want to save it as a member during the
__init__ of the decorator.
Yeah I'm afraid it can't be done either, that's why I asked the group.
--
http://mail.python.org/mailman/listinfo/python-list
are you sure your variable isn't in some code block that wouldn't be
read on import? Such as:
if __name__ == "__main___":
actions = 1
--
http://mail.python.org/mailman/listinfo/python-list
Oh I should mention the decorator needs to have some notion of state
(such as with the above class)
--
http://mail.python.org/mailman/listinfo/python-list
Okay does anyone know how to decorate class member functions?
The following code gives me an error:
Traceback (most recent call last):
File "decorators2.py", line 33, in
s.update()
File "decorators2.py", line 13, in __call__
retval = self.fn.__call__(*args,**kws)
TypeError: update()
On Feb 12, 4:11 pm, "Thomas Nelson" <[EMAIL PROTECTED]> wrote:
> On Feb 12, 1:35 pm, andrew clarke <[EMAIL PROTECTED]> wrote:
>
> > Thomas, I sent you a message off-list but it bounced due to your mailbox
> > being full.
>
> > Short answer: Subscribe to the [EMAIL PROTECTED] mailing list and
> > as
try str(p).split()[2]
your class is using the __str__ attribute to print and I am guessing
that is what you are seeing.
Tempo wrote:
> Hey. I am trying to grab the prices from the string below but I get a
> few errors when I try to do it: Take a look at the code and error
> messages below for me
sweet. I'll definitely be trying to use this.
[EMAIL PROTECTED] wrote:
> Just a post to announce some python bindings for picasaweb (photo's
> service of google).
> ---> PycasaWeb (GPL), http://manatlan.infogami.com/pycasaweb
> I think it may be usefull for linux users, because it's one of the o
Take your code, pretend it is in file:
$
NAME='ALFA'
CODE='x'
$
a python functions could be:
def change(filename):
fp = open(filename, 'r')
lines = fp.readlines()
fp.close()
for i in range(len(lines)):
if lines[i].find('NA
Georg Brandl wrote:
> Andy Terrel wrote:
> > Why bang your head?
>
> Because there's no chance that the original request is sane.
>
> If you want your objects to know their name, give them a name as an attribute.
>
This is true but sometimes it is just
can
think of plenty of reasons it would fail, but it really depends on the
app.
Fredrik Lundh wrote:
> Andy Terrel wrote:
>
> > for i in dir():
> > if eval(i) == Banana:
> > print i
>
> (sound of head hitting desk)
>
>
--
http://mail.python.org/mailman/listinfo/python-list
jojoba wrote:
> Hello!
>
> Does anyone know how to find the name of a python data type.
>
> Conside a dictionary:
>
> Banana = {}
>
> Then, how do i ask python for a string representing the name of the
> above dictionary (i.e. 'Banana')?
>
> thanks to anyone who has time to answer this nube questi
If you did want a linux version you could just make people send a
KeyboardInterupt.
try:
print "Press ^C to stop"
loop
except KeyboardInterrupt:
some stop action or just pass
--
http://mail.python.org/mailman/listinfo/python-list
14 matches
Mail list logo