Function arguments

2009-01-26 Thread brasse
Hello! Is there any way that I can get at all the arguments passed to a function as a map without using keyword arguments? def foo(a, b, c): # Can I access all the arguments in a collection somewhere? I'm mainly curious since I have stumbled on to some cases where it might have been nice to

Re: Function arguments

2009-01-26 Thread brasse
On Jan 26, 10:11 am, Chris Rebert wrote: > On Mon, Jan 26, 2009 at 1:03 AM, brasse wrote: > > Hello! > > > Is there any way that I can get at all the arguments passed to a > > function as a map without using keyword arguments? > > > def foo(a, b, c): > >  

Re: Function arguments

2009-01-26 Thread brasse
On Jan 26, 10:39 am, Chris Rebert wrote: > On Mon, Jan 26, 2009 at 1:34 AM, brasse wrote: > > On Jan 26, 10:11 am, Chris Rebert wrote: > >> On Mon, Jan 26, 2009 at 1:03 AM, brasse wrote: > >> > Hello! > > >> > Is there any way that I can get at all

Builing Python 2.6 on AIX 5.2

2008-10-06 Thread brasse
Hello! I am having some trouble building Python 2.6 on AIX. The steps I have taken are: export PATH=/usr/bin/:/usr/vacpp/bin/ ./configure --with-gcc=xlc_r --with-cxx=xlC_r --disable-ipv6 make This is the error message I'm seeing: ./Modules/ld_so_aix xlc_r -bI:Modules/python.exp build/ temp.aix-5

Re: Builing Python 2.6 on AIX 5.2

2008-10-07 Thread brasse
the bug tracker. I would be quite happy if I could build Python on AIX without the multiprocessing module. Is there some way I can skip some selected modules when building Python. I tried with ./configure --without- multiprocessing, but that didn't work. :.:: mattias > On Mon, Oct 6,

Re: Builing Python 2.6 on AIX 5.2

2008-10-07 Thread brasse
On Oct 6, 10:16 am, brasse <[EMAIL PROTECTED]> wrote: > Hello! > > I am having some trouble building Python 2.6 on AIX. The steps I have > taken are: > > export PATH=/usr/bin/:/usr/vacpp/bin/ > ./configure --with-gcc=xlc_r --with-cxx=xlC_r --disable-ipv6 > make >

contextlib.nested()

2008-11-06 Thread brasse
Hello! I have been running in to some problems when using contextlib.nested(). My problem arises when using code similar to this: from __future__ import with_statement from contextlib import nested class Foo(object): def __init__(self, tag, fail=False): print 'ctor', tag se

Re: contextlib.nested()

2008-11-06 Thread brasse
On Nov 6, 11:43 am, Robert Lehmann <[EMAIL PROTECTED]> wrote: > On Thu, 06 Nov 2008 01:02:34 -0800, brasse wrote: > > Hello! > > > I have been running in to some problems when using contextlib.nested(). > > My problem arises when using code similar to this

Re: contextlib.nested()

2008-11-07 Thread brasse
On Nov 6, 5:45 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > If you had a class that wanted to acquire some external resources that > > must be released at some point, how would you rewrite the code from my > > example? > > If you *can*, use a context. Use __enter__ and __exit__. Try really

Re: contextlib.nested()

2008-11-07 Thread brasse
On Nov 7, 10:33 am, Peter Otten <[EMAIL PROTECTED]> wrote: > brasse wrote: > > with nested(Foo('a'), Foo('b', True)) as (a, b): > >     print a.tag > >     print b.tag > > If been watching this thread for a while, and I think that your problems

Cleaning up after failing to contructing objects

2009-07-06 Thread brasse
Hello! I have been thinking about how write exception safe constructors in Python. By exception safe I mean a constructor that does not leak resources when an exception is raised within it. The following is an example of one possible way to do it: class Foo(object): def __init__(self, name, f