Re: unittest: assertRaises() with an instance instead of a type

2012-03-28 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: (By the way, I have to question the design of an exception with error codes. That seems pretty poor design to me. Normally the exception *type* acts as equivalent to an error code.) Have a look at Python's built-in OSError. The

Re: Re: Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Evan Driscoll drisc...@cs.wisc.edu wrote: People like you -- who write to assumptions which are not even remotely guaranteed by the spec -- are part of the reason software sucks. ... This email is a bit harsher than it deserves -- but I feel not by much. I don't see how you could feel the least

Re: Re: Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Chris Angelico
On Thu, Mar 29, 2012 at 2:04 PM, Ross Ridge rri...@csclub.uwaterloo.ca wrote: Evan Driscoll  drisc...@cs.wisc.edu wrote: People like you -- who write to assumptions which are not even remotely guaranteed by the spec -- are part of the reason software sucks. ... This email is a bit harsher than

Re: Re: Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Chris Angelico ros...@gmail.com wrote: Actually, he is justified. It's one thing to work in C or assembly and write code that depends on certain bit-pattern representations of data (although even that causes trouble - assuming that sizeof(int)=3D=3Dsizeof(int*) isn't good for portability), but in

CFG for python

2012-03-28 Thread J. Mwebaze
Anyone knows how to create control-flow-graph for python.. After searching around, i found this article, http://www.python.org/dev/peps/pep-0339/#ast-to-cfg-to-bytecode and also a reference to http://doc.pypy.org/en/latest/objspace.html#the-flow-model However, i stil cant figure out what how to

Re: python segfault

2012-03-28 Thread Michael Poeltl
hi, * Dave Angel d...@davea.name [2012-03-28 04:38]: On 03/27/2012 06:27 PM, Michael Poeltl wrote: hi, can anybody tell why this 'little stupid *thing* of code' let's python-3.2.2, 2.6.X or python 2.7.2 segfault? def get_steps2(pos=0, steps=0): ... if steps == 0: ... pos =

Re: best way to create warning for obsolete functions and call new one

2012-03-28 Thread Gelonida N
Hi Dan, On 03/26/2012 11:24 PM, Dan Sommers wrote: On Mon, 26 Mar 2012 22:26:11 +0200 Gelonida N gelon...@gmail.com wrote: As these modules are used by quite some projects and as I do not want to force everybody to rename immediately I just want to warn users, that they call functions,

Re: OAuth 2.0 implementation

2012-03-28 Thread Mark Hammond
On 28/03/2012 1:18 AM, Roy Smith wrote: In article 7909491.0.1332826232743.JavaMail.geo-discussion-forums@pbim5, Demian Brecht demianbre...@gmail.com wrote: OAuth 2.0 is still in draft status (draft 25 is the current one I believe) and yes, unfortunately every single server available at this

Re: best way to create warning for obsolete functions and call new one

2012-03-28 Thread Gelonida N
Hi Chris, On 03/26/2012 11:50 PM, Chris Angelico wrote: On Tue, Mar 27, 2012 at 7:26 AM, Gelonida N gelon...@gmail.com wrote: One option I though of would be: def obsolete_func(func): def call_old(*args, **kwargs): print func is old psl use new one return func(*args,

convert string to bytes without changing data (encoding)

2012-03-28 Thread Peter Daum
Hi, is there any way to convert a string to bytes without interpreting the data in any way? Something like: s='abcde' b=bytes(s, unchanged) Regards, Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Chris Angelico
On Wed, Mar 28, 2012 at 7:56 PM, Peter Daum ga...@cs.tu-berlin.de wrote: Hi, is there any way to convert a string to bytes without interpreting the data in any way? Something like: s='abcde' b=bytes(s, unchanged) What is a string? It's not a series of bytes. You can't convert it without

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Stefan Behnel
Peter Daum, 28.03.2012 10:56: is there any way to convert a string to bytes without interpreting the data in any way? Something like: s='abcde' b=bytes(s, unchanged) If you can tell us what you actually want to achieve, i.e. why you want to do this, we may be able to tell you how to do what

question about file handling with with

2012-03-28 Thread Jabba Laci
Hi, Is the following function correct? Is the input file closed in order? def read_data_file(self): with open(self.data_file) as f: return json.loads(f.read()) Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Peter Daum
On 2012-03-28 11:02, Chris Angelico wrote: On Wed, Mar 28, 2012 at 7:56 PM, Peter Daum ga...@cs.tu-berlin.de wrote: is there any way to convert a string to bytes without interpreting the data in any way? Something like: s='abcde' b=bytes(s, unchanged) What is a string? It's not a series

Re: question about file handling with with

2012-03-28 Thread Peter Otten
Jabba Laci wrote: Is the following function correct? Yes, though I'd use json.load(f) instead of json.loads(). Is the input file closed in order? def read_data_file(self): with open(self.data_file) as f: return json.loads(f.read()) The file will be closed when the

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Heiko Wundram
Am 28.03.2012 11:43, schrieb Peter Daum: ... in my example, the variable s points to a string, i.e. a series of bytes, (0x61,0x62 ...) interpreted as ascii/unicode characters. No; a string contains a series of codepoints from the unicode plane, representing natural language characters (at

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Stefan Behnel
Peter Daum, 28.03.2012 11:43: What I am looking for is a general way to just copy the raw data from a string object to a byte object without any attempt to decode or encode anything ... That's why I asked about your use case - where does the data come from and why is it contained in a

errors building python 2.7.3

2012-03-28 Thread Alexey Luchko
Hi! I've tried to build Python 2.7.3rc2 on cygwin and got the following errors: $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/ ./configure $ make ... gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/bufferedio.o

unittest: assertRaises() with an instance instead of a type

2012-03-28 Thread Ulrich Eckhardt
Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct: try: foo() self.fail('exception not raised') catch MyException as e:

Difference between json.load() and json.loads() [From: RE: question about file handling with with]

2012-03-28 Thread Nadir Sampaoli
Hello everyone (my first message in the mailing list), Is the following function correct? Yes, though I'd use json.load(f) instead of json.loads(). The docs http://docs.python.org/library/json.html#basic-usage aren't very clear (at least for me) about the difference between json.load() and

Re: Difference between json.load() and json.loads() [From: RE: question about file handling with with]

2012-03-28 Thread ian douglas
On Mar 28, 2012 6:54 AM, Nadir Sampaoli nadirsampa...@gmail.com wrote: Hello everyone (my first message in the mailing list), Is the following function correct? Yes, though I'd use json.load(f) instead of json.loads(). The docs aren't very clear (at least for me) about the difference

Re: python segfault

2012-03-28 Thread Kiuhnm
On 3/28/2012 8:16, Michael Poeltl wrote: yeah - of course 'while True' was the first, most obvious best way... ;-) but I was asked if there was a way without 'while True' and so I started the 'recursive function' and quick quick; RuntimeError-Exception - not thinking much - just adding two

Re: Difference between json.load() and json.loads() [From: RE: question about file handling with with]

2012-03-28 Thread Nadir Sampaoli
2012/3/28 ian douglas The functions with an s take string parameters. The others take file streams. foo = '{age: 38}' my_json = json.loads(foo) I see, it makes perfectly sense now. Thanks for clearing it up. -- http://mail.python.org/mailman/listinfo/python-list

Work

2012-03-28 Thread Alicja Krzyżanowska
Hello My name is Alicja Krzyżanowska and I represent Software Press company We are creating a New version of popular magazine PHP Solution (English version), which will be available online. We are looking for a specialist in Python, who will be interested in writing some articles in this

Re: errors building python 2.7.3

2012-03-28 Thread Alexey Luchko
On 28.03.2012 14:50, Alexey Luchko wrote: Hi! I've tried to build Python 2.7.3rc2 on cygwin and got the following errors: $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/ ./configure $ make ... gcc -shared -Wl,--enable-auto-image-base

RE: RE: Advise of programming one of my first programs

2012-03-28 Thread Prasad, Ramit
The use of eval is dangerous if you are not *completely* sure what is being passed in. Try using pickle instead: http://docs.python.org/release/2.5.2/lib/pickle-example.html Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is

Re: Question about collections.defaultdict

2012-03-28 Thread Steven W. Orr
On 3/26/2012 11:52 AM, Robert Kern wrote: On 3/26/12 4:33 PM, Steven W. Orr wrote: On 3/26/2012 9:44 AM, Robert Kern wrote: On 3/26/12 2:33 PM, Steven W. Orr wrote: I created a new class called CaseInsensitiveDict (by stealing from code I found on the web, thank you very much). The new class

Re: errors building python 2.7.3

2012-03-28 Thread Colton Myers
Reporting here, because bugs.python.org refuses connections currently. bugs.python.org seems to be back up, I'd repost there if you haven't already. -- Colton Myers -- http://mail.python.org/mailman/listinfo/python-list

Re: errors building python 2.7.3

2012-03-28 Thread David Robinow
On Wed, Mar 28, 2012 at 7:50 AM, Alexey Luchko l...@ank-sia.com wrote: I've tried to build Python 2.7.3rc2 on cygwin and got the following errors: $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/ ./configure I haven't tried 2.7.3 yet, so I'll describe my experience with

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Chris Angelico ros...@gmail.com wrote: What is a string? It's not a series of bytes. Of course it is. Conceptually you're not supposed to think of it that way, but a string is stored in memory as a series of bytes. What he's asking for many not be very useful or practical, but if that's your

Re: Tools for refactoring/obfuscation

2012-03-28 Thread Javier
Yes, in general I follow clear guidelines for writing code. I just use modules with functions in the same directory and clear use of name spaces. I almost never use classes. I wonder if you use some tool for refactoring. I am mainly intersted in scripting tools, no eclipse-style guis. Just let

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Chris Angelico
On Thu, Mar 29, 2012 at 2:36 AM, Ross Ridge rri...@csclub.uwaterloo.ca wrote: Chris Angelico  ros...@gmail.com wrote: What is a string? It's not a series of bytes. Of course it is.  Conceptually you're not supposed to think of it that way, but a string is stored in memory as a series of bytes.

ResponseNotReady in httplib

2012-03-28 Thread Manu
Hi I try to access a web site and it returns me this exception ResponseNotReady . I don't know what is the root of the problem and how to sort it out. I am using the excellent python requests library to access the web site but it relies on httplib utlimately. Could someone one explains me the

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Grant Edwards
On 2012-03-28, Chris Angelico ros...@gmail.com wrote: for all you know, it might actually be stored as a sequence of apples in a refrigerator [...] There's no logical Python way to turn that into a series of bytes. There's got to be a joke there somewhere about how to eat an apple... --

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Dave Angel
On 03/28/2012 04:56 AM, Peter Daum wrote: Hi, is there any way to convert a string to bytes without interpreting the data in any way? Something like: s='abcde' b=bytes(s, unchanged) Regards, Peter You needed to specify that you are using Python 3.x . In

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Peter Daum
On 2012-03-28 12:42, Heiko Wundram wrote: Am 28.03.2012 11:43, schrieb Peter Daum: ... in my example, the variable s points to a string, i.e. a series of bytes, (0x61,0x62 ...) interpreted as ascii/unicode characters. No; a string contains a series of codepoints from the unicode plane,

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Steven D'Aprano
On Wed, 28 Mar 2012 11:36:10 -0400, Ross Ridge wrote: Chris Angelico ros...@gmail.com wrote: What is a string? It's not a series of bytes. Of course it is. Conceptually you're not supposed to think of it that way, but a string is stored in memory as a series of bytes. You don't know that.

Re: unittest: assertRaises() with an instance instead of a type

2012-03-28 Thread Steven D'Aprano
On Wed, 28 Mar 2012 14:28:08 +0200, Ulrich Eckhardt wrote: Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct: try: foo()

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Heiko Wundram
Am 28.03.2012 19:43, schrieb Peter Daum: As it seems, this would be far easier with python 2.x. With python 3 and its strict distinction between str and bytes, things gets syntactically pretty awkward and error-prone (something as innocently looking like s=s+'/' hidden in a rarely reached branch

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Ross Ridge rri...@csclub.uwaterloo.ca wr= Of course it is. =A0Conceptually you're not supposed to think of it that way, but a string is stored in memory as a series of bytes. Chris Angelico ros...@gmail.com wrote: Note that distinction. I said that a string is not a series of bytes; you say

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Steven D'Aprano
On Wed, 28 Mar 2012 11:43:52 +0200, Peter Daum wrote: ... in my example, the variable s points to a string, i.e. a series of bytes, (0x61,0x62 ...) interpreted as ascii/unicode characters. No. Strings are not sequences of bytes (except in the trivial sense that everything in computer memory

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Jussi Piitulainen
Peter Daum writes: ... I was under the illusion, that python (like e.g. perl) stored strings internally in utf-8. In this case the conversion would simple mean to re-label the data. Unfortunately, as I meanwhile found out, this is not the case (nor the apple encoding ;-), so it would indeed

RE: convert string to bytes without changing data (encoding)

2012-03-28 Thread Prasad, Ramit
As it seems, this would be far easier with python 2.x. With python 3 and its strict distinction between str and bytes, things gets syntactically pretty awkward and error-prone (something as innocently looking like s=s+'/' hidden in a rarely reached branch and a seemingly correct program will

RE: convert string to bytes without changing data (encoding)

2012-03-28 Thread Prasad, Ramit
You can read as bytes and decode as ASCII but ignoring the troublesome non-text characters: print(open('text.txt', 'br').read().decode('ascii', 'ignore')) Das fr ASCII nicht benutzte Bit kann auch fr Fehlerkorrekturzwecke (Parittsbit) auf den Kommunikationsleitungen oder fr andere

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ian Kelly
On Wed, Mar 28, 2012 at 11:43 AM, Peter Daum ga...@cs.tu-berlin.de wrote: ... I was under the illusion, that python (like e.g. perl) stored strings internally in utf-8. In this case the conversion would simple mean to re-label the data. Unfortunately, as I meanwhile found out, this is not the

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Terry Reedy
On 3/28/2012 11:36 AM, Ross Ridge wrote: Chris Angelicoros...@gmail.com wrote: What is a string? It's not a series of bytes. Of course it is. Conceptually you're not supposed to think of it that way, but a string is stored in memory as a series of bytes. *If* it is stored in byte

Re: unittest: assertRaises() with an instance instead of a type

2012-03-28 Thread Terry Reedy
On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct: try: foo() self.fail('exception not raised') catch

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Steven D'Aprano
On Wed, 28 Mar 2012 19:43:36 +0200, Peter Daum wrote: The longer story of my question is: I am new to python (obviously), and since I am not familiar with either one, I thought it would be advisory to go for python 3.x. The biggest problem that I am facing is, that I am often dealing with

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The right way to convert bytes to strings, and vice versa, is via encoding and decoding operations. If you want to dictate to the original poster the correct way to do things then you don't need to do anything more that. You don't

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ethan Furman
Peter Daum wrote: On 2012-03-28 12:42, Heiko Wundram wrote: Am 28.03.2012 11:43, schrieb Peter Daum: ... in my example, the variable s points to a string, i.e. a series of bytes, (0x61,0x62 ...) interpreted as ascii/unicode characters. No; a string contains a series of codepoints from the

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Tim Chase
On 03/28/12 13:05, Ross Ridge wrote: Ross Ridgerri...@csclub.uwaterloo.ca wr= But a Python Unicode string might be stored in several ways; for all you know, it might actually be stored as a sequence of apples in a refrigerator, just as long as they can be referenced correctly. But it is in

Re: Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, Ross Ridge wrote: Steven D'Apranosteve+comp.lang.pyt...@pearwood.info wrote: The right way to convert bytes to strings, and vice versa, is via encoding and decoding operations. If you want to dictate to the original poster the correct way to do things then you

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Tim Chase python.l...@tim.thechases.com wrote: Internally, they're a series of bytes, but they are MEANINGLESS bytes unless you know how they are encoded internally. Those bytes could be UTF-8, UTF-16, UTF-32, or any of a number of other possible encodings[1]. If you get the internal byte

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Albert W. Hopkins
On Wed, 2012-03-28 at 14:05 -0400, Ross Ridge wrote: Ross Ridge rri...@csclub.uwaterloo.ca wr= Of course it is. =A0Conceptually you're not supposed to think of it that way, but a string is stored in memory as a series of bytes. Chris Angelico ros...@gmail.com wrote: Note that

RE: convert string to bytes without changing data (encoding)

2012-03-28 Thread Prasad, Ramit
The right way to convert bytes to strings, and vice versa, is via encoding and decoding operations. If you want to dictate to the original poster the correct way to do things then you don't need to do anything more that. You don't need to pretend like Chris Angelico that there's isn't a

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ethan Furman
Prasad, Ramit wrote: You can read as bytes and decode as ASCII but ignoring the troublesome non-text characters: print(open('text.txt', 'br').read().decode('ascii', 'ignore')) Das fr ASCII nicht benutzte Bit kann auch fr Fehlerkorrekturzwecke (Parittsbit) auf den Kommunikationsleitungen oder

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread John Nagle
On 3/28/2012 10:43 AM, Peter Daum wrote: On 2012-03-28 12:42, Heiko Wundram wrote: Am 28.03.2012 11:43, schrieb Peter Daum: The longer story of my question is: I am new to python (obviously), and since I am not familiar with either one, I thought it would be advisory to go for python 3.x.

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Grant Edwards
On 2012-03-28, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 28 Mar 2012 19:43:36 +0200, Peter Daum wrote: The longer story of my question is: I am new to python (obviously), and since I am not familiar with either one, I thought it would be advisory to go for python

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread MRAB
On 28/03/2012 20:02, Prasad, Ramit wrote: The right way to convert bytes to strings, and vice versa, is via encoding and decoding operations. If you want to dictate to the original poster the correct way to do things then you don't need to do anything more that. You don't need to pretend

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Grant Edwards
On 2012-03-28, Prasad, Ramit ramit.pra...@jpmorgan.com wrote: You can't generally just deal with the ascii portions without knowing something about the encoding. Say you encounter a byte greater than 127. Is it a single non-ASCII character, or is it the leading byte of a multi-byte character?

Re: Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Ross Ridge
Evan Driscoll drisc...@cs.wisc.edu wrote: So yes, you can say that pretending there's not a mapping of strings to internal representation is silly, because there is. However, there's nothing you can say about that mapping. I'm not the one labeling anything as being silly. I'm the one labeling

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Mark Lawrence
On 28/03/2012 20:43, Ross Ridge wrote: Evan Driscolldrisc...@cs.wisc.edu wrote: So yes, you can say that pretending there's not a mapping of strings to internal representation is silly, because there is. However, there's nothing you can say about that mapping. I'm not the one labeling

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Neil Cerutti
On 2012-03-28, Ross Ridge rri...@csclub.uwaterloo.ca wrote: Evan Driscoll drisc...@cs.wisc.edu wrote: So yes, you can say that pretending there's not a mapping of strings to internal representation is silly, because there is. However, there's nothing you can say about that mapping. I'm not

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Terry Reedy
On 3/28/2012 1:43 PM, Peter Daum wrote: The longer story of my question is: I am new to python (obviously), and since I am not familiar with either one, I thought it would be advisory to go for python 3.x. I strongly agree with that unless you have reason to use 2.7. Python 3.3 (.0a1 in

Need Help Using list items as output table names in MsACCESS

2012-03-28 Thread Cathy James
Dear Python folks, I need your help on using list items as output table names in MsACCESS-new to Python- simple would be better: import arcpy, os outSpace = c:\\data\\Info_Database.mdb\\ arcpy.overwriteOutput = True SQL = Database Connections\\SDE_ReadOnly.sde\\ inFcList = [(SDE +

Re: Advise of programming one of my first programs

2012-03-28 Thread Anatoli Hristov
You are correct it is not. :) You code is overly complex making it harder to understand. Try and reduce the problem to the least number of tasks you need. From the Zen of Python, Simple is better than complex. It is a good programming mentality. Complex is better than complicated. :p 2.

Re: RE: Advise of programming one of my first programs

2012-03-28 Thread Anatoli Hristov
Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is being passed in: Oh goodness yes. pickle is exactly as unsafe as eval is. Try running this code: from pickle import loads

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-28 Thread Tim Delaney
On 25 March 2012 11:03, Tim Chase python.l...@tim.thechases.com wrote: On 03/24/12 17:08, Tim Delaney wrote: Absolutely. 10 years ago (when I was just a young lad) I'd say that I'd *forgotten* at least 20 programming languages. That number has only increased. And in the case of COBOL for

Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Steven D'Aprano
On Wed, 28 Mar 2012 15:43:31 -0400, Ross Ridge wrote: I can in fact say what the internal byte string representation of strings is any given build of Python 3. Don't keep us in suspense! Given: Python 3.2.2 (default, Mar 4 2012, 10:50:33) [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2

Re: RE: Advise of programming one of my first programs

2012-03-28 Thread Chris Angelico
Thu, Mar 29, 2012 at 9:36 AM, Anatoli Hristov toli...@gmail.com wrote: Um, at least by my understanding, the use of Pickle is also dangerous if you are not completely sure what is being passed in: Oh goodness yes. pickle is exactly as unsafe as eval is. Try running this code: from

Re: Re: Re: convert string to bytes without changing data (encoding)

2012-03-28 Thread Evan Driscoll
On 3/28/2012 14:43, Ross Ridge wrote: Evan Driscoll drisc...@cs.wisc.edu wrote: So yes, you can say that pretending there's not a mapping of strings to internal representation is silly, because there is. However, there's nothing you can say about that mapping. I'm not the one labeling

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-28 Thread Rodrick Brown
At my current firm we hire people who are efficient in one of the following and familiar with any another C#, Java, C++, Perl, Python or Ruby. We then expect developers to quickly pick up any of the following languages we use in house which is very broad. In our source repository not including

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-28 Thread Chris Angelico
On Thu, Mar 29, 2012 at 11:59 AM, Rodrick Brown rodrick.br...@gmail.com wrote: The best skill any developer can have is the ability to pickup languages very quickly and know what tools work well for which task. Definitely. Not just languages but all tools. The larger your toolkit and the

[issue14386] Expose dictproxy as a public type

2012-03-28 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: But it has nothing to do with weakrefs, so... -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14386 ___

[issue7511] msvc9compiler.py: ValueError when trying to compile with VC Express

2012-03-28 Thread Victor Lin
Victor Lin borns...@gmail.com added the comment: My environment is Windows 7 64bits with VC++ 2008 Express and Python2.7.2. I encountered same problem, I have tried all solution posted here, but non of them work. Eventually, I add C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin to

[issue14428] Implementation of the PEP 418

2012-03-28 Thread Charles-François Natali
Charles-François Natali neolo...@free.fr added the comment: Tiny review. Two more details: - since it's relatively straightforward to cache the last value returned using a static variable, it might be interesting to use this to make sure that the values returned are indeed monotonic - I'm not

[issue14386] Expose dictproxy as a public type

2012-03-28 Thread Guido van Rossum
Guido van Rossum gu...@python.org added the comment: Since it has to go *somewhere*, let's put it in the types module. It has a variety of other types that are used in the implementation of classes and functions and related things. -- ___ Python

[issue14408] Support the load_tests protocol in the stdlib tests

2012-03-28 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: Yes, it would be preferable if unittest could load the set of test classes for each of these test modules without *requiring* a load_tests function. Each test module will need looking at to see if the standard set of test classes

[issue14432] Bug in generator if the generator in created in a C thread

2012-03-28 Thread STINNER Victor
New submission from STINNER Victor victor.stin...@gmail.com: We have a crash in our product when tracing is enabled by sys.settrace() and threading.settrace(). If a Python generator is created in a C thread, calling the generator later in another thread may crash if Python tracing is enabled.

[issue14408] Support the load_tests protocol in the stdlib tests

2012-03-28 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Your presumption is probably correct, however if that is the premise of the patch it is incorrect in detail, since we've already fixed test_queue specifically to be runnable with -m unittest without adding a load_tests. I haven't

[issue14432] Bug in generator if the generator in created in a C thread

2012-03-28 Thread Ross Lagerwall
Ross Lagerwall rosslagerw...@gmail.com added the comment: Here's the patch ;-) -- keywords: +patch nosy: +rosslagerwall Added file: http://bugs.python.org/file25055/generator.patch ___ Python tracker rep...@bugs.python.org

[issue7511] msvc9compiler.py: ValueError when trying to compile with VC Express

2012-03-28 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Victor, can you apply this patch and report that it works. In particular, if it does *not* work, can you please report the exact way of failing? (if you can, please also try to investigate why it fails). --

[issue14432] Bug in generator if the generator in created in a C thread

2012-03-28 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: The proposed fix sounds reasonable to me. Would it be possible to work something into test_capi to actually test it? -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org

[issue14322] More test coverage for hmac

2012-03-28 Thread Vijay Majagaonkar
Changes by Vijay Majagaonkar vijay.majagaon...@gmail.com: -- nosy: +Vijay.Majagaonkar ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14322 ___ ___

[issue14432] Bug in generator if the generator in created in a C thread

2012-03-28 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: It may not even have to specifically test the crash - any operation that accessed the tstate on the frame and could be shown to be accessing the wrong thread state when called from another thread could demonstrate the problem. --

[issue14408] Support the load_tests protocol in the stdlib tests

2012-03-28 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Of course this would remove the possibility to run things like “../../python test_shutil.py” I was wrong: we would just have the usual two-liner invoking unittest.main. What would be broken is running via regrtest if we remove test_main

[issue14408] Support ./python -m unittest in the stdlib tests

2012-03-28 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- title: Support the load_tests protocol in the stdlib tests - Support ./python -m unittest in the stdlib tests ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14408

[issue14408] Support ./python -m unittest in the stdlib tests

2012-03-28 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: The test_main functions can be converted to use unittest discovery, though. That's what I did for test_email. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14408

[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-28 Thread Esben Agerbæk Black
Esben Agerbæk Black esbe...@gmail.com added the comment: Patch updated with sanity checks. -- Added file: http://bugs.python.org/file25056/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423

[issue14408] Support ./python -m unittest in the stdlib tests

2012-03-28 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: Test discovery is only needed for finding tests in directories of tests - for a single test module the standard test loader should work fine. -- ___ Python tracker rep...@bugs.python.org

[issue12643] code.InteractiveConsole ignores sys.excepthook

2012-03-28 Thread Florent Xicluna
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12643 ___ ___ Python-bugs-list

[issue14408] Support ./python -m unittest in the stdlib tests

2012-03-28 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Right. What I meant to say was test_main can be converted to use normal unittest test loading. test_email is not an example of that, since it does use test discovery, but is a good example of a test collection that works with both

[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-28 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- keywords: +needs review nosy: +belopolsky stage: - patch review versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.4 ___ Python tracker rep...@bugs.python.org

[issue7511] msvc9compiler.py: ValueError when trying to compile with VC Express

2012-03-28 Thread Victor Lin
Victor Lin borns...@gmail.com added the comment: Oddly, can't reproduce the problem anymore. I try to install win7 on virtual machine, but it works as well. I think the issue might caused by something else... not sure, so strange :S Will look into detail once I encounter this issue again.

[issue14409] IDLE does not execute any commands (command prompt works fine!)

2012-03-28 Thread Ankit Agrawal
Ankit Agrawal ankit...@gmail.com added the comment: Another cfg file from the original .idlerc folder -- Added file: http://bugs.python.org/file25058/config-main.cfg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14409

[issue14409] IDLE does not execute any commands (command prompt works fine!)

2012-03-28 Thread Ankit Agrawal
Ankit Agrawal ankit...@gmail.com added the comment: Please find attached, the original .cfg files that I was found in my idlerc folder. I hope this proves helpful. If you need any other information I'd be glad to help. -- status: pending - open Added file:

[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-28 Thread Esben Agerbæk Black
Esben Agerbæk Black esbe...@gmail.com added the comment: Patch updated with tests and documentation -- Added file: http://bugs.python.org/file25059/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423

[issue14433] Python 3 interpreter crash with memoryview and os.fdopen

2012-03-28 Thread Alexis Daboville
New submission from Alexis Daboville alexis.dabovi...@gmail.com: Hi, I was playing with memoryviews when I found this behaviour, launch the Python shell, and then enter the following: import os memoryview(os.fdopen(0)) A TypeError cannot make memory view because object does not have the

[issue14432] Bug in generator if the generator in created in a C thread

2012-03-28 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14432 ___ ___

[issue14433] Python 3 interpreter crash with memoryview and os.fdopen

2012-03-28 Thread Charles-François Natali
Charles-François Natali neolo...@free.fr added the comment: Hello, This has actually nothing to do with memoryview: import os [67212 refs] stdin = os.fdopen(0) [67234 refs] del stdin __main__:1: ResourceWarning: unclosed file _io.TextIOWrapper name=0 mode='r' encoding='UTF-8' [67260 refs]

  1   2   >