Re: wtf

2007-04-26 Thread Shane Hathaway
Sergiy wrote: > print 1 / 2 > print -1 / 2 > > 0 > -1 > > correct? Yes. It works like the floor() function. >>> import math >>> math.floor(1.0 / 2) 0.0 >>> math.floor(-1.0 / 2) -1.0 Shane -- http://mail.python.org/mailman/listinfo/python-list

Re: wtf

2007-04-26 Thread Jean-Paul Calderone
On Thu, 26 Apr 2007 21:35:03 +0300, Sergiy <[EMAIL PROTECTED]> wrote: >print 1 / 2 >print -1 / 2 > >0 >-1 > >correct? Quoting http://www.python.org/doc/lib/typesnumeric.html: (1) For (plain or long) integer division, the result is an integer. The result is always rounded towards minus infin

Re: WTF? Printing unicode strings

2006-05-21 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > Learn something every day. I take it "646" is an alias for "ascii" (or vice > versa)? Usage of "646" as an alias for ASCII is primarily a Sun invention. When ASCII became an international standard, its standard number became ISO/IEC 646:1968. It's not *quite* the same a

Re: WTF? Printing unicode strings

2006-05-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Serge Orlov wrote: > > Ron Garret wrote: > > > In article <[EMAIL PROTECTED]>, > > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > > > > > Ron Garret wrote: > > > > > > > I'm using an OS X terminal to ssh to a Linux mach

Re: WTF? Printing unicode strings

2006-05-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > > > Ron Garret wrote: > > > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > > > > > In theor

Re: WTF? Printing unicode strings

2006-05-19 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Robert> Because sys.stdout.encoding isn't determined by your Python > Robert> configuration, but your terminal's. > > Learn something every day. I take it "646" is an alias for "ascii" (or vice > versa)? > > % python > Python 2.4.2 (#1, Feb 23 2006, 12:

Re: WTF? Printing unicode strings

2006-05-19 Thread John Salerno
[EMAIL PROTECTED] wrote: > John> Hmm, not that this helps me any :) > > import sys > sys.stdout.encoding > John> 'cp1252' > > Sure it does. You can print Unicode objects which map to cp1252. I assume > that means you're on Windows or that for some perverse reason you h

Re: WTF? Printing unicode strings

2006-05-19 Thread skip
John> Hmm, not that this helps me any :) import sys sys.stdout.encoding John> 'cp1252' Sure it does. You can print Unicode objects which map to cp1252. I assume that means you're on Windows or that for some perverse reason you have your Mac's Terminal window set to cp

Re: WTF? Printing unicode strings

2006-05-19 Thread John Salerno
[EMAIL PROTECTED] wrote: > Robert> Because sys.stdout.encoding isn't determined by your Python > Robert> configuration, but your terminal's. > > Learn something every day. I take it "646" is an alias for "ascii" (or vice > versa)? Hmm, not that this helps me any :) >>> import sys >>>

Re: WTF? Printing unicode strings

2006-05-19 Thread skip
Robert> Because sys.stdout.encoding isn't determined by your Python Robert> configuration, but your terminal's. Learn something every day. I take it "646" is an alias for "ascii" (or vice versa)? % python Python 2.4.2 (#1, Feb 23 2006, 12:48:31) [GCC 3.4.1] on sunos5 Typ

Re: WTF? Printing unicode strings

2006-05-19 Thread Robert Kern
John Salerno wrote: > AFAIK, I'm all ASCII (at least, I never made explicit changes to the > default Python install), so how am I able to print out the character? Because sys.stdout.encoding isn't determined by your Python configuration, but your terminal's. -- Robert Kern "I have come to bel

Re: WTF? Printing unicode strings

2006-05-19 Thread John Salerno
Fredrik Lundh wrote: > Ron Garret wrote: > > u'\xbd' >> u'\xbd' > print _ >> Traceback (most recent call last): >> File "", line 1, in ? >> UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in >> position 0: ordinal not in range(128) > > so stdout on your machine is asci

Re: WTF? Printing unicode strings

2006-05-19 Thread Laurent Pointal
Ron Garret a écrit : > In article <[EMAIL PROTECTED]>, > Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >> Ron Garret wrote: >> >> u'\xbd' >>> u'\xbd' >> print _ >>> Traceback (most recent call last): >>> File "", line 1, in ? >>> UnicodeEncodeError: 'ascii' codec can't encode character u'\

Re: WTF? Printing unicode strings

2006-05-19 Thread Serge Orlov
Serge Orlov wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > > > Ron Garret wrote: > > > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > > > > > In theory it should work out of the box. OS X terminal should se

Re: WTF? Printing unicode strings

2006-05-19 Thread Serge Orlov
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > Ron Garret wrote: > > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > > > In theory it should work out of the box. OS X terminal should set > > > > enviromental variable LAN

Re: WTF? Printing unicode strings

2006-05-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > In theory it should work out of the box. OS X terminal should set > > > enviromental variable LANG=en_US.utf-8, then ssh should tr

Re: WTF? Printing unicode strings

2006-05-18 Thread Serge Orlov
Ron Garret wrote: > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > In theory it should work out of the box. OS X terminal should set > > enviromental variable LANG=en_US.utf-8, then ssh should transfer this > > variable to Linux and python will know that your terminal is utf-8. >

Re: WTF? Printing unicode strings

2006-05-18 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > > > Ron Garret wrote: > > > > In article <[EMAIL PROTECTED]>, > > > > Robert Kern <[EMAIL PROTECTED]> wrote: > > >

Re: WTF? Printing unicode strings

2006-05-18 Thread Robert Kern
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > Robert Kern <[EMAIL PROTECTED]> wrote: > >>Ron Garret wrote: >> >>>I'm using an OS X terminal to ssh to a Linux machine. >> >>Click on the "Terminal" menu, then "Window Settings...". Choose "Display" >>from >>the combobox. At the bottom you w

Re: WTF? Printing unicode strings

2006-05-18 Thread Serge Orlov
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > Ron Garret wrote: > > > In article <[EMAIL PROTECTED]>, > > > Robert Kern <[EMAIL PROTECTED]> wrote: > > > > > > > Ron Garret wrote: > > > > > > > > > I forgot to mention: > > > > > > > > > sy

Re: WTF? Printing unicode strings

2006-05-18 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > I'm using an OS X terminal to ssh to a Linux machine. > > Click on the "Terminal" menu, then "Window Settings...". Choose "Display" > from > the combobox. At the bottom you will see a combobox titl

Re: WTF? Printing unicode strings

2006-05-18 Thread Paul Boddie
Ron Garret wrote: > > But what about this: > > >>> f2=open('foo','w') > >>> f2.write(u'\xFF') > Traceback (most recent call last): > File "", line 1, in ? > UnicodeEncodeError: 'ascii' codec can't encode character u'\xff' in > position 0: ordinal not in range(128) > >>> > > That should have nothi

Re: WTF? Printing unicode strings

2006-05-18 Thread Robert Kern
Ron Garret wrote: > I'm using an OS X terminal to ssh to a Linux machine. Click on the "Terminal" menu, then "Window Settings...". Choose "Display" from the combobox. At the bottom you will see a combobox title "Character Set Encoding". Choose "Unicode (UTF-8)". > But what about this: > f2=

Re: WTF? Printing unicode strings

2006-05-18 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Robert Kern <[EMAIL PROTECTED]> wrote: > > > > > Ron Garret wrote: > > > > > > > I forgot to mention: > > > > > > > sys.getdefaultencoding() > > > > > > > > 'u

Re: WTF? Printing unicode strings

2006-05-18 Thread Serge Orlov
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > Robert Kern <[EMAIL PROTECTED]> wrote: > > > Ron Garret wrote: > > > > > I forgot to mention: > > > > > sys.getdefaultencoding() > > > > > > 'utf-8' > > > > A) You shouldn't be able to do that. > > What can I say? I can. > > > B) Don't do

Re: WTF? Printing unicode strings

2006-05-18 Thread Robert Kern
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > Robert Kern <[EMAIL PROTECTED]> wrote: > >>Ron Garret wrote: >> >>>I forgot to mention: >>> >>> >>sys.getdefaultencoding() >>> >>>'utf-8' >> >>A) You shouldn't be able to do that. > > What can I say? I can. See B). >>B) Don't do that.

Re: WTF? Printing unicode strings

2006-05-18 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > I forgot to mention: > > > sys.getdefaultencoding() > > > > 'utf-8' > > A) You shouldn't be able to do that. What can I say? I can. > B) Don't do that. OK. What should I do instead? > C)

Re: WTF? Printing unicode strings

2006-05-18 Thread Robert Kern
Ron Garret wrote: > I forgot to mention: > sys.getdefaultencoding() > > 'utf-8' A) You shouldn't be able to do that. B) Don't do that. C) It's not relevant to the encoding of stdout which determines how unicode strings get converted to bytes when printing them: >>> import sys >>> sys.stdou

Re: WTF? Printing unicode strings

2006-05-18 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > u'\xbd' > > u'\xbd' > print _ > > Traceback (most recent call last): > > File "", line 1, in ? > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in > > position 0: ord

Re: WTF? Printing unicode strings

2006-05-18 Thread Fredrik Lundh
Ron Garret wrote: u'\xbd' > u'\xbd' print _ > Traceback (most recent call last): > File "", line 1, in ? > UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in > position 0: ordinal not in range(128) so stdout on your machine is ascii, and you don't understand why you

Re: WTF? Printing unicode strings

2006-05-18 Thread John Salerno
Ron Garret wrote: u'\xbd' > u'\xbd' print _ > Traceback (most recent call last): > File "", line 1, in ? > UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in > position 0: ordinal not in range(128) Not sure if this really helps you, but: >>> u'\xbd' u'\xbd' >>> pri

Re: WTF?

2005-11-02 Thread Alan Kennedy
[James Stroud] > Why do my posts get held for suspcious headers You're probably trying to post through the python-list email address, which has had SPAM problems in the past, because the email address has been used by spammers as a forged from address, meaning the bounces would go to everyone,

Re: WTF?

2005-11-01 Thread Jim Benson
On Tue, 1 Nov 2005, James Stroud wrote: > Why do my posts get held for suspcious headers and troll Xha Lee gets to post > all sorts of profanity and ranting without any problem? > I like many others have had the same experience. I recently choose to respond to one of Xha Lee's post and my Re (

Re: WTF?

2005-11-01 Thread Grant Edwards
On 2005-11-01, James Stroud <[EMAIL PROTECTED]> wrote: > On Tuesday 01 November 2005 14:26, Grant Edwards wrote: >> On 2005-11-01, James Stroud <[EMAIL PROTECTED]> wrote: >> > Why do my posts get held for suspcious headers > ... >> Held? It's not a moderated group... > > And I quoteth (that's King

Re: WTF?

2005-11-01 Thread Ed Hotchkiss
happens to me too. -- http://mail.python.org/mailman/listinfo/python-list

Re: WTF?

2005-11-01 Thread James Stroud
On Tuesday 01 November 2005 14:26, Grant Edwards wrote: > On 2005-11-01, James Stroud <[EMAIL PROTECTED]> wrote: > > Why do my posts get held for suspcious headers ... > Held? It's not a moderated group... And I quoteth (that's King James for "cuteth-and-pasteth"): > Your mail to 'Python-list' w

Re: WTF?

2005-11-01 Thread Grant Edwards
On 2005-11-01, James Stroud <[EMAIL PROTECTED]> wrote: > Why do my posts get held for suspcious headers and troll Xha > Lee gets to post all sorts of profanity and ranting without > any problem? Held? It's not a moderated group... -- Grant Edwards grante Yow! I'm

Re: WTF?

2005-11-01 Thread Ivan Shevanski
On 11/1/05, James Stroud <[EMAIL PROTECTED]> wrote: Why do my posts get held for suspcious headers and troll Xha Lee gets to postall sorts of profanity and ranting without any problem?--James StroudUCLA-DOE Institute for Genomics and ProteomicsBox 951570 Los Angeles, CA 90095http://www.jamesstroud.