Re: Brython - Python in the browser

2012-12-20 Thread Pierre Quentel
Le jeudi 20 décembre 2012 01:07:15 UTC+1, Terry Reedy a écrit : On 12/19/2012 1:19 PM, Pierre Quentel wrote: The objective of Brython is to replace Javascript by Python as the scripting language for web browsers, making it usable on all terminals including smartphones, tablets,

Re: Brython - Python in the browser

2012-12-20 Thread Pierre Quentel
Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit : On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy tjre...@udel.edu wrote: That says that my browser, Firefox 17, does not support HTML5. Golly gee. I don't think any browser support5 all of that moving target, and Gecko apparently

Re: Brython - Python in the browser

2012-12-20 Thread Chris Angelico
On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel pierre.quen...@gmail.com wrote: I'm afraid I am going to disagree. The document is a tree structure, and today Python doesn't have a syntax for easily manipulating trees. To add a child to a node, using an operator instead of a function call

Re: Brython - Python in the browser

2012-12-20 Thread Jamie Paul Griffin
* Ian Kelly ian.g.ke...@gmail.com [2012-12-19 17:54:44 -0700]: On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy tjre...@udel.edu wrote: That says that my browser, Firefox 17, does not support HTML5. Golly gee. I don't think any browser support5 all of that moving target, and Gecko apparently

how to detect the encoding used for a specific text data ?

2012-12-20 Thread iMath
how to detect the encoding used for a specific text data ? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread Jussi Piitulainen
iMath writes: how to detect the encoding used for a specific text data ? The practical thing to do is to try an encoding and see whether you find the expected frequent letters of the relevant languages in the decoded text, or the most frequent words. This is likely to help you decide between

Re: Virtualenv loses context

2012-12-20 Thread rhythmicdevil
Brought my laptop out of hibernation to do some work this morning. I attempted to run one of my ETLs and got the following error. I made no changes since it was running yesterday. [swright@localhost app]$ python etl_botnet_meta.py --mode dev -f Traceback (most recent call last): File

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread Stefan H. Holek
On 20.12.2012, at 12:57, iMath wrote: how to detect the encoding used for a specific text data ? http://pypi.python.org/pypi?%3Aaction=searchterm=detect+encoding -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread iMath
which package to use ? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread Jussi Piitulainen
iMath writes: which package to use ? Read the text in as a bytes object (bytes), then it has a .decode method that you can experiment with. Strings (str) are Unicode and have an .encode method. These methods allow you to specify a desired encoding and and what to do when there are errors.

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread Christian Heimes
Am 20.12.2012 12:57, schrieb iMath: how to detect the encoding used for a specific text data ? You can't. It's not possible unless the file format can specify the encoding somehow, e.g. like XML's header ?xml version=1.0 encoding=UTF-8?. Sometimes you can try and make an educated guess. But

Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Johannes Bauer
Hi group, I've run into a problem using Python3.2 and sqlite3 db access that I can't quite wrap my head around. I'm pretty sure there's a bug in my program, but I can't see where. Help is greatly appreciated. I've created a minimal example to demonstrate the phaenomenon (attached at bottom).

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Johannes Bauer
On 19.12.2012 16:40, Chris Angelico wrote: You may not be familiar with jmf. He's one of our resident trolls, and he has a bee in his bonnet about PEP 393 strings, on the basis that they take up more space in memory than a narrow build of Python 3.2 would, for a string with lots of BMP

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: def fetchmanychks(cursor): cursor.execute(SELECT id FROM foo;) while True: result = cursor.fetchmany() if len(result) == 0: break

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Johannes Bauer
On 20.12.2012 16:05, Chris Angelico wrote: On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: def fetchmanychks(cursor): cursor.execute(SELECT id FROM foo;) while True: result = cursor.fetchmany() if len(result) == 0:

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 2:20 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: Hmm, but this: result = cursor.fetchone() yield result Works nicely -- only the fetchmany() makes the example break. Okay, now it's sounding specific to sqlite. I'll bow out.

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Hans Mulder
On 20/12/12 16:20:13, Johannes Bauer wrote: On 20.12.2012 16:05, Chris Angelico wrote: On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: def fetchmanychks(cursor): cursor.execute(SELECT id FROM foo;) while True: result =

Data Driven Process

2012-12-20 Thread balparmak
I need to come up with a Python code to automate a map creation process but I am a little bit of lack of python knowledge. Any help would be much appreciated. My problem is that I have a 20 mxd file which need an update process in timely manner(this is just one project) and pdf creation for

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread inq1ltd
On Thursday, December 20, 2012 03:52:39 PM Johannes Bauer wrote: Hi group, I've run into a problem using Python3.2 and sqlite3 db access that I can't quite wrap my head around. I'm pretty sure there's a bug in my program, but I can't see where. Help is greatly appreciated. I've created a

Re: Data Driven Process

2012-12-20 Thread Grant Rettke
If you set up 2 sample MDX files that are dead simple along with some code to demonstrate what you are attempting, and some unit tests, then you will be helping people to help you. Most people probably do not have experience or familiarity with what you are attemping. On Thu, Dec 20, 2012 at

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread rurpy
On Thursday, December 20, 2012 4:57:19 AM UTC-7, iMath wrote: how to detect the encoding used for a specific text data ? The chardet package will probably do what you want: http://pypi.python.org/pypi/chardet -- http://mail.python.org/mailman/listinfo/python-list

Re: Data Driven Process

2012-12-20 Thread balparmak
Thank you for your reply Grant, I am trying to attach mxd's but no chance. As you said that i dont have much experience in python. I used to work with VBA but its not an option anymore with new ArcGIS 10. How can I add mxd's here? -- http://mail.python.org/mailman/listinfo/python-list

Re: Data Driven Process

2012-12-20 Thread Grant Rettke
Maybe try posting them on your blog. On Thu, Dec 20, 2012 at 12:08 PM, balpar...@gmail.com wrote: Thank you for your reply Grant, I am trying to attach mxd's but no chance. As you said that i dont have much experience in python. I used to work with VBA but its not an option anymore with new

Re: Virtualenv loses context

2012-12-20 Thread Ian Kelly
On Thu, Dec 20, 2012 at 5:50 AM, rhythmicde...@gmail.com wrote: Brought my laptop out of hibernation to do some work this morning. I attempted to run one of my ETLs and got the following error. I made no changes since it was running yesterday. [swright@localhost app]$ python

Re: Py 3.3, unicode / upper()

2012-12-20 Thread wxjmfauth
Fact. In order to work comfortably and with efficiency with a scheme for the coding of the characters, can be unicode or any coding scheme, one has to take into account two things: 1) work with a unique set of characters and 2) work with a contiguous block of code points. At this point, it should

Re: Py 3.3, unicode / upper()

2012-12-20 Thread wxjmfauth
Le mercredi 19 décembre 2012 22:31:42 UTC+1, Ian a écrit : On Wed, Dec 19, 2012 at 2:18 PM, wxjmfa...@gmail.com wrote: latin-1 (iso-8859-1) ? are you sure ? Yes. sys.getsizeof('a') 26 sys.getsizeof('ab') 27 sys.getsizeof('aé') 39 Compare to:

Re: Py 3.3, unicode / upper()

2012-12-20 Thread wxjmfauth
Le mercredi 19 décembre 2012 22:23:15 UTC+1, Ian a écrit : On Wed, Dec 19, 2012 at 1:55 PM, wxjmfa...@gmail.com wrote: Yes, it is correct (or can be considered as correct). I do not wish to discuss the typographical problematic of Das Grosse Eszett. The web is full of pages on the

Re: Py 3.3, unicode / upper()

2012-12-20 Thread wxjmfauth
Le jeudi 20 décembre 2012 06:32:42 UTC+1, Terry Reedy a écrit : On 12/19/2012 10:12 PM, Westley Martínez wrote: On Wed, Dec 19, 2012 at 09:54:20PM -0500, Terry Reedy wrote: On 12/19/2012 9:03 PM, Chris Angelico wrote: On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly ian.g.ke...@gmail.com

Re: Py 3.3, unicode / upper()

2012-12-20 Thread MRAB
On 2012-12-20 19:19, wxjmfa...@gmail.com wrote: Fact. In order to work comfortably and with efficiency with a scheme for the coding of the characters, can be unicode or any coding scheme, one has to take into account two things: 1) work with a unique set of characters and 2) work with a

Strange effect with import

2012-12-20 Thread Jens Thoms Toerring
Hi, I hope that this isn't a stupid question, asked already a hundred times, but I haven't found anything definitive on the problem I got bitten by. I have two Python files like this: S1.py -- import random import S2 class R( object ) : r = random.random( ) if __name__ ==

Re: Data Driven Process

2012-12-20 Thread balparmak
Hi Grant can you help me with this? I am working with the python code below in ArcGIS to zoom into a shapefile's attribute table row features without selected until the end of table one by one. I am trying to use this code but this one requires that a row is selected. import arcpy mxd =

Re: Data Driven Process

2012-12-20 Thread Jeffrey Ciesla
I'm just learning Python, so I doubt I could be much help, but I'd like to see how this progresses, maybe learn a little more about the language. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange effect with import

2012-12-20 Thread Dave Angel
On 12/20/2012 03:39 PM, Jens Thoms Toerring wrote: Hi, I hope that this isn't a stupid question, asked already a hundred times, but I haven't found anything definitive on the problem I got bitten by. I have two Python files like this: S1.py -- import random import S2

Re: Data Driven Process

2012-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2012 10:08:20 -0800, balparmak wrote: Thank you for your reply Grant, I am trying to attach mxd's but no chance. As you said that i dont have much experience in python. I used to work with VBA but its not an option anymore with new ArcGIS 10. How can I add mxd's here? The

Re: Strange effect with import

2012-12-20 Thread Peter Otten
Jens Thoms Toerring wrote: Hi, I hope that this isn't a stupid question, asked already a hundred times, but I haven't found anything definitive on the problem I got bitten by. I have two Python files like this: S1.py -- import random import S2 class R( object ) :

Re: Data Driven Process

2012-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2012 12:39:38 -0800, balparmak wrote: I am working with the python code below in ArcGIS to zoom into a shapefile's attribute table row features without selected until the end of table one by one. I am trying to use this code but this one requires that a row is selected. Then

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 7:20 AM, MRAB pyt...@mrabarnett.plus.com wrote: On 2012-12-20 19:19, wxjmfa...@gmail.com wrote: The rule is to treat every character of a unique set of characters of a coding scheme in, how to say, an equal way. The problematic can be seen the other way, every coding

Re: Data Driven Process

2012-12-20 Thread Dave Angel
On 12/20/2012 01:08 PM, balpar...@gmail.com wrote: Thank you for your reply Grant, I am trying to attach mxd's but no chance. As you said that i dont have much experience in python. I used to work with VBA but its not an option anymore with new ArcGIS 10. How can I add mxd's here? MXD

Re: Data Driven Process

2012-12-20 Thread balparmak
On Thursday, December 20, 2012 2:03:52 PM UTC-7, Steven D'Aprano wrote: On Thu, 20 Dec 2012 12:39:38 -0800, balparmak wrote: I am working with the python code below in ArcGIS to zoom into a shapefile's attribute table row features without selected until the end of table one by one. I am

Re: Data Driven Process

2012-12-20 Thread balparmak
I thought that with python you can specify first layer's attribute table in the table of contents and then go through the records in arcgis. -- http://mail.python.org/mailman/listinfo/python-list

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
On 12/20/2012 2:19 PM, wxjmfa...@gmail.com wrote: If you are an ascii user, a FSR model has no sense. An ascii user will use, per definition, only ascii characters. If you are a non-ascii user, the FSR model is also a non sense, because you are per definition a non-ascii user of non-ascii

Re: Strange effect with import

2012-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2012 20:39:19 +, Jens Thoms Toerring wrote: Hi, I hope that this isn't a stupid question, asked already a hundred times, but I haven't found anything definitive on the problem I got bitten by. I have two Python files like this: S1.py -- import random

Build and runtime dependencies

2012-12-20 Thread Jack Silver
I have two Linux From Scratch machine. On the first one (the server), I want to build install python 3.3.0 in a shared filesystem and access it from the second one (the client). These machines are fairly minimal in term of the number of software installed. I just want to install python on this

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
On 12/20/2012 2:57 PM, wxjmfa...@gmail.com wrote: I shew a case where the Py33 works 10 times slower than Py32, replace. You the devs spend your time to correct that case. I discovered that it is the 'find' part of find and replace that is slower. The comparison is worse on Windows than on

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
On 12/20/2012 2:40 PM, wxjmfa...@gmail.com wrote: What should a Python user think, if he sees his strings are comsuming more memory just because he uses non ascii characters What should a Python user think, if he (or she) sees his (or her) strings sometimes or often consuming less memory

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2012 11:40:21 -0800, wxjmfauth wrote: I do not care about this optimization. I'm not an ascii user. As a non ascii user, this optimization is just irrelevant. WRONG. Every Python user is an ASCII user. Every Python program has hundreds or thousands of ASCII strings. # ===

Re: Strange effect with import

2012-12-20 Thread Jens Thoms Toerring
Thanks a lot to all three of you: that helped me understand the errors of my ways! You just saved me a few more hours of head-scratching;-) A few replies to the questions and comments by Steven: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 20 Dec 2012 20:39:19 +, Jens

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
On 12/20/2012 2:19 PM, wxjmfa...@gmail.com wrote: My feeling is that most of the people are defending this FSR simply because it exists, not because of its intrisic quality. The fact, contrary to your feeling, is that I was initially dubious that is could be made to work as well as it does.

Re: Brython - Python in the browser

2012-12-20 Thread Terry Reedy
On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel pierre.quen...@gmail.com wrote: I'm afraid I am going to disagree. The document is a tree structure, and today Python doesn't have a syntax for easily manipulating trees. What Python does have is 11 versions of the augmented assignment

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Ian Kelly
On Thu, Dec 20, 2012 at 12:19 PM, wxjmfa...@gmail.com wrote: The first (and it should be quite obvious) consequence is that you create bloated, unnecessary and useless code. I simplify the flexible string representation (FSR) and will use an ascii / non-ascii model/terminology. If you are

Re: help with making my code more efficient

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com larry.mart...@gmail.com wrote: This code works, but it takes way too long to run - e.g. when cdata has 600,000 elements (which is typical for my app) it takes 2 hours for this to run. Can anyone give me some suggestions on speeding

Re: Build and runtime dependencies

2012-12-20 Thread Miki Tebeka
On Thursday, December 20, 2012 2:11:45 PM UTC-8, Jack Silver wrote: I have two Linux From Scratch machine. Hence, I do not need to install all those libraries on the client machine. Right ? It depends on what the client needs. For example if you use zlib compression in the protocol, you'll

Re: help with making my code more efficient

2012-12-20 Thread larry.mart...@gmail.com
On Thursday, December 20, 2012 5:38:03 PM UTC-7, Chris Angelico wrote: On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com larry.mart...@gmail.com wrote: This code works, but it takes way too long to run - e.g. when cdata has 600,000 elements (which is typical for my app) it takes

Re: Strange effect with import

2012-12-20 Thread Terry Reedy
On 12/20/2012 5:52 PM, Jens Thoms Toerring wrote: You are rather likely right and I probably should have written: I don't see any way to pass that variable to the object that is supposed to use it. Perhaps you have an idea how it could be done correctly when I explain the complete picture: I'm

Re: Strange effect with import

2012-12-20 Thread Hans Mulder
On 20/12/12 23:52:24, Jens Thoms Toerring wrote: I'm writing a TCP server, based on SocketServer: server = SocketServer.TCPServer((192.168.1.10, 12345), ReqHandler) where ReqHandler is the name of a class derived from SocketServer.BaseRequestHandler class

Question regarding mod_python and a script for web.

2012-12-20 Thread John Pennington
Hi Everyone, I'm a linux admin that was tasked by his python programming boss to solve a problem my boss is having with a web form he wrote on our site. Unfortunately for me, I lack any experience whatsoever with python and very little with programming on the web, so my hope is someone can

Re: Strange effect with import

2012-12-20 Thread Jens Thoms Toerring
Terry Reedy tjre...@udel.edu wrote: server = SocketServer.TCPServer((192.168.1.10, 12345), ReqHandler) where ReqHandler is the name of a class derived from SocketServer.BaseRequestHandler You misunderstood the doc. You pass the class, not the name of the class. From 21.19.4.1.

Re: help with making my code more efficient

2012-12-20 Thread Dave Angel
On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a message. I want to select from this list all the elements where the message matches some string, and all the other elements where the time is within some diff of any

Re: Strange effect with import

2012-12-20 Thread Jens Thoms Toerring
Hans Mulder han...@xs4all.nl wrote: What happens if instead of a class you pass a function that takes the same arguments as the SocketServer.BaseRequestHandler constructor and returns a new instance of your ReqHandler? That's not quite what the documentaion clls for, but I'd hope it's close

Re: Build and runtime dependencies

2012-12-20 Thread Hans Mulder
On 20/12/12 23:11:45, Jack Silver wrote: I have two Linux From Scratch machine. On the first one (the server), I want to build install python 3.3.0 in a shared filesystem and access it from the second one (the client). These machines are fairly minimal in term of the number of software

Re: help with making my code more efficient

2012-12-20 Thread larry.mart...@gmail.com
On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a message. I want to select from this list all the elements where the message matches some string, and

Re: Question regarding mod_python and a script for web.

2012-12-20 Thread ian douglas
Short answer: Use the POST method on the form instead of GET. Depending how you process the form you might need to make a few changes to the script that answers the request. -- http://mail.python.org/mailman/listinfo/python-list

Re: help with making my code more efficient

2012-12-20 Thread MRAB
On 2012-12-21 00:19, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a message. I want to select from this list all the elements where the message matches some string, and all the other elements where the time is within some diff of any matching

Re: Brython - Python in the browser

2012-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2012 18:59:39 -0500, Terry Reedy wrote: On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel pierre.quen...@gmail.com wrote: I'm afraid I am going to disagree. The document is a tree structure, and today Python doesn't have a syntax for easily manipulating trees. What Python does

Re: help with making my code more efficient

2012-12-20 Thread Mitya Sirenef
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a message. I want to select from this list all the

Re: help with making my code more efficient

2012-12-20 Thread Mitya Sirenef
On 12/20/2012 09:39 PM, Mitya Sirenef wrote: On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a

Re: help with making my code more efficient

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 11:43 AM, larry.mart...@gmail.com larry.mart...@gmail.com wrote: It came from a database. Originally I was getting just the data I wanted using SQL, but that was taking too long also. I was selecting just the messages I wanted, then for each one of those doing another

Keeping a Tkinter GUI alive during a long running process

2012-12-20 Thread Kevin Walzer
I maintain a Tkinter application that's a front-end to to a package manger, and I have never been able to find a way to keep the app from locking up at some point during the piping in of the package manager's build output into a text widget. At some point the buffer is overwhelmed and the app

Re: help with making my code more efficient

2012-12-20 Thread Dave Angel
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: snip Of course it's a fragment - it's part of a large program and I was just showing the relevant parts. But it seems these are methods in a class, or something, so we're

Re: help with making my code more efficient

2012-12-20 Thread Roy Smith
In article cc869959-c568-4490-b45f-7855c6841...@googlegroups.com, larry.mart...@gmail.com larry.mart...@gmail.com wrote: On Thursday, December 20, 2012 5:38:03 PM UTC-7, Chris Angelico wrote: On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com larry.mart...@gmail.com wrote:

Re: Brython - Python in the browser

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 1:05 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 20 Dec 2012 18:59:39 -0500, Terry Reedy wrote: What Python does have is 11 versions of the augmented assignment statement: +=, -=, *=, /=, //=, %=, **=, =, =, =, ^=, |=. Moreover, these are

redirect standard output problem

2012-12-20 Thread iMath
redirect standard output problem why the result only print A but leave out 888 ? import sys class RedirectStdoutTo: def __init__(self, out_new): self.out_new = out_new def __enter__(self): sys.stdout = self.out_new def __exit__(self, *args): sys.stdout =

Pass and return

2012-12-20 Thread iMath
Pass and return Are these two functions the same ? def test(): return def test(): pass -- http://mail.python.org/mailman/listinfo/python-list

Re: Pass and return

2012-12-20 Thread Mitya Sirenef
On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass I believe they are the same, but these statements have different meanings in other circumstances, e.g.: Class A(object): pass def test(): if x:

Re: Pass and return

2012-12-20 Thread Mitya Sirenef
On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass From the point of style, of course, the latter is much better because that's the idiomatic way to define a no-op function. With a return, it looks

Re: Pass and return

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 4:23 PM, iMath redstone-c...@163.com wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass They're different statements, but in this case they happen to accomplish the same thing. The pass statement means do

compile python 3.3 with bz2 support

2012-12-20 Thread Isml
hi, everyone: I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do that. Here is how I do it: 1. download bzip2 and compile it(make??make -f Makefile_libbz2_so??make install) 2.chang to python 3.3 source directory : ./configure --with-bz2=/usr/local/include

compile python 3.3 with bz2 support on RedHat 5.5

2012-12-20 Thread Isml
hi, everyone: I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do that. Here is how I do it: 1??download bzip2 and compile it(make??make -f Makefile_libbz2_so??make install) 2??chang to python 3.3 source directory : ./configure --with-bz2=/usr/local/include

Re: redirect standard output problem

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 4:23 PM, iMath redstone-c...@163.com wrote: redirect standard output problem why the result only print A but leave out 888 ? No idea, because when I paste your code into the Python 3.3 interpreter or save it to a file and run it, it does exactly what I would expect. A

[issue16718] Mysterious atexit fail

2012-12-20 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: I don't know, you should probably ask there. One blocker is to make builtin and extension modules participate in GC, search pep3121 to see the many intermediate issues. -- ___ Python tracker

[issue16734] Delay interpreter startup phase until script is read

2012-12-20 Thread Charles-François Natali
Charles-François Natali added the comment: I may be missing something, but nothing's wrong here. When you start a subprocess, the child process keeps running (in background). If you want to wait for its termination, just use p.wait() or p.communicate(). -- nosy: +neologix

[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip

2012-12-20 Thread Bohuslav Slavek Kabrda
New submission from Bohuslav Slavek Kabrda: When I use zipfile.is_zipfile on file fastjar (sample uploaded at [1]) from libgcj, I get True, while I should get False (reproducible with fastjar from libgcj 4.7.2 on Fedora 18). This is caused by stringEndArchive string being present in the file,

[issue16733] Solaris ctypes_test failures

2012-12-20 Thread Trent Nelson
Changes by Trent Nelson tr...@snakebite.org: -- nosy: +trent ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16733 ___ ___ Python-bugs-list mailing

[issue16734] Delay interpreter startup phase until script is read

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You should use some kind of inter-process communication to synchronize your processes. In particular, for get rid of a temporary script file you can either send script via pipe: p = Popen([sys.executable], stdin=PIPE) p.stdin.write(longscript) or

[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can upload a sample file on bug tracker. Actually jar files are just zip files (with some limitation and special files). zipfile.is_zipfile should return True on a jar file. -- nosy: +serhiy.storchaka ___

[issue14373] C implementation of functools.lru_cache

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

[issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip

2012-12-20 Thread Bohuslav Slavek Kabrda
Bohuslav Slavek Kabrda added the comment: Oh, sorry, I will upload it on the bugtracker next time. I know that jar files are zip files, but this is not a jar (although it has jar in file). This is a binary. -- ___ Python tracker

[issue13863] import.c sometimes generates incorrect timestamps on Windows + NTFS

2012-12-20 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13863 ___ ___

[issue14373] C implementation of functools.lru_cache

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thanks, Alexey. However most of my comments were not considered. I have repeated them and added some new comments. -- stage: patch review - needs patch ___ Python tracker rep...@bugs.python.org

[issue12876] Make Test Error : ImportError: No module named _sha256

2012-12-20 Thread Encolpe DEGOUTE
Encolpe DEGOUTE added the comment: I my experience this error comes when SASL headers are missing during the build. Under debian or ubuntu it's the package named libsasl2-dev. -- nosy: +encolpe ___ Python tracker rep...@bugs.python.org

[issue16694] Add pure Python operator module

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry, I forgot push a Publish All My Drafts button. Please consider other my comments to first patch. I also have added new comments about length_hint(). Your implementation of attrgetter() looks good. One possible disadvantage of pure functional approach

[issue14373] C implementation of functools.lru_cache

2012-12-20 Thread Ned Batchelder
Changes by Ned Batchelder n...@nedbatchelder.com: -- nosy: -nedbat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14373 ___ ___ Python-bugs-list

[issue16736] select.poll() converts long to int without checking for overflow

2012-12-20 Thread Richard Oudkerk
New submission from Richard Oudkerk: Relevant code: int timeout = 0, poll_result, i, j; ... tout = PyNumber_Long(tout); if (!tout) return NULL; timeout = PyLong_AsLong(tout); -- implicit cast to int -- messages: 177811 nosy: sbt priority:

[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: A simplest solution is to raise a TclError instead of ValueError for non-BMP characters. This should not break any existing code, because a user code should be ready to catch a TclError in any case. Here is a patch. A more complicated solution is to add

[issue16736] select.poll() converts long to int without checking for overflow

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a part of issue15989. -- nosy: +serhiy.storchaka resolution: - duplicate superseder: - Possible integer overflow of PyLong_AsLong() results ___ Python tracker rep...@bugs.python.org

[issue16737] Different behaviours in script run directly and via runpy.run_module

2012-12-20 Thread Vinay Sajip
New submission from Vinay Sajip: If a script is run directly, the value of __file__ in it is relative to the current directory. If run via runpy.run_module, the value of __file__ is an absolute path. This is a problem in certain scenarios - e.g. if the script is a distribution's setup.py, a

[issue6514] python -m unittest testmodule does not run any tests

2012-12-20 Thread anatoly techtonik
anatoly techtonik added the comment: The documentation should be fixed then: http://docs.python.org/2/library/unittest#command-line-interface -- nosy: +techtonik ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6514

[issue879399] socket line buffering

2012-12-20 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: New patch, with unittest. -- Added file: http://bugs.python.org/file28377/_fileobject.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue879399 ___

[issue16738] Comparisons difference: bytes with bytes, str with str

2012-12-20 Thread Ivan Bykov
New submission from Ivan Bykov: Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. b = b't' b[0] in [b] False u = 't' u[0] in [u] True -- messages: 177817 nosy: ivb priority:

[issue16737] Different behaviours in script run directly and via runpy.run_module

2012-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: $ ./python -m script /home/serhiy/py/cpython/script.py __main__ $ ./python -c import runpy; runpy.run_path('script.py', run_name='__main__') script.py __main__ This looks consistent. -- nosy: +serhiy.storchaka ___

  1   2   >