Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-16 Thread Xah Lee
On Aug 12, 12:15 pm, Raymond Hettinger wrote: > [Xah Lee] > > > i've wrote several articles about this issue, total time spend on this > > is probably more than 2 months full-time work. See: > > > • Python Documentation Problems > > http://xahlee.org/perl-python/python_doc_index.html > > I just

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Kaz Kylheku
["Followup-To:" header set to comp.lang.lisp.] On 2009-08-17, Peter Keller wrote: > In comp.lang.scheme Peter Keller wrote: >> The distance() function in this new model is the centroid of the syntactic >> datum which represent the semantic object. > > Oops. > > I meant to say: > > "The distance()

Re: GUI interface builder for python

2009-08-16 Thread Jaseem
On Aug 17, 10:59 am, "l...@d@n" wrote: > Which is the best GUI interface builder with drag and drop > capabilities. > I am using Ubuntu GNU/Linux. > Please help me. > Thank you. There are many GUI builders for python. (Have to deal with the licensing issues.) Qt has a GUI builder. Glade (GTK+) fo

GUI interface builder for python

2009-08-16 Thread l...@d@n
Which is the best GUI interface builder with drag and drop capabilities. I am using Ubuntu GNU/Linux. Please help me. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Peter Keller
In comp.lang.scheme Peter Keller wrote: > The distance() function in this new model is the centroid of the syntactic > datum which represent the semantic object. Oops. I meant to say: "The distance() function in this new model uses the centroid of each individual syntactic datum (which represen

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Xah Lee
Personally, particular interesting info i've learned is that, for all my trouble in the past decade expressing problems of traditional math notation, i learned from his article this single-phrase summary: “traditional math notation lacks a grammar”. The article is somewhat disappointing though. I

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Peter Keller
In comp.lang.scheme toby wrote: > In my opinion Knuth believed in the value of literate programming for > similar reasons: To try to exploit existing cognitive training. If > your user base is familiar with English, or mathematical notation, or > some other lexicography, try to exploit the pre-wir

python doc available in emacs info format?

2009-08-16 Thread Xah Lee
btw, is there still info format for python doc? i feel kinda sad that emacs info format has pretty much been deprecated over the past decade. About a decade ago, you still will see now and then people asking for emacs info format of docs (was the days of perl). Today, one don't hear of it. Part o

Re: wxFormBuilder finally supports wxPython

2009-08-16 Thread Nobody
On Sun, 16 Aug 2009 03:19:51 -0700, sturlamolden wrote: > Version 3.1 of wxFormBuilder can generate wxPython code. I have > previously used wxFormBuilder to generate XRC files for my wxPython > projects. Though still in beta, this might be even better. :-) Is there a reason to prefer code over XR

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Nobody
On Sun, 16 Aug 2009 11:41:21 -0400, Benjamin Kaplan wrote: > It's not that the code is bad, but too many people coming from Java > and C keep thinking of for loops like they're using Java or C and > therefore that "for i in range(a,b)" is identical to "for(int i = a; i > < b; i++)". It's not and,

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-16 Thread Xah Lee
Thanks Raymond. I've been out of python community for a couple of years. I've saved your messages and will study it later when next time i work in python. Possibly today and will reply in some of your points. But just wanted to say thanks for improving python. Also, sometimes ago out of the blue

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Jon Harrop
w_a_x_man wrote: > On Aug 16, 11:05 am, Petey Keller wrote: >> Compiler go through *great* pains > > Compiler work real hard. > Compiler have heap big trouble. ROTFL. :-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listin

[RELEASED] Python 3.1.1

2009-08-16 Thread Benjamin Peterson
On behalf of the Python development team, I'm happy to announce the first bugfix release of the Python 3.1 series, Python 3.1.1. This bug fix release fixes many normal bugs and several critical ones including potential data corruption in the io library. Python 3.1 focuses on the stabilization and

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Nobody
On Sun, 16 Aug 2009 05:05:01 +, Steven D'Aprano wrote: > Now that I understand what the semantics of cout << "Hello world" are, I > don't have any problem with it either. It is a bit weird, "Hello world" > >> cout would probably be better, Placing the stream on the LHS allows the main forms

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Carl Banks
On Aug 16, 3:35 pm, sturlamolden wrote: > On 16 Aug, 14:57, Dennis Lee Bieber wrote: > > >         Well, the alternative would be to have two keywords for looping: one > > for your "simple" incrementing integer loop, and another for a loop that > > operates over the elements of some collection ty

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Carl Banks
On Aug 16, 6:28 pm, exar...@twistedmatrix.com wrote: > On 01:23 am, benjamin.kap...@case.edu wrote: > > >On Sun, Aug 16, 2009 at 6:35 PM, sturlamolden > >wrote: > > >>A compiler could easily recognise a statement like > > >>  for i in range(n): > > >>as a simple integer loop. In fact, Cython is ab

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Paul Rubin
exar...@twistedmatrix.com writes: > Although I think PyPy also recognizes this case and makes it as > efficient as using xrange, and does so without breaking any rules. How can pypy possibly know that the user hasn't assigned some other value to "range"? -- http://mail.python.org/mailman/listinfo

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread exarkun
On 01:23 am, benjamin.kap...@case.edu wrote: On Sun, Aug 16, 2009 at 6:35 PM, sturlamolden wrote: A compiler could easily recognise a statement like � for i in range(n): as a simple integer loop. In fact, Cython is able to do this. but special cases aren't special enough to break the rules

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread John Machin
On Aug 17, 8:35 am, sturlamolden wrote: > A compiler could easily recognise a statement like >    for i in range(n): > as a simple integer loop. In fact, Cython is able to do this. Extremely easy, once users relinquish the right to replace built-in "range" with their own concoctions ... -- htt

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Benjamin Kaplan
On Sun, Aug 16, 2009 at 6:35 PM, sturlamolden wrote: > > A compiler could easily recognise a statement like > >   for i in range(n): > > as a simple integer loop. In fact, Cython is able to do this. but special cases aren't special enough to break the rules. -- http://mail.python.org/mailman/lis

Re: zip codes

2009-08-16 Thread Grant Edwards
On 2009-08-16, Shailen wrote: > Thanks Martin and Aahz. Anyone know if zip code information is > copyrighted for the US? You can't copyright "information" as such. Only concrete expressions of information. A particular publication containing zip code information can be copyrighted. The underl

Re: zip codes

2009-08-16 Thread Paul Rubin
> It was a long time ago, I don't remember specifics, and the contents > are surely out of date by now, but I extracted a bunch of the TIGER > geographic coordinates for zip codes here: > > http://www.nightsong.com/phr/chess/zipcodes.zip That file may have actually come from here: http://www

Re: zip codes

2009-08-16 Thread Paul Rubin
Shailen writes: > Thanks Martin and Aahz. Anyone know if zip code information is > copyrighted for the US? Anyone can look up zip codes on usps.gov (and > other locations),so the information is readily available. I need zip > codes for a handful of cities and could map those myself (or write a > s

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread sturlamolden
On 16 Aug, 14:57, Dennis Lee Bieber wrote: >         Well, the alternative would be to have two keywords for looping: one > for your "simple" incrementing integer loop, and another for a loop that > operates over the elements of some collection type. A compiler could easily recognise a statement

Re: zip codes

2009-08-16 Thread Shailen
Thanks Martin and Aahz. Anyone know if zip code information is copyrighted for the US? Anyone can look up zip codes on usps.gov (and other locations),so the information is readily available. I need zip codes for a handful of cities and could map those myself (or write a script to scrape them for me

Re: redoing libgmail interface to "smtplib" blah?

2009-08-16 Thread Dave Angel
Dennis Lee Bieber wrote: On Sat, 15 Aug 2009 23:14:39 -0600, John Haggerty declaimed the following in gmane.comp.python.general: I did detect one problem thus far File "test.py", line 152 if len(args) == 1 and args[0] = "-c": Should have been fine, unless my memory of s

Re: Nltk with python

2009-08-16 Thread Aahz
In article <82c9f923-1098-4b7e-8f9d-9504c1a89...@12g2000pri.googlegroups.com>, ArshaKrishna wrote: > >How can I resolve scope ambiguity using nltk toolkit with python Question not clear, please provide more explanation -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.

Re: Python 2.6 still not giving memory back to the OS...

2009-08-16 Thread ryles
On Aug 15, 7:55 am, Chris Withers wrote: > Hi All, > > I thought this was fixed back in Python 2.5, but I guess not? > > So, I'm playing in an interactive session: > >  >>> from xlrd import open_workbook >  >>> b = open_workbook('some.xls',pickleable=0,formatting_info=1) > > At this point, top sho

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread rjf
On Aug 16, 9:05 am, Peter Keller wrote: > In comp.lang.scheme Xah Lee wrote: > > > Xah's Edu Corner: The importance of syntax & notations. > > >http://www.stephenwolfram.com/publications/recent/mathml/mathml_abstr... > > > this article should teach the coding sophomorons and computer > > ?science

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread toby
On Aug 16, 12:05 pm, Peter Keller wrote: > In comp.lang.scheme Xah Lee wrote: > > > Xah's Edu Corner: The importance of syntax & notations. > > >http://www.stephenwolfram.com/publications/recent/mathml/mathml_abstr... > > > this article should teach the coding sophomorons and computer > > ?scienc

Re: random.gauss vs. random.normalvariate

2009-08-16 Thread Paul Rubin
Dennis Lee Bieber writes: > > > No language can guard against independent access of a shared/global > > > object by multiple threads... > http://en.wikipedia.org/wiki/Erlang_(programming_language) > """ > Like operating system processes (and unlike green threads and operating > system threads) t

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread sturlamolden
On 16 Aug, 11:45, "bartc" wrote: > A for-loop, for iterating over a simple sequence, should be one of the > fastest things in the language. Anyone experienced with interpreted high-level languages knows this is not true. Not because iterating a sequence is expensive, but because the interpreter

Re: XPath support?

2009-08-16 Thread Kev Dwyer
On Sun, 16 Aug 2009 20:29:15 +, kj wrote: > I'm looking for a XML parser that produces an object with full XPath > support. What I've been using up to now, xml.etree.ElementTree, fails > to support Xpath predicates, as in "sp...@eggs='3']/ham". > > What I'm trying to do is to read-in a large

Re: XPath support?

2009-08-16 Thread Diez B. Roggisch
kj schrieb: I'm looking for a XML parser that produces an object with full XPath support. What I've been using up to now, xml.etree.ElementTree, fails to support Xpath predicates, as in "sp...@eggs='3']/ham". What I'm trying to do is to read-in a large XML string, and parse it into an object fr

XPath support?

2009-08-16 Thread kj
I'm looking for a XML parser that produces an object with full XPath support. What I've been using up to now, xml.etree.ElementTree, fails to support Xpath predicates, as in "sp...@eggs='3']/ham". What I'm trying to do is to read-in a large XML string, and parse it into an object from which I c

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread MRAB
bartc wrote: "Steven D'Aprano" wrote in message news:02969972$0$20647$c3e8...@news.astraweb.com... On Fri, 14 Aug 2009 18:25:45 -0700, Dr. Phillip M. Feldman wrote: It seems as though Python is actually expanding range(2,n) into a list of numbers, even though this is incredibly wasteful of

Re: Splitting a string into substrings of equal size

2009-08-16 Thread Simon Forman
On Aug 14, 8:22 pm, candide wrote: > Suppose you need to split a string into substrings of a given size (except > possibly the last substring). I make the hypothesis the first slice is at the > end of the string. > A typical example is provided by formatting a decimal string with thousands > separ

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Peter Keller
In comp.lang.scheme w_a_x_man wrote: > On Aug 16, 11:05?am, Petey Keller wrote: >> Compiler go through *great* pains > > Compiler work real hard. > Compiler have heap big trouble. That's a funny observation in the context of this thread--which I appreciate, since syntax really is the cornersto

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 6:18 am, Steven D'Aprano wrote: > On Sun, 16 Aug 2009 01:41:41 -0700, Douglas Alan wrote: > > I would definitely not like a language that obscures assignment by > > moving it over to the right side of lines. > One could argue that left-assigned-from-right assignment obscures the > mo

Re: random.gauss vs. random.normalvariate

2009-08-16 Thread Dave Angel
John Haggerty wrote: On Sat, Aug 15, 2009 at 7:23 PM, Dennis Lee Bieber wrote: On Sat, 15 Aug 2009 14:34:36 -0600, John Haggerty declaimed the following in gmane.comp.python.general: What does the term "thread safe" mean exactly. I never had to program with "threads" be

Re: Splitting on '^' ?

2009-08-16 Thread Stephen Hansen
And .splitlines seems to be able to handle all "standard" end-of-line > markers without any special direction (which, ironically, strikes > me as a *little* Perlish, somehow): > > >>> "spam\015\012ham\015eggs\012".splitlines(True) > ['spam\r\n', 'ham\r', 'eggs\n'] > ... actually "working correctly

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread bartc
"Steven D'Aprano" wrote in message news:02969972$0$20647$c3e8...@news.astraweb.com... On Fri, 14 Aug 2009 18:25:45 -0700, Dr. Phillip M. Feldman wrote: It seems as though Python is actually expanding range(2,n) into a list of numbers, even though this is incredibly wasteful of memory. There

Re: Splitting on '^' ?

2009-08-16 Thread John Yeung
On Aug 16, 1:09 pm, kj wrote: > And .splitlines seems to be able to handle all > "standard" end-of-line markers without any special > direction (which, ironically, strikes > me as a *little* Perlish, somehow): It's Pythonic. Universal newline-handling for text has been a staple of Python for as

Re: problem with interface of operator.itemgetter

2009-08-16 Thread Simon Forman
On Thu, Aug 13, 2009 at 11:16 PM, dou dou wrote: > I have a function to do some thing like LEFT JOIN in SQL, the function use > the itemgetter to get the "ON" and "SELECT" parameters of the two table(list > of list), the problem is that itemgetter may return a value or a tuple of > values, because

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread w_a_x_man
On Aug 16, 11:05 am, Petey Keller wrote: > Compiler go through *great* pains Compiler work real hard. Compiler have heap big trouble. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 8:45 am, MRAB wrote: > No, APL is strictly right-to-left. > >      -> x > > means "goto x". > > Writing to the console is: > >      [] <- myVar > > Reading from the console is: > >      myVar <- [] Ah, thanks for the correction. It's been 5,000 years since I used APL! |>ouglas -- ht

Re: flatten a list of list

2009-08-16 Thread Paul Rubin
Terry writes: > Is there a simple way (the pythonic way) to flatten a list of list? > rather than my current solution: > > new_list=[] > for l in list_of_list: > new_list.extend(l) from itertools import chain new_list = list(chain(list_of_list)) -- http://mail.python.org/mailman/listinfo/py

Re: flatten a list of list

2009-08-16 Thread Alan G Isaac
On 8/16/2009 5:47 AM Terry apparently wrote: > Is there a simple way (the pythonic way) to flatten a list of list? > rather than my current solution: > new_list=[] > for l in list_of_list: > new_list.extend(l) new_list = list(xi for lst in list_of_list for xi in lst) hth, Alan Isaac -- h

Re: Python 2.6 still not giving memory back to the OS...

2009-08-16 Thread Martin v. Löwis
> As far as releasing memory back to the OS is concerned, I have dim > memories of *x systems where free() would return space to the OS if > the block was "large" and it was next to the "break" point ... this > effect could be what you are seeing. Today, there are two cases when malloc returns mem

Re: flatten a list of list

2009-08-16 Thread Francesco Bochicchio
On Aug 16, 1:25 pm, Steven D'Aprano wrote: ... > Chris' suggestion using itertools seems pretty good: > > >>> from timeit import Timer > >>> setup = """\\ > > ... L = [ [None]*5000 for _ in xrange(%d) ] > ... from itertools import chain > ... """>>> Timer("list(chain.from_iterable(L))", setup %

Re: Komodo(!)

2009-08-16 Thread Lorenzo Bettini
Kee Nethery wrote: I've heard there is a nice add-on to Eclipse but Eclipse has even more setup variables than Wings and I've avoided it for that reason. Hi I've just started using python and since I've been an eclipse user for many years I tried http://pydev.sourceforge.net/ and I really e

Re: Splitting on '^' ?

2009-08-16 Thread kj
In ru...@yahoo.com writes: >On Aug 14, 2:23=A0pm, kj wrote: >> Sometimes I want to split a string into lines, preserving the >> end-of-line markers. =A0In Perl this is really easy to do, by splitting >> on the beginning-of-line anchor: >> >> =A0 @lines =3D split /^/, $string; >> >> But I can't

Re: Python or ActionScript 3.0

2009-08-16 Thread Jaseem
On Aug 16, 9:30 pm, paul wrote: > Jaseem schrieb:> Hi, > > > Is python similar to actionscript 3.0 > > Not really. > > > Which is better to create a rich gui internet application? > > Is it AS 3.0 with flex or python with its GUI libs? > > Flex+AS3 definitely! (it's been designed for that, no surp

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Raymond Hettinger
[Xavier Ho] > > I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the > > documentation. > > > Is there a substitution for this special method in 3.1, or do I really have > > to define all six rich comparison methods to work it out? FWIW, there is a recipe for expanding the c

Re: flatten a list of list

2009-08-16 Thread Scott David Daniels
Steven D'Aprano wrote: On Sun, 16 Aug 2009 02:47:42 -0700, Terry wrote: Is there a simple way (the pythonic way) to flatten a list of list? Chris' suggestion using itertools seems pretty good: from timeit import Timer setup = """\\ ... L = [ [None]*5000 for _ in xrange(%d) ] ... from itertoo

Re: Python or ActionScript 3.0

2009-08-16 Thread paul
Jaseem schrieb: Hi, Is python similar to actionscript 3.0 Not really. Which is better to create a rich gui internet application? Is it AS 3.0 with flex or python with its GUI libs? Flex+AS3 definitely! (it's been designed for that, no surprise here) Is python in demand? Depends. It seems

Re: my recursive function call is wrong?

2009-08-16 Thread Chang Min Jeon
Dear Kev Thank you very much. I got it.:) 2009/8/16 Kev Dwyer > On Sun, 16 Aug 2009 16:57:41 +0900, Chang Min Jeon wrote: > > > Hello, > > You have placed recursive calls to the function in a number of different > locations; when len(macro) becomes zero control will return to the > calling func

Re: Xah's Edu Corner: The importance of syntax & notations.

2009-08-16 Thread Peter Keller
In comp.lang.scheme Xah Lee wrote: > Xah's Edu Corner: The importance of syntax & notations. > > http://www.stephenwolfram.com/publications/recent/mathml/mathml_abstract.html > > this article should teach the coding sophomorons and computer > ?science? idiotic authors who harbor the notion that

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Benjamin Kaplan
On Sun, Aug 16, 2009 at 2:30 AM, Emmanuel Surleau wrote: > > I don't see what's particularly un-Pythonic with this code. Not using xrange() > is a mistake, certainly, but it remains clear, easily understandable code > which correctly demonstrates the naive algorithm for detecting whether n is a >

Re: Surpressing Warnings

2009-08-16 Thread Victor Subervi
This is strange because I actually had "if exists" in my code: sqlKWDrop = 'DROP TABLE IF EXISTS ' + kwTable + ';' where kwTable, in the instance cited below, becomes "judaism_128". What gives? Victor On Sun, Aug 9, 2009 at 7:57 PM, Dennis Lee Bieber wrote: > On Sun, 9 Aug 2009 15:21:43 -0500,

Re: callable virtual method

2009-08-16 Thread jean-michel Pichavant
Christian Heimes a écrit : Jean-Michel Pichavant wrote: scott.dani...@acm.org That could do the trick, sparing me from writing additional code in each methods. Thanks. Why are you trying to reinvent the wheel? Python's abc module already takes care of these details. Christian I'm working w

Re: callable virtual method

2009-08-16 Thread Jean-Michel Pichavant
Christian Heimes wrote: Jean-Michel Pichavant wrote: talking about approaches: 1/ class Interface: def foo(self): if self.__class__.foo == Interface.foo: raise NotImplementedError 2/ class Interface: def foo(self): self._foo() def _foo(sef): raise No

Re: callable virtual method

2009-08-16 Thread Christian Heimes
Jean-Michel Pichavant wrote: scott.dani...@acm.org That could do the trick, sparing me from writing additional code in each methods. Thanks. Why are you trying to reinvent the wheel? Python's abc module already takes care of these details. Christian -- http://mail.python.org/mailman/listinf

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-16 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen wrote: > On Saturday 15 August 2009 16:25:03 Grant Edwards wrote: > >> Are you using python file operations open/read/write or OS >> file-descriptor operations os.open/os.read/os.write? > > The former - that seems to be the source of my trouble. > > I have now wri

Re: callable virtual method

2009-08-16 Thread Jean-Michel Pichavant
Scott David Daniels wrote: Jean-Michel Pichavant wrote: Steven D'Aprano wrote: On Fri, 14 Aug 2009 18:49:26 +0200, Jean-Michel Pichavant wrote: Sorry guys (means guys *and* gals :op ), I realized I've not been able to describe precisely what I want to do. I'd like the base class to be virtu

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Emmanuel Surleau
> It's a particular unfair criticism because the critic (Ethan Furman) > appears to have made a knee-jerk reaction. The "some language in Python" > behaviour he's reacting to is the common idiom: > > for i in range(len(seq)): > do_something_with(seq[i]) > > > instead of the "Python in Python" i

Re: my recursive function call is wrong?

2009-08-16 Thread Kev Dwyer
On Sun, 16 Aug 2009 16:57:41 +0900, Chang Min Jeon wrote: Hello, You have placed recursive calls to the function in a number of different locations; when len(macro) becomes zero control will return to the calling function, but this calling function may have more code to execute, including fur

Re: unittest

2009-08-16 Thread Mag Gam
John: Well, this is actually a script which wraps around another application. :-) My goal is when I introduce a new feature I don't want to break old stuff so instead of me testing manually I want to build a framework of tests. On Sat, Aug 15, 2009 at 11:37 PM, John Haggerty wrote: > This is an

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread MRAB
Douglas Alan wrote: [snip] C++ also allows for reading from stdin like so: cin >> myVar; I think the direction of the arrows probably derives from languages like APL, which had notation something like so: myVar <- 3 [] <- myVar "<-" was really a little arrow symbol (APL didn't us

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Xavier Ho wrote: On Sun, Aug 16, 2009 at 9:49 PM, Mark Lawrence wrote: Unfortunately I don't think it's that easy, see. http://mail.python.org/pipermail/python-list/2008-November/688761.html The issue referenced is still open. This of course assumes that I've posted the correct link this time!

Re: flatten a list of list

2009-08-16 Thread Bearophile
Chris Rebert: > The OP asked for "simple", not "best", "most proper", or "fastest". My > comment was intended to mean that the code was marginally *simpler*, > not faster. Yep, the OP has asked for simple code. But often this is not the right way to solve this situation. A better way is to create

platform-specific overrides of functions and class methods (expanding on imputils demo code)

2009-08-16 Thread lkcl
i've just had to put something together for pyjamas-desktop which may prove to be useful to other people, so i'm pointing people in its general direction, for archive purposes. the purpose behind the platform override system is to allow implementations of a common API, in python, to share the majo

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Xavier Ho
On Sun, Aug 16, 2009 at 9:49 PM, Mark Lawrence wrote: > > Unfortunately I don't think it's that easy, see. > http://mail.python.org/pipermail/python-list/2008-November/688761.html > The issue referenced is still open. This of course assumes that I've > posted the correct link this time! > I'm no

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Chris Rebert wrote: On Sat, Aug 15, 2009 at 8:09 AM, Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to wor

Re: flatten a list of list

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 7:31 AM, Steven D'Aprano wrote: > On Sun, 16 Aug 2009 06:59:52 -0400, Chris Rebert wrote: >>> Surely that's going to be O(N**2)? >> >> The OP asked for "simple", not "best", "most proper", or "fastest". My >> comment was intended to mean that the code was marginally *simpler

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Terry Reedy
Xavier Ho wrote: I'm really looking for a way to set up Python classes' natural ordering for sorting purposes. I believe __lt__ (<) is the only method (operator) used by both .sort and heap module. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Hendrik van Rooyen
On Sunday 16 August 2009 12:18:11 Steven D'Aprano wrote: > In any case, after half a century of left-from-right assignment, I think > it's worth the experiment in a teaching language or three to try it the > other way. The closest to this I know of is the family of languages > derived from Apple's

Re: flatten a list of list

2009-08-16 Thread Steven D'Aprano
On Sun, 16 Aug 2009 06:59:52 -0400, Chris Rebert wrote: >> Surely that's going to be O(N**2)? > > The OP asked for "simple", not "best", "most proper", or "fastest". My > comment was intended to mean that the code was marginally *simpler*, not > faster. Fair enough, but he also asked for Pythoni

Re: flatten a list of list

2009-08-16 Thread Steven D'Aprano
On Sun, 16 Aug 2009 02:47:42 -0700, Terry wrote: > Hi, > > Is there a simple way (the pythonic way) to flatten a list of list? > rather than my current solution: > > new_list=[] > for l in list_of_list: > new_list.extend(l) I don't think that scales terribly well. In my testing, it performs

Re: flatten a list of list

2009-08-16 Thread Terry
On Aug 16, 6:59 pm, Chris Rebert wrote: > On Sun, Aug 16, 2009 at 6:49 AM, Steven > > > > > > D'Aprano wrote: > > On Sun, 16 Aug 2009 05:55:48 -0400, Chris Rebert wrote: > >> On Sun, Aug 16, 2009 at 5:47 AM, Terry wrote: > >>> Hi, > > >>> Is there a simple way (the pythonic way) to flatten a list

Re: Problem Regarding Handling of Unicode string

2009-08-16 Thread joy99
On Aug 11, 1:17 pm, John Machin wrote: > On Aug 10, 9:26 pm, joy99 wrote: > > > Dear Group, > > > I am using Python26 on WindowsXP with service pack2. My GUI is IDLE. > > I am using Hindi resources and get nice output like: > > एक > > where I can use all the re functions and other functions witho

Re: Is it possible to use python to get True Full Duplex on a Serial port? - conclusions

2009-08-16 Thread Hendrik van Rooyen
On Sunday 16 August 2009 08:20:34 John Nagle wrote: > Hendrik van Rooyen wrote: > > On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: > >> Hendrik van Rooyen wrote: > >>> In the past, on this group, I have made statements that said that on > >>> Linux, the serial port handling somehow doe

Re: flatten a list of list

2009-08-16 Thread Steven D'Aprano
On Sun, 16 Aug 2009 12:03:53 +0200, Michael Fötsch wrote: > Terry wrote: >> Is there a simple way (the pythonic way) to flatten a list of list? > > This is probably the shortest it can get: > > sum(list_of_lists, []) That's also O(N**2). >>> from timeit import Timer >>> setup = "L = [ ([None

Re: flatten a list of list

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 6:49 AM, Steven D'Aprano wrote: > On Sun, 16 Aug 2009 05:55:48 -0400, Chris Rebert wrote: >> On Sun, Aug 16, 2009 at 5:47 AM, Terry wrote: >>> Hi, >>> >>> Is there a simple way (the pythonic way) to flatten a list of list? >>> rather than my current solution: >>> >>> new_lis

Re: flatten a list of list

2009-08-16 Thread Steven D'Aprano
On Sun, 16 Aug 2009 05:55:48 -0400, Chris Rebert wrote: > On Sun, Aug 16, 2009 at 5:47 AM, Terry wrote: >> Hi, >> >> Is there a simple way (the pythonic way) to flatten a list of list? >> rather than my current solution: >> >> new_list=[] >> for l in list_of_list: >>    new_list.extend(l) >> >> or

Re: How to find out in which module an instance of a class is created?

2009-08-16 Thread Johannes Janssen
Chris Rebert schrieb: On Sun, Aug 16, 2009 at 6:25 AM, Johannes Janssen wrote: Gabriel Genellina schrieb: The try/except around sys._getframe(1) is because that function is not mandatory/available on all Python implementations (that's the case for jython which doesn't provide it).

Re: How to find out in which module an instance of a class is created?

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 6:25 AM, Johannes Janssen wrote: > Gabriel Genellina schrieb: >> >> The try/except around sys._getframe(1) is because that function is not >> mandatory/available on all Python implementations (that's the case for >> jython which doesn't provide it). > > Thanks, shouldn't suc

Re: How to find out in which module an instance of a class is created?

2009-08-16 Thread Johannes Janssen
Gabriel Genellina schrieb: The try/except around sys._getframe(1) is because that function is not mandatory/available on all Python implementations (that's the case for jython which doesn't provide it). Thanks, shouldn't such information be part of the python documentation of sys._getframe()

wxFormBuilder finally supports wxPython

2009-08-16 Thread sturlamolden
Version 3.1 of wxFormBuilder can generate wxPython code. I have previously used wxFormBuilder to generate XRC files for my wxPython projects. Though still in beta, this might be even better. :-) http://wxformbuilder.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Steven D'Aprano
On Sun, 16 Aug 2009 01:41:41 -0700, Douglas Alan wrote: > I like to be able to read everything from left to right, and Lisp does > that more than any other programming language. > > I would definitely not like a language that obscures assignment by > moving it over to the right side of lines. On

Re: flatten a list of list

2009-08-16 Thread Michael Fötsch
Terry wrote: Is there a simple way (the pythonic way) to flatten a list of list? This is probably the shortest it can get: sum(list_of_lists, []) Kind Regards, M.F. -- http://mail.python.org/mailman/listinfo/python-list

Re: flatten a list of list

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 5:47 AM, Terry wrote: > Hi, > > Is there a simple way (the pythonic way) to flatten a list of list? > rather than my current solution: > > new_list=[] > for l in list_of_list: >    new_list.extend(l) > > or, > > new_list=reduce(lambda x,y:x.extend(y), list_of_list) #only ma

Re: Splitting a string into substrings of equal size

2009-08-16 Thread Gregor Lingl
Mark Tolonen schrieb: "Gregor Lingl" wrote in message news:4a87036a$0$2292$91cee...@newsreader02.highway.telekom.at... Emile van Sebille schrieb: On 8/14/2009 5:22 PM candide said... ... What is the pythonic way to do this ? I like list comps... >>> jj = '1234567890123456789' >>> ",".

flatten a list of list

2009-08-16 Thread Terry
Hi, Is there a simple way (the pythonic way) to flatten a list of list? rather than my current solution: new_list=[] for l in list_of_list: new_list.extend(l) or, new_list=reduce(lambda x,y:x.extend(y), list_of_list) br, Terry -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Xavier Ho
On Sun, Aug 16, 2009 at 7:38 PM, Mark Lawrence wrote: > > Blast, I posted the wrong flaming link, sorry everybody. > No, don't be sorry. I found your link very informative, and while it's a little mixed, it could be useful. I'm really looking for a way to set up Python classes' natural ordering

Re: ignored test cases in unittest

2009-08-16 Thread Terry
On Aug 16, 5:25 pm, Duncan Booth wrote: > Ben Finney wrote: > > Terry writes: > > >> It seemed the to me that python unittest module does not support the > >> counting of ignored test cases directly. Is there any ready solution > >> for this? > > > One solution I've seen involves: > > > * a cust

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Chris Rebert wrote: On Sat, Aug 15, 2009 at 1:06 PM, Mark Lawrence wrote: Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich com

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 4:48 am, Erik Max Francis wrote: > Douglas Alan wrote: > > Personally, my favorite is Lisp, which looks like > > >    (set! y (+ y 1)) > > For varying values of "Lisp."  `set!` is Scheme. Yes, I'm well aware! There are probably as many different dialects of Lisp as all other programmi

Re: ignored test cases in unittest

2009-08-16 Thread Duncan Booth
Ben Finney wrote: > Terry writes: > >> It seemed the to me that python unittest module does not support the >> counting of ignored test cases directly. Is there any ready solution >> for this? > > One solution I've seen involves: > > * a custom exception class, ‘TestSkipped’ > > * raisin

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Erik Max Francis
Douglas Alan wrote: Personally, my favorite is Lisp, which looks like (set! y (+ y 1)) For varying values of "Lisp." `set!` is Scheme. -- Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis Get there

  1   2   >