c 0.5.0 Release: Compile extension modules on Import

2012-08-06 Thread James Pye
c is an alternative to distutils' Extension() support or Makefile compilation of simple extension modules. It provides a meta_path hook that performs compilation and linkage of C, C++, or Objective-C source files upon import. Any Python implementation providing a functional sysconfig module

Re: [newbie] Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Steven D'Aprano
On Sun, 05 Aug 2012 21:14:04 -0400, Dennis Lee Bieber wrote: While I've probably used singletons (usually as sentinels in queues, I don't know your code, but if I were to take a wild guess, I would say that apart from None, and True/False, you probably haven't. NotImplemented and Ellipsis are

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Wolfgang Strobl
Dennis Lee Bieber wlfr...@ix.netcom.com: Don't look for Object-Oriented Programming -- since the first widely popular OOP language was C++ (Smalltalk was earlier, but rather specialized, whereas C++ started as a preprocessor for C). Well, C++ did to C what Simula 67 did to Algol 60, much

Re: On-topic: alternate Python implementations

2012-08-06 Thread Stefan Behnel
alex23, 06.08.2012 05:40: On Aug 4, 4:15 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: But the Python ecosystem is a lot bigger than just those four. Here are just a few other implementations that you might be interested in: There's also HotPy:

Re: On-topic: alternate Python implementations

2012-08-06 Thread Stefan Behnel
Jürgen A. Erhard, 05.08.2012 14:28: On Sun, Aug 05, 2012 at 07:46:59AM +0200, Stefan Behnel wrote: Jürgen A. Erhard, 05.08.2012 01:25: None of the other implementations require Python for actually compiling or running Python source. Nuitka was on the list as well. True, which I realized

Re: [newbie] Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Paul Rubin
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: I suspect), but can't say that I've ever used a factory function... If you've ever used an ordinary function decorator, you almost certainly have. If you've every created a closure, you definitely have. Or anything with a __iter__

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread lipska the kat
On 05/08/12 23:51, Steven D'Aprano wrote: On Sun, 05 Aug 2012 18:45:47 -0400, Dennis Lee Bieber wrote: Don't look for Object-Oriented Programming -- since the first widely popular OOP language was C++ (Smalltalk was earlier, but rather specialized, whereas C++ started as a preprocessor for C).

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread lipska the kat
On 06/08/12 01:27, Steven D'Aprano wrote: On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote: Good lord. I'd rather read C++ than UML. And I can't read C++. UML is under-rated. I certainly don't have any love of the 47 different flavors of diagram, but the basic idea of having a common

Re: [newbie] Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread lipska the kat
On 06/08/12 01:22, Steven D'Aprano wrote: On Sun, 05 Aug 2012 20:46:23 +0100, lipska the kat wrote: rant Object Oriented programming is a mindset, a way of looking at that particular part of our world that you are trying to encapsulate in computer language. The language you use is (should be)

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread DJC
On 06/08/12 02:27, Steven D'Aprano wrote: On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote: Good lord. I'd rather read C++ than UML. And I can't read C++. UML is under-rated. I certainly don't have any love of the 47 different flavors of diagram, but the basic idea of having a common

Re: [newbie] Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread lipska the kat
On 06/08/12 09:55, lipska the kat wrote: On 06/08/12 01:22, Steven D'Aprano wrote: On Sun, 05 Aug 2012 20:46:23 +0100, lipska the kat wrote: rant snip Well as you seem to be so concerned with terminology I'd have to disagree with you here. An interface (in computing) has any number of

Re: distutils bdist_wininst failure on Linux

2012-08-06 Thread Bob Bowles
Steven D'Aprano-11 wrote And I have a work-around that seems to work for me. Put this at the top of your setup.py install script: # Work around mbcs bug in distutils. # http://bugs.python.org/issue10945 import codecs try: codecs.lookup('mbcs') except LookupError: ascii =

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread rusi
On Aug 6, 12:46 am, lipska the kat lipskathe...@yahoo.co.uk wrote: On 04/08/12 16:49, Jean Dubois wrote: I'm looking for a good introduction to object oriented programming with Python. Object Oriented programming is a mindset, a way of looking at that particular part of our world that

Re: conditional running of code portion

2012-08-06 Thread Ramchandra Apte
I just googled the OP's question and found a StackOverflow question. That question's solution mentions pypreprocessor. On 6 August 2012 08:20, Steven W. Orr ste...@syslang.net wrote: On 8/5/2012 12:43 AM, Ramchandra Apte wrote: Try pypreprocessor

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Roy Smith
In article w42dnzxof-it6ilnnz2dnuvz8vydn...@bt.com, lipska the kat lipskathe...@yahoo.co.uk wrote: UML works, non technical 'stakeholders' (yuk) can understand it at a high level and in my HUMBLE opinion the sequence diagram is the single most important piece of documentation in the entire

Pickle file and send via socket

2012-08-06 Thread S.B
Hello friends Does anyone know if it's possible to pickle and un-pickle a file across a network socket. i.e: First host pickles a file object and writes the pickled file object to a client socket. Second host reads the pickled file object from the server socket and un-pickles it. Can anyone

Re: Pickle file and send via socket

2012-08-06 Thread Ramchandra Apte
This is *absolutely* possible. Did you know that IDLE uses this very method when run in sub-process mode! On 6 August 2012 19:02, S.B hyperboo...@gmail.com wrote: Hello friends Does anyone know if it's possible to pickle and un-pickle a file across a network socket. i.e: First host pickles

Re: Pickle file and send via socket

2012-08-06 Thread Ramchandra Apte
You can use pickle.dumpshttp://docs.python.org/library/pickle.html#pickle.dumps and pickle.loads http://docs.python.org/library/pickle.html#pickle.loads On 6 August 2012 19:17, Ramchandra Apte maniandra...@gmail.com wrote: This is *absolutely* possible. Did you know that IDLE uses this very

cant upload the python window popup

2012-08-06 Thread Mario Blanco
I delete by error the python window inteface and now i cant reupload again some advice is apreciated thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread lipska the kat
On 06/08/12 13:19, rusi wrote: On Aug 6, 12:46 am, lipska the katlipskathe...@yahoo.co.uk wrote: On 04/08/12 16:49, Jean Dubois wrote: I'm looking for a good introduction to object oriented programming with Python. Object Oriented programming is a mindset, a way of looking at that

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Jean Dubois
On 5 aug, 20:28, Mark Lawrence breamore...@yahoo.co.uk wrote: On 05/08/2012 19:04, Jean Dubois wrote: On 5 aug, 02:11, shearich...@gmail.com wrote: One reason you may be having difficulty is that unlike some languages (C++/Java) object-orientation is not a be all and end all in

Re: dbf.py API question

2012-08-06 Thread Ethan Furman
[redirecting back to list] Ole Martin Bjørndalen wrote: On Sun, Aug 5, 2012 at 4:09 PM, Ethan Furman et...@stoneleaf.us wrote: Ole Martin Bjørndalen wrote: You can do this by implementing either __getitem__ or __iter__, unless the streaming flag would also make your table not in memory.

Re: cant upload the python window popup

2012-08-06 Thread Ramchandra Apte
Please explain the problem like this: 1. What you expected 2. What happened 3. Other info. On 6 August 2012 19:25, Mario Blanco mablanga2...@gmail.com wrote: I delete by error the python window inteface and now i cant reupload again some advice is apreciated thanks --

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Ramchandra Apte
Its a docstring - it documents the function/class Did you know that docstrings can be used for testing - look at the doctest standard library module! try: class A: def method(self): '''Sample method This method does the difficult task X. Call this method with no

looking for a neat solution to a nested loop problem

2012-08-06 Thread Tom P
consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and I want to iterate through all 10,000 values in sequence - is there a neat

Re: Intermediate Python user needed help

2012-08-06 Thread Ethan Furman
John Mordecai Dildy wrote: I am currently using python 2.6 and am not going to install the newer versions of python and i am looking for people that are still using ver 2.6 in python to help with with the code line: sentence = All good things come to those who wait. then im getting this

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Oscar Benjamin
Are you familiar with the itertools module? itertools.product is designed for this purpose: http://docs.python.org/library/itertools#itertools.product Oscar. On 6 August 2012 16:52, Tom P werot...@freent.dd wrote: consider a nested loop algorithm - for i in range(100): for j in

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Oscar Benjamin
On 6 August 2012 16:52, Tom P werot...@freent.dd wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and I want to

Script to easily install eGenix PyRun in a target directory

2012-08-06 Thread M.-A. Lemburg
Hello, in case you haven't heard of eGenix PyRun yet, this is a new simple to install Python runtime that can be used independently of a system installed Python version and is very small compared to a regular Python installation. See http://www.egenix.com/products/python/PyRun/ for details.

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Ethan Furman
Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and I want to iterate through all 10,000 values in sequence - is

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread John Gordon
In a8a7hvf8c...@mid.individual.net Tom P werot...@freent.dd writes: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and

Re: Intermediate Python user needed help

2012-08-06 Thread Alec Taylor
On Tue, Aug 7, 2012 at 2:05 AM, Ethan Furman et...@stoneleaf.us wrote: John Mordecai Dildy wrote: I am currently using python 2.6 and am not going to install the newer versions of python and i am looking for people that are still using ver 2.6 in python to help with with the code line:

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Ian Foote
The function range can be called with more than one argument. For example: for i in range(N, N + 10): for j in range(M, M + 100): do_something(i, j) You can also call range with 3 arguments, if want a step size different to 1: for k in range(2, 11, 3): print(k) 2 5 8 Hope

Re: Pickle file and send via socket

2012-08-06 Thread Nobody
On Mon, 06 Aug 2012 06:32:13 -0700, S.B wrote: Does anyone know if it's possible to pickle and un-pickle a file across a network socket. i.e: First host pickles a file object and writes the pickled file object to a client socket. Second host reads the pickled file object from the server

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Mark Lawrence
Please see my comment at the bottom hint hint :) On 06/08/2012 16:38, Ramchandra Apte wrote: Its a docstring - it documents the function/class Did you know that docstrings can be used for testing - look at the doctest standard library module! try: class A: def method(self):

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Nobody
On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and I want to iterate

OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python)

2012-08-06 Thread lipska the kat
On 06/08/12 13:19, rusi wrote: On Aug 6, 12:46 am, lipska the katlipskathe...@yahoo.co.uk wrote: On 04/08/12 16:49, Jean Dubois wrote: I'm looking for a good introduction to object oriented programming with Python. snip I suggest this

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread rusi
On Aug 6, 7:27 pm, lipska the kat lipskathe...@yahoo.co.uk wrote: You take out the garbage. I've got automatic garbage collection :-) BTW in automatic garbage collection which of the three words is most important? Least? Heres another take on nouns (and therefore OO):

Re: Pickle file and send via socket

2012-08-06 Thread Christian Heimes
Am 06.08.2012 15:32, schrieb S.B: Does anyone know if it's possible to pickle and un-pickle a file across a network socket. i.e: First host pickles a file object and writes the pickled file object to a client socket. Second host reads the pickled file object from the server socket and

Re: conditional running of code portion

2012-08-06 Thread Dieter Maurer
Serhiy Storchaka storch...@gmail.com writes: On 05.08.12 09:30, Steven D'Aprano wrote: If you are working in a tight loop, you can do this: if VERBOSE_FLAG: for item in loop: print(DEBUG_INFORMATION) do_actual_work(item) else: for item in loop:

Re: Intermediate Python user needed help

2012-08-06 Thread Jean-Michel Pichavant
Ethan Furman wrote: ~Ethan~ P.S. The scale I am accustomed to is Novice - Intermediate - Advanced - Master Are there scales out there that would put these types of questions in the intermediate category? Troll - Novice - Intermediate - Advanced Trolls are quite specific, they're able to

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Tom P
On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i =

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Tom P
On 08/06/2012 06:03 PM, John Gordon wrote: In a8a7hvf8c...@mid.individual.net Tom P werot...@freent.dd writes: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Oscar Benjamin
On 6 August 2012 18:14, Tom P werot...@freent.dd wrote: On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to

Re: Deciding inheritance at instantiation?

2012-08-06 Thread Tobiah
On 08/03/2012 02:55 PM, Terry Reedy wrote: On 8/3/2012 4:48 PM, Tobiah wrote: I have a bunch of classes from another library (the html helpers from web2py). There are certain methods that I'd like to add to every one of them. So I'd like to put those methods in a class, and pass the parent at

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Emile van Sebille
On 8/6/2012 10:14 AM Tom P said... On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread André Malo
* Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and I want to iterate through all 10,000 values in

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Grant Edwards
On 2012-08-06, Grant Edwards invalid@invalid.invalid wrote: On 2012-08-06, Tom P werot...@freent.dd wrote: On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100):

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Grant Edwards
On 2012-08-06, Tom P werot...@freent.dd wrote: On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Tom P
On 08/06/2012 08:29 PM, Grant Edwards wrote: On 2012-08-06, Grant Edwards invalid@invalid.invalid wrote: On 2012-08-06, Tom P werot...@freent.dd wrote: On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Grant Edwards
On 2012-08-06, Tom P werot...@freent.dd wrote: no, I meant something else .. j runs through range(M, 100) and then range(0,M), and i runs through range(N,100) and then range(0,N) In 2.x: for i in range(M,100)+range(0,M): for j in range(N,100)+range(0,N):

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Emile van Sebille
On 8/6/2012 12:22 PM Grant Edwards said... On 2012-08-06, Tom P werot...@freent.dd wrote: snip ah, that looks good - I guess it works in 2.x as well? I don't know. Let me test that for you... snip Yes, it works in 2.x as well. :) And from the docs, all the way back to 2.3! 9.7.

A difficulty with lists

2012-08-06 Thread Mok-Kong Shen
I ran the following code: def xx(nlist): print(begin: ,nlist) nlist+=[999] print(middle:,nlist) nlist=nlist[:-1] print(final: ,nlist) u=[1,2,3,4] print(u) xx(u) print(u) and obtained the following result: [1, 2, 3, 4] begin: [1, 2, 3, 4] middle: [1, 2, 3, 4, 999] final: [1, 2, 3,

Re: A difficulty with lists

2012-08-06 Thread Chris Kaynor
On Mon, Aug 6, 2012 at 12:50 PM, Mok-Kong Shen mok-kong.s...@t-online.dewrote: I ran the following code: def xx(nlist): print(begin: ,nlist) nlist+=[999] This is modifying the list in-place - the actual object is being changed to append 999. This can happen because lists are mutable

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Arnaud Delobelle
On 6 August 2012 16:52, Tom P werot...@freent.dd wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial values, but some other values i = N and j = M, and I want to

Re: A difficulty with lists

2012-08-06 Thread MRAB
On 06/08/2012 20:50, Mok-Kong Shen wrote: I ran the following code: def xx(nlist): print(begin: ,nlist) nlist+=[999] print(middle:,nlist) nlist=nlist[:-1] print(final: ,nlist) u=[1,2,3,4] print(u) xx(u) print(u) and obtained the following result: [1, 2, 3, 4] begin: [1,

find out whether a module exists (without importing it)

2012-08-06 Thread Gelonida N
Is this possible. let's say I'd like to know whether I could import the module 'mypackage.mymodule', meaning, whther this module is located somewhere in sys.path i tried to use imp.find_module(), but it didn't find any module name containing a '.' Am I doing anything wrong? Is there another

[newbie] String to binary conversion

2012-08-06 Thread Mok-Kong Shen
If I have a string abcd then, with 8-bit encoding of each character, there is a corresponding 32-bit binary integer. How could I best obtain that integer and from that integer backwards again obtain the original string? Thanks in advance. M. K. Shen --

Re: [newbie] String to binary conversion

2012-08-06 Thread Tobiah
The binascii module looks like it might have something for you. I've never used it. Tobiah http://docs.python.org/library/binascii.html On 08/06/2012 01:46 PM, Mok-Kong Shen wrote: If I have a string abcd then, with 8-bit encoding of each character, there is a corresponding 32-bit binary

Re: conditional running of code portion

2012-08-06 Thread Serhiy Storchaka
On 06.08.12 20:02, Dieter Maurer wrote: Serhiy Storchaka storch...@gmail.com writes: On 05.08.12 09:30, Steven D'Aprano wrote: If you are working in a tight loop, you can do this: if VERBOSE_FLAG: for item in loop: print(DEBUG_INFORMATION) do_actual_work(item) else:

Re: [newbie] String to binary conversion

2012-08-06 Thread Tobiah
On 08/06/2012 01:59 PM, Tobiah wrote: The binascii module looks like it might have something for you. I've never used it. Having actually read some of that doc, I see it's not what you want at all. Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: [newbie] String to binary conversion

2012-08-06 Thread Mok-Kong Shen
Am 06.08.2012 22:59, schrieb Tobiah: The binascii module looks like it might have something for you. I've never used it. Thanks for the hint, but if I don't err, the module binascii doesn't seem to work. I typed: import binascii and a line that's given as example in the document: crc =

Re: [newbie] String to binary conversion

2012-08-06 Thread MRAB
On 06/08/2012 21:46, Mok-Kong Shen wrote: If I have a string abcd then, with 8-bit encoding of each character, there is a corresponding 32-bit binary integer. How could I best obtain that integer and from that integer backwards again obtain the original string? Thanks in advance. Try this

Re: find out whether a module exists (without importing it)

2012-08-06 Thread Miki Tebeka
imp.find_module(), but it didn't find any module name containing a '.' The docs (http://docs.python.org/library/imp.html#imp.find_module) clearly say: This function does not handle hierarchical module names (names containing dots). In order to find P.M, that is, submodule M of package P, use

Re: Intermediate Python user needed help

2012-08-06 Thread Chris Angelico
On Tue, Aug 7, 2012 at 5:22 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: So am I beginner, intermediate, advanced, expert? I wonder would this sort of a scale help: http://www.geekcode.com/geek.html#perl Novice: P Intermediate: P+ or P++ Advanced: P+++ Master: P ChrisA --

Re: find out whether a module exists (without importing it)

2012-08-06 Thread Gelonida N
On 08/06/2012 11:58 PM, Miki Tebeka wrote: imp.find_module(), but it didn't find any module name containing a '.' The docs (http://docs.python.org/library/imp.html#imp.find_module) clearly say: This function does not handle hierarchical module names(names containing dots). Thanks, Well this

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Chris Angelico
On Tue, Aug 7, 2012 at 2:34 AM, rusi rustompm...@gmail.com wrote: BTW in automatic garbage collection which of the three words is most important? Least? Most important is garbage. I sure don't want any language I use to automatically collect non-garbage!! But in seriousness, the definition of

Re: [newbie] String to binary conversion

2012-08-06 Thread Emile van Sebille
On 8/6/2012 1:46 PM Mok-Kong Shen said... If I have a string abcd then, with 8-bit encoding of each character, there is a corresponding 32-bit binary integer. How could I best obtain that integer and from that integer backwards again obtain the original string? Thanks in advance. It's easy to

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Steven D'Aprano
On Mon, 06 Aug 2012 17:17:33 +0100, Mark Lawrence wrote: Please see my comment at the bottom hint hint :) Please trim unnecessary quoted text. We don't need to see the entire thread of comment/reply/reply-to-reply duplicated in *every* email. -- Steven --

Re: Intermediate Python user needed help

2012-08-06 Thread Steven D'Aprano
On Mon, 06 Aug 2012 09:05:50 -0700, Ethan Furman wrote: These are not the errors an intermediate user would make, nor the questions an intermediate user would ask. These are the errors that somebody who doesn't know Python would make. P.S. The scale I am accustomed to is Novice -

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Please trim unnecessary quoted text. We don't need to see the entire thread of comment/reply/reply-to-reply duplicated in *every* email. s/every/any/ -- \ “If you make people think they're thinking, they'll love you; |

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Steven D'Aprano
On Mon, 06 Aug 2012 19:16:45 +0200, Tom P wrote: def my_generator(): yield 9 yield 100 for i in range(200, 250): yield i yield 5 Thanks, I'll look at that but I think it just moves the clunkiness from one place in the code to another. And if there was a

Re: [newbie] String to binary conversion

2012-08-06 Thread Steven D'Aprano
On Mon, 06 Aug 2012 22:46:38 +0200, Mok-Kong Shen wrote: If I have a string abcd then, with 8-bit encoding of each character, there is a corresponding 32-bit binary integer. How could I best obtain that integer and from that integer backwards again obtain the original string? Thanks in

Re: Deciding inheritance at instantiation?

2012-08-06 Thread alex23
On Aug 4, 6:48 am, Tobiah t...@tobiah.org wrote: I have a bunch of classes from another library (the html helpers from web2py).  There are certain methods that I'd like to add to every one of them.  So I'd like to put those methods in a class, and pass the parent at the time of instantiation.  

Re: Intermediate Python user needed help

2012-08-06 Thread Jugurtha Hadjar
On 08/05/2012 09:52 PM, John Mordecai Dildy wrote: NameError: name 'start' is not defined anyone know how to make start defined Maybe rename it defined_start ;) I wonder how someone can get to the point of writing more than 76 lines of code while not only still making this kind of errors,

Re: Intermediate Python user needed help

2012-08-06 Thread rusi
On Aug 7, 6:16 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 06 Aug 2012 09:05:50 -0700, Ethan Furman wrote:   These are not the errors an intermediate user would make, nor the questions an intermediate user would ask.  These are the errors that somebody who

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Larry Hudson
On 08/06/2012 11:11 AM, Emile van Sebille wrote: snip for i in range(N,N+100): for j in range(M,M+100): do_something(i % 100 ,j % 100) Emile How about... for i in range(100): for j in range(100): do_something((i + N) % 100, (j + M) % 100)

Re: The way to develope a graphical application to manage a Postgres database

2012-08-06 Thread rusi
On Aug 5, 11:26 pm, Csanyi Pal csanyi...@gmail.com wrote: Mark Lawrence breamore...@yahoo.co.uk writes: On 05/08/2012 16:58, Csanyi Pal wrote: Walter Hurry walterhu...@lavabit.com writes: On Thu, 02 Aug 2012 20:24:36 +0200, Csanyi Pal wrote: I'm searching for a way to develope a Python

Alternate Python extensions (was alternate Python implementations)

2012-08-06 Thread rusi
On Aug 4, 11:15 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Most people are aware, if only vaguely, of the big Four Python implementations: I think the question about where Cython fits into this, raises the need for a complementary list to Steven's. What are the different

Re: Alternate Python extensions (was alternate Python implementations)

2012-08-06 Thread Stefan Behnel
rusi, 07.08.2012 06:23: On Aug 4, 11:15 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Most people are aware, if only vaguely, of the big Four Python implementations: I think the question about where Cython fits into this, raises the need for a complementary list to

Re: [newbie] Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Steven D'Aprano
On Mon, 06 Aug 2012 09:55:24 +0100, lipska the kat wrote: On 06/08/12 01:22, Steven D'Aprano wrote: On Sun, 05 Aug 2012 20:46:23 +0100, lipska the kat wrote: rant Object Oriented programming is a mindset, a way of looking at that particular part of our world that you are trying to

Re: [newbie] Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread Steven D'Aprano
On Mon, 06 Aug 2012 10:24:10 +0100, lipska the kat wrote: er, the point I was trying to make is that when you say 'interface' it could mean so many things. If you say 'facade' everyone knows exactly what you are talking about. And that is EXACTLY the point. The whole point of design patterns

Re: Intermediate Python user needed help

2012-08-06 Thread rusi
On Aug 7, 8:06 am, Jugurtha Hadjar jugurtha.had...@gmail.com wrote: On 08/05/2012 09:52 PM, John Mordecai Dildy wrote: NameError: name 'start' is not defined anyone know how to make start defined Maybe rename it defined_start ;) I wonder how someone can get to the point of writing more

[issue8912] `make patchcheck` should check the whitespace of .c/.h files

2012-08-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8912 ___ ___ Python-bugs-list

[issue15563] wrong conversion reported by

2012-08-06 Thread Walid Shaari
New submission from Walid Shaari: In the code below the time stamp 1341183050 should be 01 July 2012. however datetime is converting it back to 7 July 2012, the reverse too is wrong, is that just the way i am using the code? [g_geadm@plcig2 ~]$ ipython Python 2.6.5 (r265:79063, Jul 14 2010,

[issue15563] wrong conversion reported by

2012-08-06 Thread Walid Shaari
Walid Shaari added the comment: the issue i believe is in datetime module -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15563 ___ ___

[issue15545] sqlite3.Connection.iterdump() does not work with row_factory = sqlite3.Row

2012-08-06 Thread Pierre Le Marre
Pierre Le Marre added the comment: By the way, this issue does not appear with Python 3.2.2. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15545 ___

[issue15563] wrong conversion reported by

2012-08-06 Thread Martin v . Löwis
Martin v. Löwis added the comment: It's a timezone issue. Try datetime.datetime.utcfromtimestamp(1341183050) -- nosy: +loewis resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15563

[issue15509] webbrowser.open sometimes passes zero-length argument to the browser.

2012-08-06 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15509 ___ ___

[issue15523] Block on close TCP socket in SocketServer.py

2012-08-06 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15523 ___ ___ Python-bugs-list

[issue15520] Document datetime.timestamp() in 3.3 What's New

2012-08-06 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15520 ___ ___

[issue15506] configure should use PKG_PROG_PKG_CONFIG

2012-08-06 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15506 ___ ___

[issue15504] pickle/cPickle saves invalid/incomplete data

2012-08-06 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15504 ___ ___

[issue15501] Document exception classes in subprocess module

2012-08-06 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15501 ___ ___

[issue13072] Getting a buffer from a Unicode array uses invalid format

2012-08-06 Thread Stefan Krah
Stefan Krah added the comment: STINNER Victor rep...@bugs.python.org wrote: Hum, this issue is a regression from Python 3.2. Python 3.2.3+ (3.2:243ad1a6f638+, Aug 4 2012, 01:36:41) [GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2 import array a=array.array('u', 'xyz')

[issue13072] Getting a buffer from a Unicode array uses invalid format

2012-08-06 Thread Stefan Krah
Stefan Krah added the comment: Also, it was suggested that 'u' should be deprecated: http://mail.python.org/pipermail/python-dev/2012-March/117392.html Personally, I don't have an opinion on that; I don't use the 'u' format code. Nick, could you have a look at msg167545 and see if any

[issue15564] cgi.FieldStorage should not call read_multi on files

2012-08-06 Thread patrick vrijlandt
New submission from patrick vrijlandt: .mht is an archive format created by Microsoft IE 8 when saving a webpage. It is essentially a mime multipart message. My problem occurred when I uploaded such a file to a cgi-based server. The posted data would be fed to cgi.FieldStorage. (I can't post

[issue13072] Getting a buffer from a Unicode array uses invalid format

2012-08-06 Thread Stefan Krah
Stefan Krah added the comment: Of course, if two formats *are* the same, it is possible to use memcmp(). I'll work on a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13072 ___

[issue13072] Getting a buffer from a Unicode array uses invalid format

2012-08-06 Thread Nick Coghlan
Nick Coghlan added the comment: Perhaps if memoryview doesn't understand the format code, it can fall back on memcmp() if strcmp() indicates the format codes are the same? Otherwise we're at risk of breaking backwards compatibility with more than just array('u'). Also, if it isn't already,

[issue15565] pdb displays runt Exception strings

2012-08-06 Thread Paul
New submission from Paul: In Python 2.6, pdb doesn't show exception strings properly: #somecode.py import pdb pdb.set_trace() raise Exception('This is a message that contains a lot of characters and is very long indeed.') #terminal somecode.py - raise Exception('This is a message that

  1   2   >