def flatten(listOfLists):
return list(chain(*listOfLists))
>From http://www.python.org/doc/2.4/lib/itertools-recipes.html
--
EduardoOPadoan (eopadoan->altavix::com)
Bookmarks: http://del.icio.us/edcrypt
--
http://mail.python.org/mailman/listinfo/python-list
On 7/18/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On Tue, 17 Jul 2007 14:57:16 -0700, Walker Lindley <[EMAIL PROTECTED]> wrote:
[...]
> The obvious thing you're doing wrong is using pickle over a network. ;)
>
> http://jcalderone.livejournal.com/15864.html
Ok, maybe not the best tools
On 7/4/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> On 6/22/07, Eduardo EdCrypt O. Padoan <[EMAIL PROTECTED]> wrote:
> > Remember that pure CPython has no different "compile time" and
> > runtiime. But Psyco and ShedSkin could use the annotations the way
&
On 6/30/07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> Eduardo "EdCrypt" O. Padoan a écrit :
> > Remember that pure CPython has no different "compile time" and
> > runtiime.
>
> Oh yes ? So what's the compiler doing, and what are those
On 6/29/07, Daniel Nogradi <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> Well, the short question is: what are they? I've read Guido's python
> 3000 status report on
> http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he
> mentions ABC's but don't quite understand what the whole story is
>
On 6/27/07, Stephen R Laniel <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 28, 2007 at 09:08:16AM +0200, Bruno Desthuilliers wrote:
> > You said ?
>
> I could link again to Mark-Jason Dominus, who writes that
> people often make the following inference:
>
> 1) C is strongly typed.
> 2) C's typing sucks.
> I don't think there is anything wrong with the data structures that
> exist in python. I was just wondering if there was a structure that
> would restrict a collection to only allow certain types. The
> "restrictedlist" class discussed in another thread may be the sort of
> thing I was looking fo
On 6/22/07, John Nagle <[EMAIL PROTECTED]> wrote:
> Paul Boddie wrote:
> > P.S. I agree with the sentiment that the annotations feature of Python
> > 3000 seems like a lot of baggage. Aside from some benefits around
> > writing C/C++/Java wrappers, it's the lowest common denominator type
> > annota
> Actually since you asked, I had to try this out
>
> x = range(10)
> a, *b = x
PEP 3132: Extended Iterable Unpacking
http://www.python.org/dev/peps/pep-3132/
--
EduardoOPadoan (eopadoan->altavix::com)
Bookmarks: http://del.icio.us/edcrypt
--
http://mail.python.org/mailman/listinfo/python-lis
On 5/31/07, Bjoern Schliessmann
<[EMAIL PROTECTED]> wrote:
> Alexander Eisenhuth wrote:
>
> > Pylint is one of them (http://www.logilab.org/857)
>
> BTW: Why does pylint want all names with underscores? I tested it
> and it complains about malformed names in e.g. the following cases
> that are conf
> > Perhaps you meant that second one to be:
> > (key, mydict[key] for key in mydict if key in xrange(60, 69) or key ==
> > 3)
> >
> Clearly not! Its called *list*-comprehension, not tuple-comprehension. ;)
With () instead of [], it is a generator expression.
http://docs.python.org/ref/genexpr.html
> The thoughts of the inventor of Python on "Adding Optional Static
> Typing to Python" are at
> http://www.artima.com/weblogs/viewpost.jsp?thread=86641
> . I wonder if the idea will be implemented in Python 3.0.
No. He says it in another newer post and in PEP 3099, AFAIK.
--
EduardoOPadoan (e
> But this long int => int issue should not exist in a future python
> version any more, IIRC int and long int is scheduled to be merged
> somehow. (Or isn't it?)
It is done.
http://mail.python.org/pipermail/python-3000-checkins/2007-January/000251.html
--
EduardoOPadoan (eopadoan->altavix::com
On 2/15/07, Edward K Ream <[EMAIL PROTECTED]> wrote:
> > Isn't the very concept of major releases (1.x, 2.x, 3.x) that they *can*
> > be not backwards-compatible with previous releases?
>
> Not at all. [...]
It is the only intent of Python 3.0: be free of backward compatibity
constraints.
There ar
> Hello,
>
> How to configure Python2.5's interactive interpreter to get command
> history ?
>
> I always got ^[[A and ^[[B .
>
Are you using Ubuntu? The last comes with 2.4.x and 2.5. This only
occurs on 2.5. This happens when you compile Python with libreadline
installed, AFAIK.
FIll a bug in th
> That's hardly desirable. If one is writing a test library that goes as
> far as reparsing the assert statements, I can't see the point of
> requiring the user to clutter his test suite with such spurious print
> statements. After all, that's one of the main points of test suites in
> the first pl
> #!/usr/bin/python
>
> a = 1
> b = 2
>
> def test_some():
> assert a == b
>
> didn't reveal the values for a and b, though some more complex cases
> showed something.
def test_some():
print 'a:', a, 'b:', b
assert a == b
http://codespeak.net/py/current/doc/test.html#debug-w
> Of cource i restrict them to particular types! In C# you cannot pass
> something bad
> this way because the compiler will just catch it!
And you cant pass something 'good' that immitates another object
interface (a file-like object for example)
> I see what you mean by "duck typing". So you sug
> This means that "f" is not a pointer to make_incrementor but rather to
> the internal (copied?) function.
"returned" function isthe right here. As any returned object from a function.
>
> > This style is very common in Scheme programming so you might read a
> > Scheme book if you want to underst
http://effbot.org/pyfaq/is-there-an-equivalent-of-c-s-ternary-operator.htm
--
EduardoOPadoan (eopadoan->altavix::com)
Bookmarks: http://del.icio.us/edcrypt
Blog: http://edcrypt.blogspot.com
Jabber: edcrypt at jabber dot org
ICQ: 161480283
GTalk: eduardo dot padoan at gmail dot com
MSN: eopadoan a
On 2/2/07, Tal Einat <[EMAIL PROTECTED]> wrote:
> > I think that there aready exists a proposal for an Abstract FS Layer
> > for Python somewere.
>
> I haven't been able to find any mention of it. Maybe you could point me in
> the right direction?
>
> - Tal
>
http://wiki.python.org/moin/CodingProje
> Won't do for the OP's needs - he wants to modify the objects contained
> in listB without impacting the ones in listA (or at least that's what I
> understand).
Sorry. That is true - the items referenced on the [:] copy are the same as
in the original. Rereading what the OP msg, I think we agree
> def myFunc(listA):
> listB = listA
> work on & modify listB
> return(listB)
def my_func(listA):
listB = listA[:]
#work on & modify listB
return listB
Attribution makes the name t the left 'point' to the result of the
expression at the right.
In your myFunc the expersion at
>
> One might prefer to check for string-ness, as strings can
> duck-type somewhat like lists:
>
> my_list = ['my', 'brain', 'hurts']
> my_string = 'Are you the brain specialist?'
>
> for test in [my_list, my_string]:
> try:
> for thing in test:
> process_list_item(thing)
24 matches
Mail list logo