Re: Getting references to objects without incrementing reference counters

2010-11-16 Thread Artur Siekielski
On Nov 15, 10:06 pm, John Nagle wrote: > On 11/14/2010 11:08 AM, Artur Siekielski wrote: > > > Hi. > > I'm using CPython 2.7 and Linux. In order to make parallel > > computations on a large list of objects I want to use multiple > > processes (by using multiproc

Re: Getting references to objects without incrementing reference counters

2010-11-15 Thread Artur Siekielski
On Nov 15, 5:28 pm, Jean-Paul Calderone wrote: > On Nov 15, 10:42 am, de...@web.de (Diez B. Roggisch) wrote: > > > And circumvene a great deal of the dynamic features in python > > (which you don't need for this usecase, but still are there) > > Great as the features might be, when you don't need

Re: Getting references to objects without incrementing reference counters

2010-11-15 Thread Artur Siekielski
On Nov 15, 1:03 am, de...@web.de (Diez B. Roggisch) wrote: > You don't say what data you share, and if all of it is needed for each > child. So it's hard to suggest optimizations. Here is an example of such a problem I'm dealing with now: I'm building large index of words in memory, it takes 50% o

Re: Getting references to objects without incrementing reference counters

2010-11-15 Thread Artur Siekielski
On Nov 14, 10:04 pm, Jean-Paul Calderone wrote: > It might be interesting to try with Jython or PyPy.  Neither of these > Python runtimes uses reference counting at all. I have to use CPython because of C extensions I use (and because I use Python 2.7 features). -- http://mail.python.org/mailman

Getting references to objects without incrementing reference counters

2010-11-14 Thread Artur Siekielski
Hi. I'm using CPython 2.7 and Linux. In order to make parallel computations on a large list of objects I want to use multiple processes (by using multiprocessing module). In the first step I fill the list with objects and then I fork() my worker processes that do the job. This should work optimall

List comprehension + lambdas - strange behaviour

2010-05-06 Thread Artur Siekielski
Hello. I found this strange behaviour of lambdas, closures and list comprehensions: >>> funs = [lambda: x for x in range(5)] >>> [f() for f in funs] [4, 4, 4, 4, 4] Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The 'x' was bound to the final value of 'range(5)' expression for

Libraries for internal SOA components

2008-08-26 Thread Artur Siekielski
Hi. I'm looking for libraries for implementing SOA components (not necessery web services). Most of the components are not communicating with "the world". Language independence is not very important (Python is everywhere :). Important requirement is ability to process requests in parallel, and bec

Re: Declarative properties

2007-10-12 Thread Artur Siekielski
George Sakkis wrote: > By now you must have been convinced that default getters/setters is > not a very useful idea in Python but this does not mean you can't do > it; It's a perfect summary of my thoughts after reading this thread. I will use public attributes (with access customizable with prope

Re: Declarative properties

2007-10-11 Thread Artur Siekielski
On Oct 11, 4:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > In practice, it turns out to be a lot less work to deal with that > occasionally than to always deal with lugging around internal > attributes and external properties when they're really not needed. By > writing everything as pro

Re: Declarative properties

2007-10-11 Thread Artur Siekielski
On Oct 11, 2:27 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > But why? Default getters and setters are unnecessary and if you need > something other than the default you need to write it anyway more > explicitly. I see some problems with your approach: 1. If I use instance field 'nam

Declarative properties

2007-10-11 Thread Artur Siekielski
Hi. I would like to have declarative properties in Python, ie. something like slots definitions in defclass in Common Lisp. It seems that even Java will have it, using a library ( https://bean-properties.dev.java.net/ ). I know about 'property' function in Python, but it's normal usage isn't decl