Decorator Pattern with Iterator

2012-06-11 Thread Tom Harris
Greetings, I have a class that implements the iterator protocol, and tokenises a string into a series of tokens. As well as the token, it keeps track of some information such as line number, source file, etc. for tokens in Tokeniser(): do_stuff(token) What I want is to be able to wrap the

Eval cannot see globals from another module

2010-08-16 Thread Tom Harris
Greetings, I want a debugging function with the effect of the function below (in a seperate module): def dump(expr): print expr, '=', eval(expr) foo = 33 dump('foo') Of course this fails when called from another module because eval does not know the globals or locals of the caller. Is

Docstrings for class attributes

2008-09-22 Thread Tom Harris
implementation of PEP 224. The only solution that I can see is to subclass int.__new__(), since once I have an int all it's attributes are immutable. -- Tom Harris celephicus(AT)gmail(DOT)com -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric literal syntax

2008-09-08 Thread Tom Harris
. -- Tom Harris celephicus(AT)gmail(DOT)com -- http://mail.python.org/mailman/listinfo/python-list

Buffer objects

2008-09-01 Thread Tom Harris
Greetings, I need a little help with buffer objects. Many Python objects export the buffer interface, or can be persuaded to create a buffer object with a buffer() call. First question, the buffer() function appears very quick. Does it just wrap the internal pointer and then exit? Second

Passing arguments to subclasses of unittest.TestCase

2007-11-27 Thread Tom Harris
rather stuck with unittest, as I have 84 testcases, and I have to make it work tomorrow. -- Tom Harris BeacyBooks beacybooksATbigpondDOTcom -- http://mail.python.org/mailman/listinfo/python-list