Re: NaN, Null, and Sorting

2012-01-13 Thread jmfauth
On 13 jan, 20:04, Ethan Furman wrote: > With NaN, it is possible to get a list that will not properly sort: > > --> NaN = float('nan') > --> spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] > --> sorted(spam) > [1, 2, nan, 3, nan, 4, 5, 7, nan] > > I'm constructing a Null object with the semantics that if

Interpreting Surface Weather Stations reports (FM 12–XIV SYNOP)

2012-01-13 Thread Richard Shea
Does anyone have some code which interprets Surface Weather Stations reports (formally termed 'FM 12–XIV SYNOP' reports) ? I've tried the cheese shop but no joy. I've seen PyMetar (http://schwarzvogel.de/software-pymetar.shtml) but I don't believe it covers this format. I can't believe I'm the fi

logging and httphandler

2012-01-13 Thread Jason Friedman
I am logging to my Apache web server, using this Apache format: LogFormat "%{%Y-%m-%d %H:%M:%S}t %U %q" scriptlog CustomLog /var/log/apache2/script.log scriptlog My code is as follows: #!/usr/bin/env python3 import logging, logging.handlers, sys logger = logging.getLogger('simple_example') logge

Re: NaN, Null, and Sorting

2012-01-13 Thread Steven D'Aprano
On Fri, 13 Jan 2012 11:04:48 -0800, Ethan Furman wrote: > With NaN, it is possible to get a list that will not properly sort: > > --> NaN = float('nan') > --> spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] --> sorted(spam) > [1, 2, nan, 3, nan, 4, 5, 7, nan] > > I'm constructing a Null object with the

Hash stability

2012-01-13 Thread Steven D'Aprano
On the Python Dev mailing list, there is a discussion going on about the stability of the hash function for strings. How many people rely on hash(some_string) being stable across Python versions? Does anyone have code that will be broken if the string hashing algorithm changes? -- Steven --

Re: ERROR:root:code for hash md5 was not found

2012-01-13 Thread Steven D'Aprano
On Fri, 13 Jan 2012 06:14:50 -0800, mike wrote: > On Jan 13, 5:41 am, alex23 wrote: >> On Jan 13, 1:34 pm, Steven D'Aprano > >> +comp.lang.pyt...@pearwood.info> wrote: >> > What is pysibelius? I can't find it on the web. Does it have anything >> > to do with Sibelius the music composition softwar

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Steven D'Aprano
On Fri, 13 Jan 2012 15:32:06 +, John Gordon wrote: > In <4f0fbad0$0$29984$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano > writes: > >> Why is it that only Linux and Mac users are accused of being "zealots"? > > Perhaps because Windows, being in a position of market dominance, > doesn'

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Terry Reedy
On 1/13/2012 3:42 PM, Noah Hall wrote: On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazi wrote: dear people! I have just opened my MTU client, and figured out that through my comment, i caused a complete NONSENSE discussion at all. 1. I am not a zealot or whatever. I code on Linux and port it on

Re: copy on write

2012-01-13 Thread Evan Driscoll
On 01/13/2012 03:20 PM, Neil Cerutti wrote: They perform the same action, but their semantics are different. operator+ will always return a new object, thanks to its signature, and operator+= shall never do so. That's the main difference I was getting at. I was talking about the combination of

Re: copy on write

2012-01-13 Thread 88888 Dihedral
Ethan Furman於 2012年1月14日星期六UTC+8上午2時40分47秒寫道: > Steven D'Aprano wrote: > > Normally this is harmless, but there is one interesting little glitch you > > can get: > > > t = ('a', [23]) > t[1] += [42] > > Traceback (most recent call last): > > File "", line 1, in > > TypeError: 'tuple'

Re: Problem filling an html form

2012-01-13 Thread Νικόλαος Κούρας
On 13 Ιαν, 23:13, MRAB wrote: > On 13/01/2012 20:16, Νικόλαος Κούρας wrote: > > > > > > > > > > > On 13 Ιαν, 21:35, MRAB  wrote: > >>  On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote: > > >>  >  # get some enviromental values > >>  >  form = cgi.FieldStorage() > >>  >  mail = form.getvalue('mail') or '

Re: copy on write

2012-01-13 Thread Neil Cerutti
On 2012-01-13, Evan Driscoll wrote: > On 01/13/2012 10:54 AM, Neil Cerutti wrote: >> If you've ever implemented operator=, operator+, and operator+= >> in C++ you'll know how and why they are different. > > At the same time, you'd also know that that implementing them > in such a way that 'a += b'

Re: open office in another language?

2012-01-13 Thread Ben Finney
Dotan Cohen writes: > On Wed, Jan 11, 2012 at 00:17, Sean Wolfe wrote: > > hmm I didn't know this, nice to know. Yes, C++ is still enough > > overhead that I wouldn't want to try extending it ... I bet the code > > is a whole lot to try and grok. > > > > When Apache got the LibreOffice project t

Re: Problem filling an html form

2012-01-13 Thread MRAB
On 13/01/2012 20:16, Νικόλαος Κούρας wrote: On 13 Ιαν, 21:35, MRAB wrote: On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote: > # get some enviromental values > form = cgi.FieldStorage() > mail = form.getvalue('mail') or '' > comment = form.getvalue('comment') or '' > # insert guest co

Re: NaN, Null, and Sorting

2012-01-13 Thread MRAB
On 13/01/2012 19:58, Chris Angelico wrote: On Sat, Jan 14, 2012 at 6:04 AM, Ethan Furman wrote: So I am strongly leaning towards implementing the comparisons such that Null objects are less than other objects so they will always sort together. This is a perfectly plausible view, and is the

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Noah Hall
On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazi wrote: > dear people! > I have just opened my MTU client, and figured out that through my > comment, i caused a complete NONSENSE discussion at all. > > > 1. I am not a zealot or whatever. I code on Linux and port it on MAC and > WINDOWS. I do write so

understanding a program project

2012-01-13 Thread Tracubik
Hi all, i hope not to be too much OT with this request. I'ld like to modify/contribute some open source in python, but first i've to read and understand the code. So, is there some guide lines / procedure to follow to help me in this process. I remember at school time there was some schema or som

Re: copy on write

2012-01-13 Thread Evan Driscoll
On 01/13/2012 10:54 AM, Neil Cerutti wrote: If you've ever implemented operator=, operator+, and operator+= in C++ you'll know how and why they are different. At the same time, you'd also know that that implementing them in such a way that 'a += b' does *not* perform the same action as 'a = a

Re: Problem filling an html form

2012-01-13 Thread Νικόλαος Κούρας
On 13 Ιαν, 21:35, MRAB wrote: > On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote: > > > # get some enviromental values > > form = cgi.FieldStorage() > > mail = form.getvalue('mail') or '' > > comment = form.getvalue('comment') or '' > > >    # insert guest comments into database if form was submitted >

Re: copy on write

2012-01-13 Thread Neil Cerutti
On 2012-01-13, Grant Edwards wrote: > On 2012-01-13, Chris Angelico wrote: >> On Sat, Jan 14, 2012 at 5:15 AM, Grant Edwards >> wrote: >>> That assumes that C++ programmers understand C++. >> >> I understand C++ very well. That's why I use Python or Pike. >> >> (With apologies to Larry Wall) > >

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Tamer Higazi
dear people! I have just opened my MTU client, and figured out that through my comment, i caused a complete NONSENSE discussion at all. 1. I am not a zealot or whatever. I code on Linux and port it on MAC and WINDOWS. I do write solutions for customers across the whole 3 platform, and mostly I su

Re: NaN, Null, and Sorting

2012-01-13 Thread Chris Angelico
On Sat, Jan 14, 2012 at 6:04 AM, Ethan Furman wrote: > So I am strongly leaning towards implementing the comparisons such that Null > objects are less than other objects so they will always sort together. This is a perfectly plausible view, and is the one adopted by SQL (I'm pretty sure the "NULL

NaN, Null, and Sorting

2012-01-13 Thread Ethan Furman
With NaN, it is possible to get a list that will not properly sort: --> NaN = float('nan') --> spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] --> sorted(spam) [1, 2, nan, 3, nan, 4, 5, 7, nan] I'm constructing a Null object with the semantics that if the returned object is Null, it's actual value is

Re: copy on write

2012-01-13 Thread Ethan Furman
Steven D'Aprano wrote: Normally this is harmless, but there is one interesting little glitch you can get: t = ('a', [23]) t[1] += [42] Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment t ('a', [23, 42]) There is one other

Re: Problem filling an html form

2012-01-13 Thread MRAB
On 13/01/2012 17:02, Νικόλαος Κούρας wrote: # get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in ("Ρωτήστε

Re: copy on write

2012-01-13 Thread Grant Edwards
On 2012-01-13, Chris Angelico wrote: > On Sat, Jan 14, 2012 at 5:15 AM, Grant Edwards > wrote: >> That assumes that C++ programmers understand C++. > > I understand C++ very well. That's why I use Python or Pike. > > (With apologies to Larry Wall) Were one inclined to troll a bit, one might be

Re: copy on write

2012-01-13 Thread Chris Angelico
On Sat, Jan 14, 2012 at 5:15 AM, Grant Edwards wrote: > That assumes that C++ programmers understand C++. I understand C++ very well. That's why I use Python or Pike. (With apologies to Larry Wall) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: copy on write

2012-01-13 Thread Grant Edwards
On 2012-01-13, Neil Cerutti wrote: > If you've ever implemented operator=, operator+, and operator+= > in C++ you'll know how and why they are different. That assumes that C++ programmers understand C++. ;) > A C++ programmer would be wondering how either can work on immutable > objects, and t

Re: python philosophical question - strong vs duck typing

2012-01-13 Thread John Nagle
On 1/9/2012 2:45 AM, Robert Kern wrote: On 1/9/12 5:35 AM, John Nagle wrote: Python has some serious problems that preclude optimization. Basically, the language is designed to be run by a naive (non-optimizing) interpreter, and allows things that are easy for such an implementation but very to

Re: open office in another language?

2012-01-13 Thread Stefan Behnel
Wolfgang Keller, 13.01.2012 17:22: >> I'm a somewhat-satisfied openoffice.org user. I mean it works, but if >> it weren't in Java I'd be doing some of my own tweaking. But since >> it's in Java I stay away... no likey. > > OpenOffice (now LibreOffice, btw.) is not implemented in Java, if that's >

Re: ERROR:root:code for hash md5 was not found

2012-01-13 Thread Michael Torrie
On 01/13/2012 07:14 AM, mike wrote: > pysibelius is a lib that we use. > > I am not sure that is the problem since the python program works on > SuSE but not on RH server. And AFAIK > the only difference ( well that I can see) is the OpenSSL version. > > According to code it uses openssl: > > >

Problem filling an html form

2012-01-13 Thread Νικόλαος Κούρας
# get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in ("Ρωτήστε με σχετικά..."): try:

Re: copy on write

2012-01-13 Thread Neil Cerutti
On 2012-01-13, Devin Jeanpierre wrote: > On Fri, Jan 13, 2012 at 10:13 AM, Grant Edwards > wrote: >> On 2012-01-13, Devin Jeanpierre wrote: >>> On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico wrote: It seems there's a distinct difference between a+=b (in-place addition/concatenation)

Re: open office in another language?

2012-01-13 Thread Dotan Cohen
On Fri, Jan 13, 2012 at 18:46, Nelle Varoquaux > Once again, a nitpick. Apache did not get the LibreOffice project, but the > Openoffice.org project from Oracle. LibreOffice is a fork of openoffice and > a foundation independant from Apache. Work has been done to simplify the > code, but I wouldn't

Re: copy on write

2012-01-13 Thread Devin Jeanpierre
On Fri, Jan 13, 2012 at 10:13 AM, Grant Edwards wrote: > On 2012-01-13, Devin Jeanpierre wrote: >> On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico wrote: >>> It seems there's a distinct difference between a+=b (in-place >>> addition/concatenation) and a=a+b (always rebinding), which is sorely >>

Re: open office in another language?

2012-01-13 Thread Nelle Varoquaux
On 13 January 2012 17:39, Dotan Cohen wrote: > On Wed, Jan 11, 2012 at 00:17, Sean Wolfe wrote: > > hmm I didn't know this, nice to know. Yes, C++ is still enough > > overhead that I wouldn't want to try extending it ... I bet the code > > is a whole lot to try and grok. > > > > When Apache got

Re: open office in another language?

2012-01-13 Thread Dotan Cohen
On Wed, Jan 11, 2012 at 00:17, Sean Wolfe wrote: > hmm I didn't know this, nice to know. Yes, C++ is still enough > overhead that I wouldn't want to try extending it ... I bet the code > is a whole lot to try and grok. > When Apache got the LibreOffice project they heavily refactored the code. As

Re: open office in another language?

2012-01-13 Thread Wolfgang Keller
> I'm a somewhat-satisfied openoffice.org user. I mean it works, but if > it weren't in Java I'd be doing some of my own tweaking. But since > it's in Java I stay away... no likey. OpenOffice (now LibreOffice, btw.) is not implemented in Java, if that's what you mean. It _is_ scriptable in Python

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread John Gordon
In <4f0fbad0$0$29984$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano writes: > Why is it that only Linux and Mac users are accused of being "zealots"? Perhaps because Windows, being in a position of market dominance, doesn't *need* zealots. -- John Gordon A is for Amy,

Re: copy on write

2012-01-13 Thread Grant Edwards
On 2012-01-13, Devin Jeanpierre wrote: > On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico wrote: >> It seems there's a distinct difference between a+=b (in-place >> addition/concatenation) and a=a+b (always rebinding), which is sorely >> confusing to C programmers. But then, there's a lot about Py

Re: Reading and writing to a file creates null characters

2012-01-13 Thread Denhua
On Jan 12, 6:21 pm, MRAB wrote: > On 12/01/2012 22:26, Denhua wrote: > > > > > > > > > Hi, > > > I've got a file which I'd like to read, modify and write. > > > # file contents > > a > > b > > c > > d > > > My script reads the file contents into a list and rotates the list and > > writes it back t

Re: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)

2012-01-13 Thread Nathan Rice
On Fri, Jan 13, 2012 at 8:45 AM, Devin Jeanpierre wrote: > On Thu, Jan 12, 2012 at 3:45 PM, Nathan Rice > wrote: >> I'm interested in fixing both issues. I believe both issues I've had >> could be solved by having a robust "symbolic object".  These objects >> would basically usable like ordinary

Re: ERROR:root:code for hash md5 was not found

2012-01-13 Thread mike
On Jan 13, 5:41 am, alex23 wrote: > On Jan 13, 1:34 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > > What is pysibelius? I can't find it on the web. Does it have anything to > > do with Sibelius the music composition software? > > Yes, please provide more information about the py

Re: copy on write

2012-01-13 Thread Devin Jeanpierre
On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico wrote: > It seems there's a distinct difference between a+=b (in-place > addition/concatenation) and a=a+b (always rebinding), which is sorely > confusing to C programmers. But then, there's a lot about Python > that's sorely confusing to C programme

Re: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)

2012-01-13 Thread Devin Jeanpierre
On Thu, Jan 12, 2012 at 3:45 PM, Nathan Rice wrote: > I'm interested in fixing both issues. I believe both issues I've had > could be solved by having a robust "symbolic object". These objects > would basically usable like ordinary objects, however upon any > attribute access or other form of int

Re: copy on write

2012-01-13 Thread Steven D'Aprano
On Fri, 13 Jan 2012 23:30:56 +1100, Chris Angelico wrote: > It seems there's a distinct difference between a+=b (in-place > addition/concatenation) and a=a+b (always rebinding), Actually, both are always rebinding. It just happens that sometimes a+=b rebinds to the same object that it was origi

Re: copy on write

2012-01-13 Thread Chris Angelico
On Fri, Jan 13, 2012 at 11:10 PM, Steven D'Aprano wrote: z = [x, y]  # z is a list containing the same sublist twice z[0].append(23) print z > [[42, 23], [42, 23]] > > When you work with floats, ints or strings, you don't notice this because > those types are immutable: you can't mo

Re: copy on write

2012-01-13 Thread Steven D'Aprano
On Fri, 13 Jan 2012 11:33:24 +, Eduardo Suarez-Santana wrote: > I wonder whether this is normal behaviour. > > I would expect equal sign to copy values from right to left. Assignment in Python never copies values. > However, it > seems there is a copy-on-write mechanism that is not working

Re: Zealotry

2012-01-13 Thread Jean-Michel Pichavant
Chris Angelico wrote: On Fri, Jan 13, 2012 at 9:34 PM, Jean-Michel Pichavant wrote: Recommending an OS to solve one python package installation is zealotry. At least, advise to use a virtual machine software to try it out, there are some VM softwares for free working with windows. If

Re: copy on write

2012-01-13 Thread Jean-Michel Pichavant
Eduardo Suarez-Santana wrote: El 13/01/12 11:33, Eduardo Suarez-Santana escribió: I wonder whether this is normal behaviour. Even simpler: $ python Python 2.7.2 (default, Oct 31 2011, 11:54:55) [GCC 4.5.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> r=

copy on write

2012-01-13 Thread Eduardo Suarez-Santana
I wonder whether this is normal behaviour. I would expect equal sign to copy values from right to left. However, it seems there is a copy-on-write mechanism that is not working. Anyone can explain and provide a working example? Thanks, -Eduardo $ python Python 2.7.2 (default, Oct 31 2011, 11

Re: copy on write

2012-01-13 Thread Eduardo Suarez-Santana
El 13/01/12 11:33, Eduardo Suarez-Santana escribió: I wonder whether this is normal behaviour. Even simpler: $ python Python 2.7.2 (default, Oct 31 2011, 11:54:55) [GCC 4.5.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> r={'a':1}; >>> d={}; >>> d['x']=r

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Steven D'Aprano
On Thu, 12 Jan 2012 21:41:29 -0800, alex23 wrote: > On Jan 13, 3:02 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> Why is it that only Linux and Mac users are accused of being "zealots"? > > Oh please. Don't tar me with the Windows brush. I'd have used the same > term no matter w

Re: Zealotry

2012-01-13 Thread Chris Angelico
On Fri, Jan 13, 2012 at 9:34 PM, Jean-Michel Pichavant wrote: > Recommending an OS to solve one python package installation is zealotry. At > least, advise to use a virtual machine software to try it out, there are > some VM softwares for free working with windows. If I recommend Python to someon

Re: Zealotry

2012-01-13 Thread Jean-Michel Pichavant
Ben Finney wrote: Steven D'Aprano writes: On Thu, 12 Jan 2012 18:50:13 -0800, alex23 wrote: Tamer Higazi wrote: So, instead of making yourself continuously headache for an outdated OS I advise [...] Please don't recommend people use another OS when they ask an expl

Re: Zealotry [was Re: how to install lxml in window xp?] (OT)

2012-01-13 Thread Noah Hall
On Fri, Jan 13, 2012 at 7:54 AM, Stefan Behnel wrote: > Noah Hall, 13.01.2012 08:29: >> I'M SO COOL >> USE MY HARDCORE GENTOO INSTALL THAT TOOK 36 HOURS AND SHAVED 2 SECONDS >> OFF MY BOOTUP TIME > > Just an off-topic thing that your comment above reminded me of: has anyone > ever noticed that the

Re: Zealotry [was Re: how to install lxml in window xp?] (OT)

2012-01-13 Thread Stefan Behnel
Noah Hall, 13.01.2012 08:29: > I'M SO COOL > USE MY HARDCORE GENTOO INSTALL THAT TOOK 36 HOURS AND SHAVED 2 SECONDS > OFF MY BOOTUP TIME Just an off-topic thing that your comment above reminded me of: has anyone ever noticed that there are even quick install guides for Gentoo Linux? I think that'

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Chris Angelico
On Fri, Jan 13, 2012 at 4:41 PM, alex23 wrote: > Oh please. Don't tar me with the Windows brush. Wouldn't the Windows brush zip you instead? ChrisA definitely ready for the weekend now -- http://mail.python.org/mailman/listinfo/python-list