Re: True lists in python?

2010-12-18 Thread Dmitry Groshev
On Dec 19, 9:48 am, Vito 'ZeD' De Tullio wrote: > Dmitry Groshev wrote: > > Is there any way to use a true lists (with O(c) insertion/deletion and > > O(n) search) in python? For example, to make things like reversing > > part of the list with a constant time. &

Re: True lists in python?

2010-12-18 Thread Dmitry Groshev
On Dec 19, 9:18 am, Dmitry Groshev wrote: > Is there any way to use a true lists (with O(c) insertion/deletion and > O(n) search) in python? For example, to make things like reversing > part of the list with a constant time. I forgot to mention that I mean *fast* lists. It's trivia

True lists in python?

2010-12-18 Thread Dmitry Groshev
Is there any way to use a true lists (with O(c) insertion/deletion and O(n) search) in python? For example, to make things like reversing part of the list with a constant time. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some syntactic sugar proposals

2010-12-01 Thread Dmitry Groshev
On Nov 22, 2:21 pm, Andreas Löscher wrote: > >     if x in range(a, b): #wrong! > > it feels so natural to check it that way, but we have to write > >     if a <= x <= b > > I understand that it's not a big deal, but it would be awesome to have > > some optimisations - it's clearly possible to det

Re: Some syntactic sugar proposals

2010-11-15 Thread Dmitry Groshev
On Nov 15, 12:03 pm, alex23 wrote: > On Nov 15, 5:50 pm, Dmitry Groshev wrote: > > > On Nov 15, 10:30 am, alex23 wrote: > > > Personally, I like keeping object attribute references separate from > > > dictionary item references. > > > Your Python doe

Re: Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
On Nov 15, 10:30 am, alex23 wrote: > On Nov 15, 4:39 pm, Dmitry Groshev wrote: > > > First of all: how many times do you write something like > >     t = foo() > >     t = t if pred(t) else default_value > > ? Of course we can write it as > >     t = foo

Re: Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
On Nov 15, 9:48 am, Chris Rebert wrote: > On Sun, Nov 14, 2010 at 10:39 PM, Dmitry Groshev > wrote: > > Here are some proposals. They are quite useful at my opinion and I'm > > interested for suggestions. It's all about some common patterns. > > > Second,

Re: Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
On Nov 15, 9:39 am, Dmitry Groshev wrote: > Here are some proposals. They are quite useful at my opinion and I'm > interested for suggestions. It's all about some common patterns. > First of all: how many times do you write something like >     t = foo() >     t = t if p

Some syntactic sugar proposals

2010-11-14 Thread Dmitry Groshev
Here are some proposals. They are quite useful at my opinion and I'm interested for suggestions. It's all about some common patterns. First of all: how many times do you write something like t = foo() t = t if pred(t) else default_value ? Of course we can write it as t = foo() if pred(f

Re: Functional composition in python

2010-08-28 Thread Dmitry Groshev
On Aug 29, 5:14 am, Steven D'Aprano wrote: > On Sat, 28 Aug 2010 21:30:39 +0400, Dmitry Groshev wrote: > > Hello all. Some time ago I wrote a little library: > >http://github.com/si14/python-functional-composition/, inspired by > > modern functional languages like F#.

Functional composition in python

2010-08-28 Thread Dmitry Groshev
Hello all. Some time ago I wrote a little library: http://github.com/si14/python-functional-composition/ , inspired by modern functional languages like F#. In my opinion it is quite useful now, but I would like to discuss it. An example of usage: import os from pyfuncomp import composable, c, _ d