Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Thu, Apr 26, 2012 at 3:48 PM, John Nagle na...@animats.com wrote:   This assumes that everything is, internally, an object.  In CPython, that's the case, because Python is a naive interpreter and everything, including numbers, is boxed.  That's not true of PyPy or Shed Skin. So does is have

Set Date and Time on Python

2012-04-26 Thread viral shah
Hi I'm very new to Python programming. Please help me to add date and time ! Following is the code done by me. import datetime class Module type(datetime.datetime) Now what's the next to do for displaying date and time ? -- http://mail.python.org/mailman/listinfo/python-list

ANN: eGenix mxODBC - Python ODBC Database Interface 3.1.2

2012-04-26 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC - Python ODBC Database Interface Version 3.1.2 mxODBC is our commercially supported Python extension providing ODBC database connectivity to

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Steven D'Aprano
On Wed, 25 Apr 2012 22:48:33 -0700, John Nagle wrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English connotations of the term; I like 'sameobj'

Overlayong PDF Files

2012-04-26 Thread Greg Lindstrom
I would like to take an existing pdf file which has the image of a health care claim and overlay the image with claim data (insured name, address, procedures, etc.). I'm pretty good with reportlab -- in fact, I've created a form close to the CMS 1500 (with NPI), but it's not close enough for

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Steven D'Aprano
On Wed, 25 Apr 2012 20:50:21 -0700, Adam Skutt wrote: On Apr 25, 8:01 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English

Re: Set Date and Time on Python

2012-04-26 Thread Dave Angel
On 04/26/2012 03:09 AM, viral shah wrote: Hi I'm very new to Python programming. Please help me to add date and time ! Following is the code done by me. import datetime class Module type(datetime.datetime) Now what's the next to do for displaying date and time ? Your subject

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Kiuhnm
On 4/26/2012 13:37, Kiuhnm wrote: On 4/26/2012 5:08, deuteros wrote: I'm fairly new to Python I have version 2.7 installed on my computer. However my professor wants us all to use the latest version of Python. How do I go about upgrading? Do I just install the new version? Do I have to do

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Kiuhnm
On 4/26/2012 5:08, deuteros wrote: I'm fairly new to Python I have version 2.7 installed on my computer. However my professor wants us all to use the latest version of Python. How do I go about upgrading? Do I just install the new version? Do I have to do anything with the old version already

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 5:10 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 25 Apr 2012 20:50:21 -0700, Adam Skutt wrote: On Apr 25, 8:01 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 1:48 am, John Nagle na...@animats.com wrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English connotations of the term; I like

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Thu, Apr 26, 2012 at 9:42 PM, Adam Skutt ask...@gmail.com wrote: Would you call the result of casting a C pointer to an int an address?  If so, you must call the result of id() an address as well-- you can't dereference either of them.  If not, then you need to provide an alternate name for

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Andrew Berg
On 4/26/2012 6:37 AM, Kiuhnm wrote: Python has been forked into 2.x and 3.x because some breaking changes ought to be made to the language in order to improve it and clean it up. That's not really a good way to put it. 2.6 and 2.7 will get security fixes, but there won't be a 2.8 unless someone

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Robert Kern
On 4/26/12 12:56 PM, Chris Angelico wrote: Side point: In Python 2, id() returns an int, not a long. Is it possible to be running Python on a 64-bit machine with a 32-bit int type? Yes. Win64 has 64-bit pointers and 32-bit C longs (and thus 32-bit Python ints). And if so, what does CPython

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Kiuhnm
On 4/26/2012 2:01, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English connotations of the term; I like 'sameobj' personally, for whatever little it matters. Really, I

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Thu, Apr 26, 2012 at 10:12 PM, Robert Kern robert.k...@gmail.com wrote: Yes. Win64 has 64-bit pointers and 32-bit C longs (and thus 32-bit Python ints). It returns a Python long. Ah, that solves that one. Definite improvement in Python 3 with the merging of the two types, though. Machine

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Arnaud Delobelle
On 26 April 2012 12:42, Adam Skutt ask...@gmail.com wrote: On Apr 26, 5:10 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 25 Apr 2012 20:50:21 -0700, Adam Skutt wrote: On Apr 25, 8:01 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 25 Apr

Re: Overlayong PDF Files

2012-04-26 Thread Adam Tauno Williams
On Wed, 2012-04-25 at 13:36 -0500, Greg Lindstrom wrote: I would like to take an existing pdf file which has the image of a health care claim and overlay the image with claim data (insured name, address, procedures, etc.). I'm pretty good with reportlab -- in fact, I've created a form close

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread deuteros
On Thu 26 Apr 2012 07:37:20a, Kiuhnm kiuhnm03.4t.yahoo.it wrote in news:4f993382$0$1378$4fafb...@reader2.news.tin.it: Python 2.7.3 and 3.2.3 (the latest versions) can coexist. Just install Python 3.2.3 in a different directory (python32, for instance). Python has been forked into 2.x and

Re: csv: No fields, or one field?

2012-04-26 Thread Neil Cerutti
On 2012-04-26, Tim Roberts t...@probo.com wrote: Neil Cerutti ne...@norwich.edu wrote: Is there an explanation or previous dicussion somewhere for the following behavior? I haven't yet trolled the csv mailing list archive, though that would probably be a good place to check. Python 3.2

Re: csv: No fields, or one field?

2012-04-26 Thread Neil Cerutti
On 2012-04-26, Neil Cerutti ne...@norwich.edu wrote: I made the following wrong assumption about the csv EBNF recognized by Python (ignoring record seps): record - field {delim field} There's at least some csv standard documents requiring my interprestion, e.g.,

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Andrew Berg
On 4/26/2012 8:02 AM, deuteros wrote: So how do I tell my IDE (Eclipse with PyDev) which version of Python I want to use? When you start a new PyDev project, it will ask. -- CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Kiuhnm
On 4/26/2012 13:45, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.com wrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Kiuhnm
On 4/26/2012 15:02, deuteros wrote: On Thu 26 Apr 2012 07:37:20a, Kiuhnmkiuhnm03.4t.yahoo.it wrote in news:4f993382$0$1378$4fafb...@reader2.news.tin.it: Python 2.7.3 and 3.2.3 (the latest versions) can coexist. Just install Python 3.2.3 in a different directory (python32, for instance).

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread rusi
On Apr 26, 4:42 pm, Adam Skutt ask...@gmail.com wrote: In a mathematical sense, you're saying that given f(x) = x+2, using f(x) is somehow more direct (whatever the hell that even means) than using 'x+2'.  That's just not true.  We freely and openly interchange them all the time doing

Is PyIntBlocks are never returned to the system before shutdown right?

2012-04-26 Thread ZHONG Chen
PyIntBlocks are never returned to the system before shutdown I saw this comment in Python 2.6.8's source code: Objects/intobject.c line 25 But in the function PyInt_ClearFreeList() It will call PyMem_FREE(list) for empty int block. Why? -- myheimu 2012.4 School of Software, 2007, Tsinghua

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 9:37 am, Kiuhnm kiuhnm03.4t.yahoo.it wrote: On 4/26/2012 13:45, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.com  wrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Fri, Apr 27, 2012 at 12:00 AM, Adam Skutt ask...@gmail.com wrote: C# and Python do have a misfeature: '==' is identity comparison only if operator== / __eq__ is not overloaded.  Identity comparison and value comparison are disjoint operations, so it's entirely inappropriate to combine them.

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 10:18 am, rusi rustompm...@gmail.com wrote: On Apr 26, 4:42 pm, Adam Skutt ask...@gmail.com wrote: In a mathematical sense, you're saying that given f(x) = x+2, using f(x) is somehow more direct (whatever the hell that even means) than using 'x+2'.  That's just not true.  We

RuntimeWarning: Unable to load template engine entry point

2012-04-26 Thread sajuptpm
Hi, I am using Ubuntu 12.04 precise Python 2.7 turbogears 2.0.3 Getting following errors when doing turbogears setup. Have any way to fix this without upgrade to turbogears 2.0.4. Using /home/saju/cmt-enterprise/tg2env/lib/python2.7/site-packages/ BytecodeAssembler-0.3-py2.7.egg Searching for

Re: Strange __import__() behavior

2012-04-26 Thread Frank Miles
On Wed, 25 Apr 2012 23:03:36 +0200, Kiuhnm wrote: On 4/25/2012 22:05, Frank Miles wrote: I have an exceedingly simple function that does a named import. It works perfectly for one file r- and fails for the second x. If I reverse the order of being called, it is still x that fails, and r

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Kiuhnm
On 4/26/2012 16:00, Adam Skutt wrote: On Apr 26, 9:37 am, Kiuhnmkiuhnm03.4t.yahoo.it wrote: On 4/26/2012 13:45, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.comwrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt

Re: Strange __import__() behavior

2012-04-26 Thread Kiuhnm
On 4/26/2012 17:19, Frank Miles wrote: On Wed, 25 Apr 2012 23:03:36 +0200, Kiuhnm wrote: On 4/25/2012 22:05, Frank Miles wrote: I have an exceedingly simple function that does a named import. It works perfectly for one file r- and fails for the second x. If I reverse the order of being

Re: Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Evan Driscoll
This thread has already beaten a dead horse enough that the horse came back as a zombie and was re-killed, but I couldn't help but respond to this part: On 01/-10/-28163 01:59 PM, Adam Skutt wrote: Code that relies on the identity of a temporary object is generally incorrect. This is why

Re: csv: No fields, or one field?

2012-04-26 Thread Terry Reedy
On 4/26/2012 9:12 AM, Neil Cerutti wrote: On 2012-04-26, Neil Ceruttine...@norwich.edu wrote: I made the following wrong assumption about the csv EBNF recognized by Python (ignoring record seps): record - field {delim field} Is that in the docs? There's at least some csv standard

Re: Is PyIntBlocks are never returned to the system before shutdown right?

2012-04-26 Thread Terry Reedy
On 4/26/2012 10:21 AM, ZHONG Chen wrote: PyIntBlocks are never returned to the system before shutdown I saw this comment in Python 2.6.8's source code: Objects/intobject.c line 25 But in the function PyInt_ClearFreeList() It will call PyMem_FREE(list) for empty int block. Why? Before

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Ian Kelly
On Thu, Apr 26, 2012 at 3:10 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But I was actually referring to something more fundamental than that. The statement a is b is a *direct* statement of identity. John is my father. id(a) == id(b) is *indirect*: The only child of John's

Half-baked idea: list comprehensions with while

2012-04-26 Thread Roy Smith
I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable: if not a: break x.append(a) It does has a few things going for it. It

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Chris Rebert
On Thu, Apr 26, 2012 at 10:02 AM, Roy Smith r...@panix.com wrote: I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable:    if not a:        

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Chris Kaynor
On Thu, Apr 26, 2012 at 10:02 AM, Roy Smith r...@panix.com wrote: I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable:    if not a:        

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Ian Kelly
On Thu, Apr 26, 2012 at 11:02 AM, Roy Smith r...@panix.com wrote: I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable:    if not a:        

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Mark Lawrence
On 26/04/2012 18:02, Roy Smith wrote: I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable: if not a: break x.append(a) It

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread rusi
On Apr 26, 7:44 pm, Adam Skutt ask...@gmail.com wrote: On Apr 26, 10:18 am, rusi rustompm...@gmail.com wrote: On Apr 26, 4:42 pm, Adam Skutt ask...@gmail.com wrote: In a mathematical sense, you're saying that given f(x) = x+2, using f(x) is somehow more direct (whatever the hell that

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Kiuhnm
On 4/26/2012 19:02, Roy Smith wrote: I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable: if not a: break x.append(a) It does

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Paul Rubin
Roy Smith r...@panix.com writes: x = [a for a in iterable while a] from itertools import takewhile x = takewhile(bool, a) -- http://mail.python.org/mailman/listinfo/python-list

Web Scraping - Output File

2012-04-26 Thread SMac2347
Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file; however, the file is blank (ideally it should be populated

(3.2) Overload print() using the C API?

2012-04-26 Thread Peter Faulks
G'day, I want to extend an embedded interpreter so that calls to print() are automagically sent to a C++ gui (windows exe) via a callback function in the DLL. Then I'll be able to do this: test.py import printoverload printoverload.set_stdout() printoverload.set_stderr()

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Kiuhnm
On 4/26/2012 19:48, Paul Rubin wrote: Roy Smithr...@panix.com writes: x = [a for a in iterable while a] from itertools import takewhile x = takewhile(bool, a) I see that as a 'temporary' solution, otherwise we wouldn't need 'if' inside of list comprehensions either. Kiuhnm --

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Terry Reedy
On 4/26/2012 1:48 AM, John Nagle wrote: This assumes that everything is, internally, an object. In CPython, that's the case, because Python is a naive interpreter and everything, including numbers, is boxed. That's not true of PyPy or Shed Skin. So does is have to force the creation of a

Re: Web Scraping - Output File

2012-04-26 Thread MRAB
On 26/04/2012 18:54, smac2...@comcast.net wrote: Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file;

Re: Web Scraping - Output File

2012-04-26 Thread Kiuhnm
On 4/26/2012 19:54, smac2...@comcast.net wrote: Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file;

Re: (3.2) Overload print() using the C API?

2012-04-26 Thread Chris Angelico
On Fri, Apr 27, 2012 at 3:57 AM, Peter Faulks faul...@iinet.net.au wrote: I want to extend an embedded interpreter so that calls to print() are automagically sent to a C++ gui (windows exe) via a callback function in the DLL. Then I'll be able to do this: test.py import

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread John Nagle
On 4/26/2012 4:45 AM, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.com wrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 12:02 pm, Kiuhnm kiuhnm03.4t.yahoo.it wrote: On 4/26/2012 16:00, Adam Skutt wrote: On Apr 26, 9:37 am, Kiuhnmkiuhnm03.4t.yahoo.it wrote: On 4/26/2012 13:45, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.comwrote: This assumes that everything is,

Re: ANN: cmd2, an extenstion of cmd that parses its argument line

2012-04-26 Thread anntzer . lee
I have renamed the project to parsedcmd, which is also a better description of what the module does. https://github.com/anntzer/parsedcmd On Monday, March 19, 2012 6:14:44 AM UTC-7, xDog Walker wrote: On Sunday 2012 March 18 22:11, anntzer@gmail.com wrote: I would like to announce the

Re: cmd2, an extenstion of cmd that parses its argument list

2012-04-26 Thread anntzer . lee
On Sunday, March 18, 2012 10:12:24 PM UTC-7, anntz...@gmail.com wrote: Dear all, I would like to announce the first public release of cmd2, an extension of the standard library's cmd with argument parsing, here: https://github.com/anntzer/cmd2. Due to an already existing Cmd2 on PyPI, I

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 1:34 pm, rusi rustompm...@gmail.com wrote: On Apr 26, 7:44 pm, Adam Skutt ask...@gmail.com wrote: On Apr 26, 10:18 am, rusi rustompm...@gmail.com wrote: On Apr 26, 4:42 pm, Adam Skutt ask...@gmail.com wrote: In a mathematical sense, you're saying that given f(x) = x+2, using

Re: (3.2) Overload print() using the C API?

2012-04-26 Thread Peter Faulks
Cheers, Yes was aware this would (might) be possible in 3.x only. All you have to do is assign to print. Sounds great! Can some kind soul hit me with a clue stick? Were do I look in the API? On 27/04/2012 4:26 AM, Chris Angelico wrote: On Fri, Apr 27, 2012 at 3:57 AM, Peter

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 2:31 pm, John Nagle na...@animats.com wrote: On 4/26/2012 4:45 AM, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.com  wrote: On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a

Re: Web Scraping - Output File

2012-04-26 Thread Jon Clements
SMac2347 at comcast.net writes: Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file; however, the

Re: Web Scraping - Output File

2012-04-26 Thread SMac2347
On Apr 26, 2:19 pm, Kiuhnm kiuhnm03.4t.yahoo.it wrote: On 4/26/2012 19:54, smac2...@comcast.net wrote: Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Ian Kelly
On Thu, Apr 26, 2012 at 1:34 PM, Adam Skutt ask...@gmail.com wrote: What I think you want is what I said above: ValueError raised when either operand is a /temporary/ object.  Really, it should probably be a parse-time error, since you could (and should) make the determination at parse time.

Re: (3.2) Overload print() using the C API?

2012-04-26 Thread Chris Angelico
On Fri, Apr 27, 2012 at 5:28 AM, Peter Faulks faul...@iinet.net.au wrote: Cheers, Yes was aware this would (might) be possible in 3.x only. All you have to do is assign to print. Sounds great! Can some kind soul hit me with a clue stick? Were do I look in the API? (We prefer to avoid

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Fri, Apr 27, 2012 at 7:39 AM, Ian Kelly ian.g.ke...@gmail.com wrote: I'm not sure precisely what you mean by temporary object, so I am taking it to mean an object that is referenced only by the VM stack (or something equivalent for other implementations). In that case: no, you can't.  Take

Re: Half-baked idea: list comprehensions with while

2012-04-26 Thread Ian Kelly
On Thu, Apr 26, 2012 at 11:57 AM, Kiuhnm kiuhnm03.4t.yahoo...@mail.python.org wrote: On 4/26/2012 19:48, Paul Rubin wrote: Roy Smithr...@panix.com  writes: x = [a for a in iterable while a] from itertools import takewhile x = takewhile(bool, a) I see that as a 'temporary' solution,

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Ian Kelly
On Thu, Apr 26, 2012 at 3:51 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Apr 27, 2012 at 7:39 AM, Ian Kelly ian.g.ke...@gmail.com wrote: I'm not sure precisely what you mean by temporary object, so I am taking it to mean an object that is referenced only by the VM stack (or something

RE: Web Scraping - Output File

2012-04-26 Thread Prasad, Ramit
I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file; however, the file is blank (ideally it should be

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Fri, Apr 27, 2012 at 8:04 AM, Ian Kelly ian.g.ke...@gmail.com wrote: You can't check ref counts at parse time. I know, and it'd be impossible to recognize at parse time for any but the most trivial cases (since names can always be rebound). The detection of temporaries can only be done at run

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Nobody
On Thu, 26 Apr 2012 11:31:39 -0700, John Nagle wrote: I would suggest that is raise ValueError for the ambiguous cases. If both operands are immutable, is should raise ValueError. That's the case where the internal representation of immutables shows through. This breaks one of the most

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Kiuhnm
On 4/26/2012 20:54, Adam Skutt wrote: On Apr 26, 12:02 pm, Kiuhnmkiuhnm03.4t.yahoo.it wrote: On 4/26/2012 16:00, Adam Skutt wrote: On Apr 26, 9:37 am, Kiuhnmkiuhnm03.4t.yahoo.it wrote: On 4/26/2012 13:45, Adam Skutt wrote: On Apr 26, 1:48 am, John Naglena...@animats.com wrote:

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Paul Rubin
Nobody nob...@nowhere.com writes: All practical languages have some implementation-defined behaviour, often far more problematic than Python's. The usual reason for accepting implementation-defined behavior is to enable low-level efficiency hacks written for specific machines. C and C++ are

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Steven D'Aprano
On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote: I often wonder what the world would be like if Python, C#, and Java embraced value types more, and had better support for pure functions. They would be slower, require more memory, harder to use, and far, far less popular. Some other

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Mark Lawrence
On 20/04/2012 20:10, dmitrey wrote: I have spent some time searching for a bug in my code, it was due to different work of is with () and []: () is () True [] is [] False (Python 2.7.2+ (default, Oct 4 2011, 20:03:08) [GCC 4.6.1] ) Is this what it should be or maybe yielding unified

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 6:34 pm, Kiuhnm kiuhnm03.4t.yahoo.it wrote: On 4/26/2012 20:54, Adam Skutt wrote: On Apr 26, 12:02 pm, Kiuhnmkiuhnm03.4t.yahoo.it  wrote: On 4/26/2012 16:00, Adam Skutt wrote: On Apr 26, 9:37 am, Kiuhnmkiuhnm03.4t.yahoo.it   wrote: The fact that you think that that's differing

Re: Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Thu, Apr 26, 2012 at 12:05 PM, Evan Driscoll drisc...@cs.wisc.edu wrote: This thread has already beaten a dead horse enough that the horse came back as a zombie and was re-killed, but I couldn't help but respond to this part: On 01/-10/-28163 01:59 PM, Adam Skutt wrote: Code that relies

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Thu, Apr 26, 2012 at 5:39 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Apr 26, 2012 at 1:34 PM, Adam Skutt ask...@gmail.com wrote: What I think you want is what I said above: ValueError raised when either operand is a /temporary/ object.  Really, it should probably be a parse-time

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 7:33 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote: I often wonder what the world would be like if Python, C#, and Java embraced value types more, and had better support for pure functions. They would be

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Paul Rubin
Adam Skutt ask...@gmail.com writes: harder to use, and far, far less popular. Alas, these two are probably true. Haskell is kind of abstruse and has a notoriously steep learning curve, as it's mostly meant as a research testbed and as a playground for language geeks. ML/OCaml is by all

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Mark Lawrence
On 27/04/2012 00:57, Adam Skutt wrote: ...And Saint Adam Skutt raised the hand grenade up on high, saying, O LORD, bless this Thy hand grenade that with it Thou mayest blow Thine Id to tiny bits, in Thy mercy. And the LORD did grin and the people did feast upon the lambs and sloths and carp

John Carmack glorifying functional programing in 3k words

2012-04-26 Thread Xah Lee
John Carmack glorifying functional programing in 3k words http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/ where was he ten years ago? O, and btw, i heard that Common Lispers don't do functional programing, is that right? Fuck Common Lispers. Yeah, fuck them. One bunch of

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Steven D'Aprano
On Thu, 26 Apr 2012 17:16:10 -0700, Adam Skutt wrote: On Apr 26, 7:33 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote: I often wonder what the world would be like if Python, C#, and Java embraced value types more, and

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread OKB (not okblacke)
Adam Skutt wrote: If I write a function that does a value comparison, then it should do value comparison on _every type that can be passed to it_, regardless of whether the type is a primitive or an object, whether it has value or reference semantics, and regardless of how value comparison

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Devin Jeanpierre
On Thu, Apr 26, 2012 at 7:33 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote: I often wonder what the world would be like if Python, C#, and Java embraced value types more, and had better support for pure functions. They

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Chris Angelico
On Fri, Apr 27, 2012 at 12:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 26 Apr 2012 17:16:10 -0700, Adam Skutt wrote: On Apr 26, 7:33 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote: I often

[issue14671] isinstance(obj, object) returns True for _old style_ class instances

2012-04-26 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: This is a result of how old-style classes are implemented. If you look at type(Old()), you can see that it isn't Old, but instance. (And instance is a subclass of object again.) issubclass for old-style classes doesn't check type(o) but

[issue10976] json.loads() throws TypeError on bytes object

2012-04-26 Thread Balthazar Rouberol
Balthazar Rouberol roubero...@gmail.com added the comment: I know this does not fix anything at the core, but it would allow you to use json.loads() with python 3.2 (maybe 3.1?): Replace json.loads(raw_data) by raw_data = raw_data.decode('utf-8') # Or any other ISO format

[issue10976] json.loads() throws TypeError on bytes object

2012-04-26 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: What if the returned JSON uses a charset other than utf-8 ? According to RFC 4627: JSON text SHALL be encoded in Unicode. The default encoding is UTF-8. RFC 4627 also offers a way to autodetect other Unicode encodings. --

[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-04-26 Thread Larry Hastings
Larry Hastings la...@hastings.org added the comment: Anybody else? I guess I'm gonna jst miss Alpha 3, but if nobody has any other objections I'll check this in today (Thursday). If you want me to hold off just let me know. -- ___ Python

[issue14579] CVE-2012-2135: Vulnerability in the utf-16 decoder after error handling

2012-04-26 Thread STINNER Victor
STINNER Victor victor.stin...@gmail.com added the comment: I ran tests of utf16_error_handling-3.2_4.patch on Python 3.1. Two tests are failing: - b'\x00\xd8'.decode('utf-16le', 'replace')='\ufffd\ufffd' != '\ufffd' - b'\xd8\x00'.decode('utf-16be', 'replace')='\ufffd\ufffd' != '\ufffd' I

[issue13210] Support Visual Studio 2010

2012-04-26 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13210 ___ ___

[issue14579] CVE-2012-2135: Vulnerability in the utf-16 decoder after error handling

2012-04-26 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I ran tests of utf16_error_handling-3.2_4.patch on Python 3.1. Two tests are failing: - b'\x00\xd8'.decode('utf-16le', 'replace')='\ufffd\ufffd' != '\ufffd' - b'\xd8\x00'.decode('utf-16be', 'replace')='\ufffd\ufffd' != '\ufffd' I don't

[issue10976] json.loads() throws TypeError on bytes object

2012-04-26 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Well, adding support for bytes objects using the spec from RFC 4627 (or at least with utf-8 as a default) may be an enhancement for 3.3. -- assignee: docs@python - components: +Library (Lib) -Documentation stage: - needs patch type:

[issue14673] add sys.implementation

2012-04-26 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: If it can contain a variable number of fields, I think it should be a dict rather than a tuple. -- nosy: +ncoghlan, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14673

[issue10976] json.loads() throws TypeError on bytes object

2012-04-26 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: Things are a little more complicated. '123' is not a valid JSON according to RFC 4627 (the top-level element can only be an object or an array). This means that the autodetection algorithm will not always work for such non-standard data.

[issue14674] Add link to RFC 4627 from json documentation

2012-04-26 Thread Serhiy Storchaka
New submission from Serhiy Storchaka storch...@gmail.com: The json module documentation should give a link to RFC 4627 and explain the current implementation is different from it. For example, according to RFC 4627 only an object or an array can be top-level JSON element. -- assignee:

[issue10976] json.loads() throws TypeError on bytes object

2012-04-26 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Things are a little more complicated. '123' is not a valid JSON according to RFC 4627 (the top-level element can only be an object or an array). This means that the autodetection algorithm will not always work for such non-standard data. The

[issue14675] make distutils.ccompiler.CCompiler an abstract class

2012-04-26 Thread Ramchandra Apte
Changes by Ramchandra Apte maniandra...@gmail.com: -- assignee: - eric.araujo components: +Distutils nosy: +eric.araujo, tarek versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14675

[issue14675] make distutils.ccompiler.CCompiler an abstract class

2012-04-26 Thread Ramchandra Apte
New submission from Ramchandra Apte maniandra...@gmail.com: Make distutils.ccompiler.CCompiler an abstract class by making it inherit from abc.ABCMeta. Thanks -- messages: 159369 nosy: ramchandra.apte priority: normal severity: normal status: open title: make

[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-26 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 86dc014cdd74 by Jesus Cea in branch 'default': Close #10142: Support for SEEK_HOLE/SEEK_DATA http://hg.python.org/cpython/rev/86dc014cdd74 -- nosy: +python-dev resolution: - fixed stage: patch review -

[issue14675] make distutils.ccompiler.CCompiler an abstract class

2012-04-26 Thread Ramchandra Apte
Ramchandra Apte maniandra...@gmail.com added the comment: Sorry, distutils.ccompiler.CCompiler should have abc.ABCMeta as the metaclass. (for example like this) class CCompiler(metaclass = abc.ABCMeta): ... Thanks -- ___ Python tracker

  1   2   >