Re: Tips/lessons learned for writing a Python powered DSL?

2011-07-07 Thread Paul Woolcock
iate hearing about them. > > Thank you, > Malcolm > > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- --- Paul Woolcock -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial Function Application -- Advantages over normal function?

2011-07-18 Thread Paul Woolcock
gt;> add2 = partial(add, right=2) Now, you have a new function, `add2`, that takes one parameter: >>> add2(4) 6 --- Paul Woolcock pwool...@gmail.com On Mon, Jul 18, 2011 at 6:13 AM, Kurian Thayil wrote: > > Hi, > > I am a newbie in python and would like to

Re: Return and set

2011-07-19 Thread Paul Woolcock
(self): >if self.tok: >t = self.tok >self.tok = None >return t ># ... > > > Is there a way to trim the 'if' block to reset self.tok upon return? > > -- > Bill > -- > http://mail.python.org/**mailman/listinfo/python-list<http:

Re: __all__

2011-08-09 Thread Paul Woolcock
The gurus will have to correct me if this is not an accepted practice, but I know some projects (Fabric is the one that comes to mind) will define a submodule specifically for the 'from blah import *' situation. The submodule would be called "api", or something like that, so you can do: 'from mymod

Re: allow line break at operators

2011-08-15 Thread Paul Woolcock
On Aug 14, 2011 3:24 PM, "Seebs" wrote: ... > > I'm not impressed by arguments based on "but if I do something stupid, like > > select text with my eyes closed and reindent it without looking, I expect > > the compiler to save my bacon". In my opinion, it's not the compiler's job > > to protect yo

Re: 'super' object has no attribute '__setitem__'

2011-08-19 Thread Paul Woolcock
If you really want __setitem__ and not __setattr__, you should change the base class to 'dict'. Or 'import UserDict' and use that for the base class. On Aug 18, 2011 9:45 PM, "luvspython" wrote: > I'm using Python 2.7 and the code below fails at the 'super' statement > in the __setitem__ function