RedNotebook 1.6.1

2012-11-12 Thread Jendrik Seipp
A new RedNotebook version has been released. You can get the tarball, Windows installer and links to distribution packages at http://rednotebook.sourceforge.net/downloads.html What is RedNotebook? RedNotebook is a **graphical journal** and diary helping you keep track of

Re: duck typing assert

2012-11-12 Thread Ian Kelly
On Fri, Nov 9, 2012 at 6:36 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: (I think... I really don't actually know if Zooey Deschanel can sing or not. Just go along with the example.) Not only does she sing, she's in a band. http://en.wikipedia.org/wiki/She_%26_Him I take

Re: skip Trackback error for ftp checking

2012-11-12 Thread moonhkt
On Nov 10, 2:50 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Fri, 09 Nov 2012 20:51:47 -0800, moonhkt wrote: HI All How to skip Trackback warning/error when input ftp address is not correct or reject ? The same way you would skip any other error when you do

Fwd: error

2012-11-12 Thread inshu chauhan
No answers for my question ?? :O -- http://mail.python.org/mailman/listinfo/python-list

Re: logging, can one get it to email messages over a certain level?

2012-11-12 Thread tinnews
Steve Howell showel...@yahoo.com wrote: On Nov 11, 9:48 am, tinn...@isbd.co.uk wrote: I'm sure this must be possible but at the moment I can't see how to do it. I want to send an E-Mail when the logging module logs a message above a certain level (probably for ERROR and CRITICAL messages

Re: skip Trackback error for ftp checking

2012-11-12 Thread Chris Angelico
On Mon, Nov 12, 2012 at 8:25 PM, moonhkt moon...@gmail.com wrote: On Nov 10, 2:50 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: The same way you would skip any other error when you do something wrong: catch the exception. Thank. Added below. try: ftp =

Is there a way to creat a func that returns a cursor that can be used?

2012-11-12 Thread Khalid Al-Ghamdi
Is there a way to create a func that returns a cursor that can be used to execute sql statements? I tried this (after importing sqlite3), but it gave me the error below: def connect(): conn = sqlite3.connect(':memory:')#use sch3.db or sch4.db etc. cur = conn.cursor()

Re: logging, can one get it to email messages over a certain level?

2012-11-12 Thread Peter Otten
tinn...@isbd.co.uk wrote: Steve Howell showel...@yahoo.com wrote: On Nov 11, 9:48 am, tinn...@isbd.co.uk wrote: I'm sure this must be possible but at the moment I can't see how to do it. I want to send an E-Mail when the logging module logs a message above a certain level (probably

Re: Is there a way to creat a func that returns a cursor that can be used?

2012-11-12 Thread Peter Otten
Khalid Al-Ghamdi wrote: Is there a way to create a func that returns a cursor that can be used to execute sql statements? You should read an introductory text on Python, this is not specific to sqlite3. I tried this (after importing sqlite3), but it gave me the error below: def

Re: Is there a way to creat a func that returns a cursor that can be used?

2012-11-12 Thread Chris Angelico
On Mon, Nov 12, 2012 at 9:45 PM, Khalid Al-Ghamdi emailkg...@gmail.com wrote: Is there a way to create a func that returns a cursor that can be used to execute sql statements? Yes, and you're almost there! I tried this (after importing sqlite3), but it gave me the error below: def

Re: List comprehension for testing **params

2012-11-12 Thread Ulrich Eckhardt
Am 11.11.2012 23:24, schrieb Cantabile: I'm writing a small mail library for my own use, and at the time I'm testing parameters like this: Let's ignore the facts that there is an existing mail library, that you should use real parameters if they are required and that exit() is completely

Re: logging, can one get it to email messages over a certain level?

2012-11-12 Thread tinnews
Peter Otten __pete...@web.de wrote: tinn...@isbd.co.uk wrote: Steve Howell showel...@yahoo.com wrote: On Nov 11, 9:48 am, tinn...@isbd.co.uk wrote: I'm sure this must be possible but at the moment I can't see how to do it. I want to send an E-Mail when the logging module logs a

Re: Is there a way to creat a func that returns a cursor that can be used?

2012-11-12 Thread Joel Goldstick
On Mon, Nov 12, 2012 at 6:01 AM, Chris Angelico ros...@gmail.com wrote: On Mon, Nov 12, 2012 at 9:45 PM, Khalid Al-Ghamdi emailkg...@gmail.com wrote: Is there a way to create a func that returns a cursor that can be used to execute sql statements? Yes, and you're almost there! I tried

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
Hi Hans thanks a lot for your reply: That's what 'xargs' will do for you.  All you need to do, is invoke xargs with arguments containing '{}'.  I.e., something like: cmd1 = ['tar', '-czvf', 'myfile.tgz', '-c', mydir, 'mysubdir'] first_process = subprocess.Popen(cmd1,

Strange object identity problem

2012-11-12 Thread F.R.
Hi all, Once in a while I write simple routine stuff and spend the next few hours trying to understand why it doesn't behave as I expect. Here is an example holding me up: I have a module st with a class runs. In a loop I repeatedly create an object ba and call the method ba.run () which

Re: List comprehension for testing **params

2012-11-12 Thread Joshua Landau
Just a few tricks you may have missed: On 12 November 2012 10:48, Ulrich Eckhardt ulrich.eckha...@dominolaser.comwrote: Am 11.11.2012 23:24, schrieb Cantabile: if required.intersection(params.**keys()) != required: if required.issubset(params): missing = required -

Re: Strange object identity problem

2012-11-12 Thread Robert Franke
Hi Frederic, [...] bas = {} for year in range (2010, 2013): ba = st.runs ('BA', '%d-01-01' % year, '%d-12-31' % year) ba.run () print year, id (ba) bas [year] = ba 2010 150289932 2011 150835852 2012 149727788 for y in sorted (bas.keys ()): b = bas [year] Shouldn't

Re: List comprehension for testing **params

2012-11-12 Thread Joshua Landau
On 12 November 2012 13:23, Joshua Landau joshua.landau...@gmail.com wrote: Just a few tricks you may have missed: On 12 November 2012 10:48, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: Am 11.11.2012 23:24, schrieb Cantabile: if required.intersection(params.**keys()) !=

Re: Strange object identity problem

2012-11-12 Thread F.R.
On 11/12/2012 02:27 PM, Robert Franke wrote: Hi Frederic, [...] bas = {} for year in range (2010, 2013): ba = st.runs ('BA', '%d-01-01' % year, '%d-12-31' % year) ba.run () print year, id (ba) bas [year] = ba 2010 150289932 2011 150835852 2012 149727788 for y in sorted

Re: Strange object identity problem

2012-11-12 Thread Ulrich Eckhardt
Am 12.11.2012 14:12, schrieb F.R.: Once in a while I write simple routine stuff and spend the next few hours trying to understand why it doesn't behave as I expect. Here is an example holding me up: [...snip incomplete code...] Trying something similar with a simpler class works as expected:

Re: int.__init__ incompatible in Python 3.3

2012-11-12 Thread Ulrich Eckhardt
Am 09.11.2012 12:37, schrieb Steven D'Aprano: In Python 3.3: py class X(int): ... def __init__(self, *args): ... super().__init__(*args) # does nothing, call it anyway ... py x = X(22) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 3, in

Re: error

2012-11-12 Thread Dave Angel
On 11/09/2012 09:08 AM, inshu chauhan wrote: Actually this one.. and its the last.. snip The only extra libary i am using is Opencv , downloaded from http://sourceforge.net/projects/opencvlibrary/ and numpy. 3) what import statement did you use ? import cv snip 5) Exactly what

Re: A gnarly little python loop

2012-11-12 Thread rusi
On Nov 12, 12:09 pm, rusi rustompm...@gmail.com wrote: This is a classic problem -- structure clash of parallel loops rest snipped Sorry wrong solution :D The fidgetiness is entirely due to python not allowing C-style loops like these: while ((c=getchar()!= EOF) { ... } Putting it into

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
slight followup ... I have made some progress; for now I'm using subprocess.communicate to read the output from the first subprocess, then writing it into the secodn subprocess. This way I at least get to see what is happening ... The reason 'we' weren't seeing any output from the second call

Re: A gnarly little python loop

2012-11-12 Thread Peter Otten
rusi wrote: The fidgetiness is entirely due to python not allowing C-style loops like these: while ((c=getchar()!= EOF) { ... } for c in iter(getchar, EOF): ... Clearly the fidgetiness is there as before and now with extra coroutine plumbing Hmm, very funny... --

Re: A gnarly little python loop

2012-11-12 Thread Steve Howell
On Nov 12, 7:21 am, rusi rustompm...@gmail.com wrote: On Nov 12, 12:09 pm, rusi rustompm...@gmail.com wrote: This is a classic problem -- structure clash of parallel loops rest snipped Sorry wrong solution :D The fidgetiness is entirely due to python not allowing C-style loops like

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Hans Mulder
On 12/11/12 16:36:58, jkn wrote: slight followup ... I have made some progress; for now I'm using subprocess.communicate to read the output from the first subprocess, then writing it into the secodn subprocess. This way I at least get to see what is happening ... The reason 'we' weren't

Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-12 Thread Johannes Kleese
Hi! (Yes, I did take a look at the issue tracker but couldn't find any corresponding bug, and no, I don't want to open a new account just for this one.) I'm reusing a single urllib.request.Request object to HTTP-POST data to

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Rebelo
Dana četvrtak, 8. studenoga 2012. 19:05:12 UTC+1, korisnik jkn napisao je: Hi All i am trying to build up a set of subprocess.Ponen calls to replicate the effect of a horribly long shell command. I'm not clear how I can do one part of this and wonder if anyone can advise. I'm on

Re: Strange object identity problem

2012-11-12 Thread duncan smith
On 12/11/12 13:40, F.R. wrote: On 11/12/2012 02:27 PM, Robert Franke wrote: Hi Frederic, [...] bas = {} for year in range (2010, 2013): ba = st.runs ('BA', '%d-01-01' % year, '%d-12-31' % year) ba.run () print year, id (ba) bas [year] = ba 2010 150289932 2011 150835852 2012

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
On Nov 12, 4:58 pm, Rebelo puntabl...@gmail.com wrote: Dana četvrtak, 8. studenoga 2012. 19:05:12 UTC+1, korisnik jkn napisao je: Hi All     i am trying to build up a set of subprocess.Ponen calls to replicate the effect of a horribly long shell command. I'm not clear how I can do one

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
Hi Hans On Nov 12, 4:36 pm, Hans Mulder han...@xs4all.nl wrote: On 12/11/12 16:36:58, jkn wrote: slight followup ... I have made some progress; for now I'm using subprocess.communicate to read the output from the first subprocess, then writing it into the secodn subprocess.

Re: Read number of CSV files

2012-11-12 Thread Peter Otten
Peter Otten wrote: [please don't email me directly] How is using glob different from os.listdir() Peter? glob retains the path and allows you to filter the files. Compare: import os, glob os.listdir(alpha) ['one.py', 'two.py', 'one.txt', 'three.py', 'three.txt', 'two.txt']

Re: Read number of CSV files

2012-11-12 Thread Smaran Harihar
Oh that is great. [apology on sending the mail directly] Thanks, Smaran On Mon, Nov 12, 2012 at 10:50 AM, Peter Otten __pete...@web.de wrote: Peter Otten wrote: [please don't email me directly] How is using glob different from os.listdir() Peter? glob retains the path and allows you to

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Hans Mulder
On 12/11/12 18:22:44, jkn wrote: Hi Hans On Nov 12, 4:36 pm, Hans Mulder han...@xs4all.nl wrote: On 12/11/12 16:36:58, jkn wrote: slight followup ... I have made some progress; for now I'm using subprocess.communicate to read the output from the first subprocess, then writing it

Re: Is there a way to creat a func that returns a cursor that can be used?

2012-11-12 Thread Terry Reedy
On 11/12/2012 7:25 AM, Joel Goldstick wrote: Chris gave you the same help that you got yesterday. ... go to ://python.org and read the tutorials, specifically about functions. It is hard to see what is working and not with an empty database. But to drive the point home, running import

Writing Donald E. Knuth based code in Python, cont'd

2012-11-12 Thread Juhani Ylikoski
Following comes a working, debugged Python program which computes the permutations of the integers 1, 2, 3 - n after Donald E. Knuth. I present it as an example of writing straightforward, easy Knuth-based code in a language with no GOTO statement. The Python program has been written after the

Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-12 Thread Terry Reedy
On 11/12/2012 10:52 AM, Johannes Kleese wrote: Hi! (Yes, I did take a look at the issue tracker but couldn't find any corresponding bug, and no, I don't want to open a new account just for this one.) You only have to open a tracker account just once. I am reluctant to report this myself as I

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
Hi Hans [...]         xargsproc.append(test -f %s/{} md5sum %s/{} % (mydir, mydir)) This will break if there are spaces in the file name, or other characters meaningful to the shell.  If you change if to         xargsproc.append(test -f '%s/{}' md5sum '%s/{}'                          

Re: f python?

2012-11-12 Thread Beekeeper2020
I totally agreed about the Python syntax. Why do I need to worry about the syntax which wasted hours to get it to work? Brain dead python designer! Maybe Guido need to learn it from the Master, Go to Ruby, and see how elegant the language is done. Also, it is stupid of google to hire Guido to

Re: Writing Donald E. Knuth based code in Python, cont'd

2012-11-12 Thread Vincent Vande Vyvre
Le 12/11/12 22:02, Juhani Ylikoski a écrit : Following comes a working, debugged Python program which computes the permutations of the integers 1, 2, 3 - n after Donald E. Knuth. I present it as an example of writing straightforward, easy Knuth-based code in a language with no GOTO statement.

Re: List comprehension for testing **params

2012-11-12 Thread Cantabile
Wow, lots of things I had never heard of in your posts. I guess I need to do some homework... Cantabile -- http://mail.python.org/mailman/listinfo/python-list

Help building a dictionary of lists

2012-11-12 Thread NJ1706
Chaps, I am new to Python have inherited a test harness written in the language that I am trying to extend. The following code shows how dictionaries holding lists of commands are handled in the script... Start of Code_1 #! /usr/bin/python # List of tests TestList = ( 'Test_1',

Re: f python?

2012-11-12 Thread Dave Angel
On 11/12/2012 05:07 PM, Beekeeper2020 wrote: I totally agreed about the Python syntax. Why do I need to worry about the syntax which wasted hours to get it to work? Brain dead python designer! Maybe Guido need to learn it from the Master, Go to Ruby, and see how elegant the language is done.

Re: f python?

2012-11-12 Thread Steven D'Aprano
On Mon, 12 Nov 2012 17:37:50 -0500, Dave Angel wrote: On 11/12/2012 05:07 PM, Beekeeper2020 wrote: [...] Python eventually will die once troll troll troll troll troll... In case anybody is tempted to respond to this troll message, Like you did? Without trimming? :-P -- Steven --

Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-12 Thread Cameron Simpson
On 12Nov2012 16:35, Terry Reedy tjre...@udel.edu wrote: | On 11/12/2012 10:52 AM, Johannes Kleese wrote: | While at it, I noticed that urllib.request.Request.has_header() and | .get_header() are case-sensitive, | | Python is case sensitive. But headers are not. I'd be very inclined to consider

Re: Help building a dictionary of lists

2012-11-12 Thread Joshua Landau
On 12 November 2012 22:26, NJ1706 nickj1...@googlemail.com wrote: Chaps, I am new to Python have inherited a test harness written in the language that I am trying to extend. The following code shows how dictionaries holding lists of commands are handled in the script... Start of Code_1

Re: Help building a dictionary of lists

2012-11-12 Thread Joshua Landau
On 12 November 2012 22:26, NJ1706 nickj1...@googlemail.com wrote: # List of tests TestList = ( 'Test_1', 'Test_2' ) Note that TestList is a *tuple*, not a list. You normally would want to write test_names instead of TestList for several reasons: * Unless it's a class, Python

Division matrix

2012-11-12 Thread Cleuson Alves
Hello, I need to solve an exercise follows, first calculate the inverse matrix and then multiply the first matrix. I await help. Thank you. follows the code below incomplete. m = [[1,2,3],[4,5,6],[7,8,9]] x = [] for i in [0,1,2]: y = [] for linha in m: y.append(linha[i])

Re: Division matrix

2012-11-12 Thread Ian Kelly
On Mon, Nov 12, 2012 at 6:00 PM, Cleuson Alves cleuso...@gmail.com wrote: Hello, I need to solve an exercise follows, first calculate the inverse matrix and then multiply the first matrix. I await help. Thank you. follows the code below incomplete. So what is the specific problem with the

Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-12 Thread Terry Reedy
On 11/12/2012 5:59 PM, Cameron Simpson wrote: On 12Nov2012 16:35, Terry Reedy tjre...@udel.edu wrote: | On 11/12/2012 10:52 AM, Johannes Kleese wrote: | While at it, I noticed that urllib.request.Request.has_header() and | .get_header() are case-sensitive, | | Python is case sensitive. To be

Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-12 Thread Terry Reedy
On 11/12/2012 4:35 PM, Terry Reedy wrote: import urllib.request opener = urllib.request.build_opener() request = urllib.request.Request(http://example.com/;, headers = {Content-Type: application/x-www-form-urlencoded}) opener.open(request, 1.encode(us-ascii)) print(request.data, '\n',

Re: Division matrix

2012-11-12 Thread Joshua Landau
On 13 November 2012 01:00, Cleuson Alves cleuso...@gmail.com wrote: Hello, I need to solve an exercise follows, first calculate the inverse matrix and then multiply the first matrix. This list isn't to give answers for homeworks, and this sounds like one. We *do* give help to those who have a

Simple Question regarding running .py program

2012-11-12 Thread Caroline Hou
Hi all! I just started learning Python by myself and I have an extremely simple question now! I am in my Python interpreter now and I want to open/edit a program called nobel.py. But when I typed python nobel.py, it gave me a SyntaxError:invalid syntax”( I've changed to the correct

Re: Simple Question regarding running .py program

2012-11-12 Thread Dave Angel
On 11/12/2012 09:02 PM, Caroline Hou wrote: Hi all! I just started learning Python by myself and I have an extremely simple question now! I am in my Python interpreter now and I want to open/edit a program called nobel.py. But when I typed python nobel.py, it gave me a

Re: Simple Question regarding running .py program

2012-11-12 Thread Caroline Hou
On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel wrote: On 11/12/2012 09:02 PM, Caroline Hou wrote: Hi all! I just started learning Python by myself and I have an extremely simple question now! I am in my Python interpreter now and I want to open/edit a program called

stackoverflow quote on Python

2012-11-12 Thread Mark Lawrence
http://stackoverflow.com/questions/tagged/python Python has two major versions (2 and 3) in use which have significant differences. I believe that this is incorrect. The warts have been removed, but significant differences, not in my book. If there is agreement about there not being

Re: stackoverflow quote on Python

2012-11-12 Thread Rodrick Brown
I believe this statement is correct given key differences do exist in underlying implementations even though such differences may be highly transparent to end users (developers). On Mon, Nov 12, 2012 at 10:08 PM, Mark Lawrence breamore...@yahoo.co.ukwrote:

Re: A gnarly little python loop

2012-11-12 Thread rusi
On Nov 12, 9:09 pm, Steve Howell showel...@yahoo.com wrote: On Nov 12, 7:21 am, rusi rustompm...@gmail.com wrote: On Nov 12, 12:09 pm, rusi rustompm...@gmail.com wrote: This is a classic problem -- structure clash of parallel loops rest snipped Sorry wrong solution :D The

Re: stackoverflow quote on Python

2012-11-12 Thread Ian Kelly
On Mon, Nov 12, 2012 at 8:08 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: http://stackoverflow.com/questions/tagged/python Python has two major versions (2 and 3) in use which have significant differences. I believe that this is incorrect. The warts have been removed, but significant

Re: stackoverflow quote on Python

2012-11-12 Thread Steven D'Aprano
On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote: http://stackoverflow.com/questions/tagged/python Python has two major versions (2 and 3) in use which have significant differences. I believe that this is incorrect. The warts have been removed, but significant differences, not in

Re: Simple Question regarding running .py program

2012-11-12 Thread Terry Reedy
On 11/12/2012 9:45 PM, Caroline Hou wrote: Also, how could I edit my script? I have sth called IDLE installed along with python. Is it the right place to write/edit my script? IDLE is one way to edit; I use it. When you want to run, hit F5 and stdout and stderr output goes to the shell

Getting module path string from a class instance

2012-11-12 Thread Some Developer
I'm trying to find a way to get a string of the module path of a class. So for instance say I have class Foo and it is in a module called my.module. I want to be able to get a string that is equal to this: my.module.Foo. I'm aware of the __repr__ method but it does not do what I want it to do

Re: Strange object identity problem

2012-11-12 Thread F.R.
On 11/12/2012 06:02 PM, duncan smith wrote: On 12/11/12 13:40, F.R. wrote: On 11/12/2012 02:27 PM, Robert Franke wrote: Hi Frederic, [...] bas = {} for year in range (2010, 2013): ba = st.runs ('BA', '%d-01-01' % year, '%d-12-31' % year) ba.run () print year, id (ba) bas

Re: Getting module path string from a class instance

2012-11-12 Thread Steven D'Aprano
On Tue, 13 Nov 2012 06:38:31 +, Some Developer wrote: I'm trying to find a way to get a string of the module path of a class. So for instance say I have class Foo and it is in a module called my.module. I want to be able to get a string that is equal to this: my.module.Foo. I'm aware of

Re: Getting module path string from a class instance

2012-11-12 Thread Some Developer
On 13/11/2012 07:19, Steven D'Aprano wrote: On Tue, 13 Nov 2012 06:38:31 +, Some Developer wrote: I'm trying to find a way to get a string of the module path of a class. So for instance say I have class Foo and it is in a module called my.module. I want to be able to get a string that is

[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can uses cpXXX encodings explictly to read or write a file, but these encodings are not used for sys.getfilesystemencoding() (or sys.stdout.encoding). At least CP1251 has been used for many cyrillic locales in before-UTF8 age (I use it sometimes

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
New submission from Tom Pohl: According to the documentation of the floor division (http://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations), x//y should be equal to math.floor(x/y). However, the result of 1//0.1 is 9.0 (tested on 2.6, 2.7, 3.2). It might be related

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +mark.dickinson, skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___

[issue16285] Update urllib to RFC 3986

2012-11-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16285 ___ ___

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, this is related to the internal representation of floating-point numbers. 0.1 is 3602879701896397/36028797018963968 in float. import fractions fractions.Fraction(0.1) Fraction(3602879701896397, 36028797018963968) 36028797018963968 / 3602879701896397

[issue16203] Proposal: add re.fullmatch() method

2012-11-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16203 ___ ___

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Mark Dickinson
Mark Dickinson added the comment: 9.0 *is* the correct result here. The number that Python stores for 0.1 is an approximation that's actually a little greater than 0.1. -- resolution: - invalid ___ Python tracker rep...@bugs.python.org

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___

[issue15880] os.path.split() and long UNC names

2012-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I propose to close this issue as won't fix. A long-UNC prefix support is a new feature and can't be applied to 2.7. As workaround use splitunc() in Python prior to 3.1. -- status: open - pending ___ Python

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Thanks for your comments. From a technical/numerical point of view I agree with you that the computed result is correct given the floating-point limitations. From a user's point of view (and the documentation seems to agree with me) the result is wrong. The

[issue8865] select.poll is not thread safe

2012-11-12 Thread Christian Schubert
Christian Schubert added the comment: new proposed fix: forbid concurrent poll() invocation -- Added file: http://bugs.python.org/file27967/issue8865_v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8865

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Mark Dickinson
Mark Dickinson added the comment: Tom: there's no reasonable way to define all 3 of /, // and % for floating-point numbers that avoids all user surprises. There are a couple of notes (nos 2 and 3) at the bottom of the documentation page you refer to that attempt to explain some of the

[issue8865] select.poll is not thread safe

2012-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch LGTM. I doubt about the exception type. May be RuntimeError is more appropriate? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8865 ___

[issue8865] select.poll is not thread safe

2012-11-12 Thread Christian Schubert
Christian Schubert added the comment: I doubt about the exception type. May be RuntimeError is more appropriate? mea culpa, just copypasted without actually looking; fixed in v3 -- Added file: http://bugs.python.org/file27968/issue8865_v3.diff ___

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Martin v . Löwis
Martin v. Löwis added the comment: Tom: you are misinterpreting the docs. It says (paraphrased) that the result of x//y equals floor(x mathematically-divided-by y), which is different from floor(x/y). Your computer is not capable of performing the mathematically-divided-by operation; you have

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Your computer is not capable of performing the mathematically-divided-by operation; you have to compute it on paper. You can compute it with Python. math.floor(1/fractions.Fraction(0.1)) 9 -- ___ Python

[issue16218] Python launcher does not support unicode characters

2012-11-12 Thread koobs
koobs added the comment: Back to green for all branches on FreeBSD, thank you Victor -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16218 ___

[issue16218] Python launcher does not support unicode characters

2012-11-12 Thread Stefan Krah
Stefan Krah added the comment: The Mountain Lion bots still fail. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16218 ___ ___

[issue16218] Python launcher does not support unicode characters

2012-11-12 Thread STINNER Victor
STINNER Victor added the comment: Back to green for all branches on FreeBSD, thank you Victor FreeBSD buildbots are green because I disabled the test on undecodable bytes! See issue #16455 which proposes a fix for FreeBSD and OpenIndiana. The Mountain Lion bots still fail. :) Yeah I know,

[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers

2012-11-12 Thread Vinay Sajip
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16391 ___

[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers

2012-11-12 Thread Nikolay Bryskin
Nikolay Bryskin added the comment: Vinay, why do you close this feature request? Proposed workaround is just a workaround and even doesn't provide some functionality - for example, it seems impossible to define a terminator using config file. -- resolution: invalid - status: closed -

[issue15809] IDLE console uses incorrect encoding.

2012-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: However, this patch isn't right, since it will cause all source to be interpreted as UTF-8. This would be wrong when the sys.stdin.encoding is not UTF-8, and byte string objects are created in interactive mode. Can you show how to reproduce the error

[issue15809] IDLE console uses incorrect encoding.

2012-11-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15809 ___ ___

[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers

2012-11-12 Thread Vinay Sajip
Vinay Sajip added the comment: Well, the config file format is older and fileConfig() does not cover as much as dictConfig() does. (For example, filters). I don't propose to spend time enhancing fileConfig(), now that dictConfig() is available. If you are forced to use fileConfig(), you can

[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames

2012-11-12 Thread STINNER Victor
STINNER Victor added the comment: macosx-2.patch patches _Py_wchar2char() and _Py_char2wchar() functions to use UTF-8/surrogateescape for any function using the locale encoding, not only file related functions of fileutils.h. The patch does also simplify the code, no more specific #ifdef

[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers

2012-11-12 Thread Nikolay Bryskin
Nikolay Bryskin added the comment: Actually, I'm using dictConfig to load config from json file. And yes, ext:// provides a way to load custom handler, but, as far as I see (https://github.com/jonashaag/cpython/blob/master/Lib/logging/config.py#L379-404), there is no possibility to specify

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Thanks for all the explanations why Python's floor division (FD) works as specified. And I agree, it does work as specified, but still, I think this is not the behavior that most people would expect and is therefore dangerous to provide/use. What do I expect from

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Martin: Ok, just as you suggested, I did the calculations on a sheet of paper: floor(1 mathematically-divided-by 0.1) = floor(10) = 10 qed ;-) -- ___ Python tracker rep...@bugs.python.org

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Stefan Krah
Stefan Krah added the comment: Any programming language that uses binary floats behaves like that and it is actually what people expect. If you want behavior that is closer to pencil and paper calculations, you need to use decimal: Decimal(1) // Decimal(0.1) Decimal('10') Contrast with:

[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set

2012-11-12 Thread STINNER Victor
STINNER Victor added the comment: Hijacking locale.getpreferredencoding() is maybe dangerous. I attached a new patch, force_ascii.patch, which uses a different approach: be more strict than mbstowcs(), force the ASCII encoding when: - the LC_CTYPE locale is C - nl_langinfo(CODESET) is ASCII or

[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)

2012-11-12 Thread Martin v . Löwis
Martin v. Löwis added the comment: I think the patch will break on Unix systems that don't have uid_t or gid_t types. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2005 ___

[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set

2012-11-12 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16455 ___ ___ Python-bugs-list mailing list

[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)

2012-11-12 Thread Ronald Oussoren
Ronald Oussoren added the comment: The patch should work on OSX, although I haven't actually tested it yet. I've verified that sizeof(uid_t) and sizeof(gid_t) are the same for x86_64 and i386, which means SIZEOF_UID_T doesn't have to be added to pymacconfig.h. A smal nit with the patch: it

[issue16442] PATH_MAX vs MAXPATHLEN vs pathconf(..., _PC_PATH_MAX).

2012-11-12 Thread Martin v . Löwis
Martin v. Löwis added the comment: I don't think that using pathconf is an important part of this issue. Instead, it is more important to deal with ENAMETOOLONG errors. To do so, we should get rid of all stack allocations of arrays with PATH_MAX/MAXPATHLEN size (also because they can consume

  1   2   3   >