[False,True] and [True,True] --> [True, True]?????

2009-04-20 Thread bdb112
Is there any obvious reason why [False,True] and [True,True] gives [True, True] Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-secure execution environment

2009-04-20 Thread rogeeff
If anyone is interested I end up using rexec kinda class with only difference that i am using native __builtin__ and resetting __import__ hook to and from local r_import implementation before and after I am executing code in my environment. Gennadiy -- http://mail.python.org/mailman/listinfo/pytho

Re: Non-secure execution environment

2009-04-20 Thread rogeeff
If anyone is interested I end up using rexec kinda class with only difference that i am using native __builtin__ and resetting __import__ hook to and from local r_import implementation before and after I am executing code in my environment. Gennadiy -- http://mail.python.org/mailman/listinfo/pytho

Re: [False,True] and [True,True] --> [True, True]?????

2009-04-20 Thread Andre Engels
On Mon, Apr 20, 2009 at 9:03 AM, bdb112 wrote: > Is there any obvious reason why > [False,True] and [True,True] > gives [True, True] Well, whether the reason is obvious, I do not know, but the way and seems to be implemented is: X and Y = * X if the boolean value of X is false * Y if the boolean

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread AggieDan04
On Apr 20, 2:03 am, bdb112 wrote: > Is there any obvious reason why > [False,True] and [True,True] > gives [True, True] > > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit > (Intel)] X and Y == (Y if X else X) X or Y == (X if X else Y) [False, True] is true, so the and operat

Re: [False,True] and [True,True] --> [True, True]?????

2009-04-20 Thread Gabriel Genellina
En Mon, 20 Apr 2009 04:03:28 -0300, bdb112 escribió: Is there any obvious reason why [False,True] and [True,True] gives [True, True] Yes: short-circuit evaluation. [False,True] and [True,True] is *not* an element-by-element operation, it's a simple expression involving two objects (two li

Re: The Python standard library and PEP8

2009-04-20 Thread Lawrence D'Oliveiro
In message , Christian Heimes wrote: > Neither Java nor Python are pure object oriented languages. That's like saying the Soviet Union was never a pure communist country, or that the US is not a pure capitalist country. "Pure", it seems, can be endlessly redefined to exclude any example you mi

Re: The Python standard library and PEP8

2009-04-20 Thread Lawrence D'Oliveiro
In message , Aahz wrote: > What kind of OO language allows you to do this: > > def square(x): > return x*x > > for i in range(10): > print square(x) Take out the "OO" qualifier, and the answer is still "none": Traceback (most recent call last): File "", line 2, in NameEr

Hello everyone!

2009-04-20 Thread Yilong Deng
I'm a newby here, I love python very much. Is there any Chinese here?-- http://mail.python.org/mailman/listinfo/python-list

Re: Can some1 review my code?

2009-04-20 Thread David Lees
zaheer.ag...@gmail.com wrote: When done all this you might feel it is not necessary to review the code any more, which is then is a good moment to actually request a review :-) I'll be happy to have a look at it though you might consider posting it here, more chance of useful feedback ;-) G

PEP 401

2009-04-20 Thread alessiogiovanni . baroni
Are 19 days that I read this PEP; it's all true? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create an unclosed dialog in wxPython?

2009-04-20 Thread liangguanhui
On 4月18日, 下午9时40分, 书虫 wrote: > In wxPython, after I create a wx.Frame, I want to create a modeless > and unclosed dialog. Here is my step: > > app = wx.PySimpleApp() > f = wx.Frame(None, -1, "Test") > d = wx.Dialog(f, -1, "Test Dialog", style = wx.CAPTION) > f.Show() > d.Show() > app.MainLoop() >

Re: The Python standard library and PEP8

2009-04-20 Thread Steven D'Aprano
On Mon, 20 Apr 2009 19:18:23 +1200, Lawrence D'Oliveiro wrote: > In message , Aahz wrote: > >> What kind of OO language allows you to do this: >> >> def square(x): >> return x*x >> >> for i in range(10): >> print square(x) > > Take out the "OO" qualifier, and the answer is still "none"

Re: The Python standard library and PEP8

2009-04-20 Thread Terry Reedy
Steven D'Aprano wrote: On Mon, 20 Apr 2009 19:18:23 +1200, Lawrence D'Oliveiro wrote: In message , Aahz wrote: What kind of OO language allows you to do this: def square(x): return x*x for i in range(10): print square(x) Take out the "OO" qualifier, and the answer is still "none":

Re: QT , Wxwidgets are not just UI framework ?

2009-04-20 Thread Phil Thompson
On Sun, 19 Apr 2009 20:32:23 -0700 (PDT), Old Listener wrote: > On Apr 17, 10:20 am, Phil Thompson > wrote: >> On Fri, 17 Apr 2009 07:04:40 -0700 (PDT), Deep_Feelings >> >> >> >> wrote: >> > On Apr 17, 1:52 pm, "Diez B. Roggisch" wrote: >> >> Deep_Feelings wrote: >> >> > qt include many librari

Re: Equivalent to C bitmasks and enumerations

2009-04-20 Thread Ulrich Eckhardt
Ulrich Eckhardt wrote: [how to handle bitfields and enumerations in Python] Thanks to all that answered. The important lessons I learned: * You can modify classes, other than in C++ where they are statically defined. This allows e.g. adding constants. * __repr__ should provide output suitable as

RE: Keyerror addhandler

2009-04-20 Thread Steven Macintyre
Hi Diez, I am using 2.4, could that be the cuase of your issue below. Ideally, I would like to stay with the 2.4 version and based on two tutorials, this was what I came up with Steven Steven Macintyre schrieb: > Hi all, > > I'm wondering if anyone can assist me with this as I am very confus

best "void" return of a member function

2009-04-20 Thread Andreas Otto
Hi, I'm writing a native language binding for a library. http://libmsgque.sourceforge.net/ Every native method called by PYTHON have to return a PyObject* even if the function itself does not return anything. I have 2 possibilities for return a PyObject* 1.

Re: Is there a programming language that is combination ofPythonandBasic?

2009-04-20 Thread Hendrik van Rooyen
"Chris Jones" wrote: > Intellectually, assembler programming is the less demanding since its > level of abstraction does not go any further than mapping a few binary > numbers to a small set of usually well-chosen mnemonics. This is the surface complexity - it is true that when you write an asse

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread bdb112
THanks Gabriel, Now I know about the zip function. Your explanation of Boolean ops on lists was clear. It leads to some intriguing results: bool([False]) --> True I wonder if python 3 changes any of this? > A and B means: check the boolean value of A; if it's false, return A.   > Else, return B

Re: PEP 401

2009-04-20 Thread Steven D'Aprano
On Sun, 19 Apr 2009 11:02:35 -0700, alessiogiovanni.baroni wrote: > Are 19 days that I read this PEP; it's all true? For the benefit of people who are not aware of the tradition of "April Fools": http://en.wikipedia.org/wiki/April_fool Look at the date of the PEP and the status. -- Steven

Re: PEP 401

2009-04-20 Thread Chris Rebert
On Mon, Apr 20, 2009 at 1:22 AM, Steven D'Aprano wrote: > On Sun, 19 Apr 2009 11:02:35 -0700, alessiogiovanni.baroni wrote: > >> Are 19 days that I read this PEP; it's all true? > > For the benefit of people who are not aware of the tradition of "April > Fools": > > http://en.wikipedia.org/wiki/Ap

Re: The Python standard library and PEP8

2009-04-20 Thread Steven D'Aprano
On Mon, 20 Apr 2009 03:44:59 -0400, Terry Reedy wrote: > Steven D'Aprano wrote: >> On Mon, 20 Apr 2009 19:18:23 +1200, Lawrence D'Oliveiro wrote: >> >>> In message , Aahz wrote: >>> What kind of OO language allows you to do this: def square(x): return x*x for i i

Re: The Python standard library and PEP8

2009-04-20 Thread Steven D'Aprano
On Mon, 20 Apr 2009 19:15:51 +1200, Lawrence D'Oliveiro wrote: > In message , > Christian Heimes wrote: > >> Neither Java nor Python are pure object oriented languages. > > That's like saying the Soviet Union was never a pure communist country, > or that the US is not a pure capitalist country.

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Peter Otten
bdb112 wrote: > Your explanation of Boolean ops on lists was clear. > It leads to some intriguing results: > > bool([False]) > --> True > > I wonder if python 3 changes any of this? No. Tests like if items: ... to verify that items is a non-empty list are a widespread idiom in Python. They

RE: Keyerror addhandler

2009-04-20 Thread Peter Otten
Steven Macintyre wrote: Please don't top-post. [Diez B. Roggisch] > For me, that fails with > NameError: name 'RotatingFileHandler' is not defined [Steven Macintyre] > I am using 2.4, could that be the cuase of your issue below. > > Ideally, I would like to stay with the 2.4 version and base

Re: please include python26_d.lib in the installer

2009-04-20 Thread Compie
On 31 mrt, 22:53, Carl Banks wrote: > On Mar 31, 12:50 pm, Compie wrote: > > > On 27 mrt, 17:01, Carl Banks wrote: > > > > OTOH, it's possible that SWIG and Python just happen to use the same > > > macro to indicate debugging mode.  So I think you raise a valid point > > > that this can be probl

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Gerhard Häring
Peter Otten wrote: > bdb112 wrote: > >> Your explanation of Boolean ops on lists was clear. >> It leads to some intriguing results: >> >> bool([False]) >> --> True >> >> I wonder if python 3 changes any of this? > > No. Tests like > > if items: >... > > to verify that items is a non-empty l

Re: The Python standard library and PEP8

2009-04-20 Thread Steven D'Aprano
On Mon, 20 Apr 2009 08:05:01 +0200, Emmanuel Surleau wrote: > On Monday 20 April 2009 01:48:04 Steven D'Aprano wrote: > >> It also depends on whether you see the length of a data structure as a >> property of the data, or the result of an operation ("counting") on the >> data structure. We often

Re: Is there a programming language that is combination of Python and Basic?

2009-04-20 Thread Marco Mariani
Michael Torrie wrote: http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html Somebody better tell the Linux kernel developers about that! They apparently haven't read that yet. Better tell CPU makers too. In assembly it's all gotos. I'm sure you are joking.

Re: best "void" return of a member function

2009-04-20 Thread Andreas Otto
Andreas Otto wrote: well propable found the answer by my own ... Py_RETURN_NONE should be the best -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 401

2009-04-20 Thread Steven D'Aprano
On Mon, 20 Apr 2009 01:30:44 -0700, Chris Rebert wrote: >> Look at the date of the PEP and the status. > > Heck, just look at its number and mentally insert one slash or dash. Fourth of January? What's special about 4th of Jan? -- Steven -- http://mail.python.org/mailman/listinfo/python-lis

Re: PEP 401

2009-04-20 Thread Chris Rebert
On Mon, Apr 20, 2009 at 2:28 AM, Steven D'Aprano wrote: > On Mon, 20 Apr 2009 01:30:44 -0700, Chris Rebert wrote: > > >>> Look at the date of the PEP and the status. >> >> Heck, just look at its number and mentally insert one slash or dash. > > Fourth of January? What's special about 4th of Jan?

Re: compiler package vs parser

2009-04-20 Thread Robin Becker
Kay Schluehr wrote: I realize that I probably ought to be trying this out with the newer ast stuff, but currently I am supporting code back to 2.3 and there's not much hope of doing it right there without using the compiler package. You might consider using the *builtin* parser module and forge

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Chris Rebert
On Mon, Apr 20, 2009 at 1:54 AM, Gerhard Häring wrote: > Peter Otten wrote: >> bdb112 wrote: >> >>> Your explanation of Boolean ops on lists was clear. >>> It leads to some intriguing results: >>> >>> bool([False]) >>> --> True >>> >>> I wonder if python 3 changes any of this? >> >> No. Tests like

RE: Keyerror addhandler

2009-04-20 Thread Steven Macintyre
Hi Peter, > It looks like 2.5 has the better error message, but the actual problem is > the same for both versions. Try changing mylogfileHandler's class to [handler_mylogfileHandler] class=handlers.RotatingFileHandler Many thanks, this worked for me! Steven -- http://mail.python.org/mailman/l

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Peter Otten
Gerhard Häring wrote: > Peter Otten wrote: >> bdb112 wrote: >> >>> Your explanation of Boolean ops on lists was clear. >>> It leads to some intriguing results: >>> >>> bool([False]) >>> --> True >>> >>> I wonder if python 3 changes any of this? >> >> No. Tests like >> >> if items: >>... >>

Re: Is there a programming language that is combination of Python and Basic?

2009-04-20 Thread Marco Mariani
baykus wrote: those "lines" as numbered steps or numbered bricks that are sitting on eachother but I see them as timelines or like filmstrips. Anyways it sounds like such a toy programming language does not exists except Arnaud surprisingly efficient code. and I will search my dream somewhere e

Re: PEP 401

2009-04-20 Thread Stefan Behnel
Chris Rebert wrote: > On Mon, Apr 20, 2009 at 1:22 AM, Steven D'Aprano > wrote: >> On Sun, 19 Apr 2009 11:02:35 -0700, alessiogiovanni.baroni wrote: >> >>> Are 19 days that I read this PEP; it's all true? >> For the benefit of people who are not aware of the tradition of "April >> Fools": >> >> ht

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Steven D'Aprano
On Mon, 20 Apr 2009 10:54:40 +0200, Gerhard Häring wrote: > Peter Otten wrote: >> bdb112 wrote: >> >>> Your explanation of Boolean ops on lists was clear. It leads to some >>> intriguing results: >>> >>> bool([False]) >>> --> True >>> >>> I wonder if python 3 changes any of this? >> >> No. Tests

Re: best "void" return of a member function

2009-04-20 Thread Christian Heimes
Andreas Otto wrote: > > well propable found the answer by my own ... > > Py_RETURN_NONE > > should be the best You have found the correct answer to your query. :) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Create standalone Windows program with simple graphics?

2009-04-20 Thread Poster28
>> I'd like to program and compile a simple graphics program (showing >> something like a chess board, some numbers and buttons, mouse support) >> ... > 2d or 3d graphics? You could start by looking at pygame and pyopengl. 2D Graphics. >> ... and provide it as a standalone binary for Windows users

Re: best "void" return of a member function

2009-04-20 Thread Stefan Behnel
Andreas Otto writes: > I'm writing a native language binding for a library. > > http://libmsgque.sourceforge.net/ > > Every native method called by PYTHON have to return > a PyObject* even if the function itself does not > return anything. > [...] > Question: what is the best r

Re: best "void" return of a member function

2009-04-20 Thread Stefan Behnel
Stefan Behnel wrote: > you might want to try to wrap it in a more Pythonic > look&feel style, that wraps operations and use-cases rather than plain > functions. That should make it easier to hide things like memory allocation > and other C implementation details from users, and will generally incre

Re: Is there a programming language that is combination of Python and Basic?

2009-04-20 Thread Tim Rowe
2009/4/20 Steven D'Aprano : > Sheesh. Talk about cherry-picking data. Go read my post in it's entirety, > instead of quoting mining out of context. If you still think I'm unaware > of the difference between unstructured GOTOs and structured jumps, or > that I'm defending unstructured GOTOs, then y

Re: best "void" return of a member function

2009-04-20 Thread Stefan Behnel
Stefan Behnel wrote: > define message packing formats in advance in some way, e.g. > similar to Python's "array" module. I (obviously ;) meant the format identifiers in the "struct" module here. http://docs.python.org/library/struct.html Stefan -- http://mail.python.org/mailman/listinfo/python

Re: any(), all() and empty iterable

2009-04-20 Thread Antoon Pardon
On 2009-04-15, John O'Hagan wrote: > On Tue, 14 Apr 2009, Mark Dickinson wrote: >> On Apr 14, 7:21 pm, Luis Alberto Zarrabeitia Gomez >> >> wrote: >> > It's more than that. Python's following the rules here. Maybe it could be >> > documented better, for those without a background in logic/discret

Re: Is there a programming language that is combination of Python and Basic?

2009-04-20 Thread david
When I was at Data General, writing C (and a little C++), we had a set of internal coding conventions that mandated a single return point for a function. Goto's were used during error checks to branch to the function exit; something like this: int frodo() { int rval = 0; if (bilbo() != 0) {

ANN: pyparsing 1.5.2 released!

2009-04-20 Thread Paul McGuire
Well, it has been about 6 months since the release of pyparsing 1.5.1, and there have been no new functional enhancements to pyparsing. I take this as a further sign that pyparsing is reaching a development/ maturity plateau. With the help of the pyparsing community, there are some compatibility

Re: The Python standard library and PEP8

2009-04-20 Thread Aahz
In article , Steven D'Aprano wrote: >On Mon, 20 Apr 2009 03:44:59 -0400, Terry Reedy wrote: >> Steven D'Aprano wrote: >>> On Mon, 20 Apr 2009 19:18:23 +1200, Lawrence D'Oliveiro wrote: In message , Aahz wrote: > > What kind of OO language allows you to do this: > > def square

Re: PEP 401

2009-04-20 Thread alessiogiovanni . baroni
On 20 Apr, 10:22, Steven D'Aprano wrote: > On Sun, 19 Apr 2009 11:02:35 -0700, alessiogiovanni.baroni wrote: > > Are 19 days that I read this PEP; it's all true? > > For the benefit of people who are not aware of the tradition of "April > Fools": > > http://en.wikipedia.org/wiki/April_fool > > Loo

Re: The Python standard library and PEP8

2009-04-20 Thread Scott David Daniels
Steven D'Aprano wrote: ... There's an accepted definition for "objected oriented programming language": a language which provides "objects", which are constructs encapsulating both data and routines to operate on that data in a single item. Says you. Roger King wrote a book entitled "My Cat is

Re: The Python standard library and PEP8

2009-04-20 Thread George Sakkis
On Apr 19, 6:01 pm, "Martin P. Hellwig" > Besides, calling Python Object-Orientated is a bit of an insult :-). I > would say that Python is Ego-Orientated, it allows me to do what I want. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread Deep_Feelings
every one is telling "dont go with python 3 , 3rd party tools and libraries have no compitability with python 3" so from previous experience : when can i expect libraries and third party tools to be updated for python 3 ? (especially libraries ) -- http://mail.python.org/mailman/listinfo/python-li

Re: Is there a programming language that is combination of Python and Basic?

2009-04-20 Thread Tim Rowe
2009/4/20 david : > When I was at Data General, writing C (and a little C++), we had a set > of internal coding conventions that mandated a single return point for > a function. How long ago was that? Or, more relevant, how old was the rule? Or how long earlier had the person who wrote the rule le

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread alessiogiovanni . baroni
On 20 Apr, 15:47, Deep_Feelings wrote: > every one is telling "dont go with python 3 , 3rd party tools and > libraries have no compitability with python 3" > > so from previous experience : when can i expect libraries and third > party tools to be updated for python 3 ? (especially libraries ) Wh

How save clipboard data as bmp file

2009-04-20 Thread gopal mishra
Hi, I am trying to save my clipboard data (format is CF_ENHMETAFILE) as BitMap file (.BMP). Can any on suggest how to do this. Thanks & Regards, Gopal -- http://mail.python.org/mailman/listinfo/python-list

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread Stefan Behnel
alessiogiovanni.baroni wrote: > On 20 Apr, 15:47, Deep_Feelings wrote: > > every one is telling "dont go with python 3 , 3rd party tools and > > libraries have no compitability with python 3" > > > > so from previous experience : when can i expect libraries and third > > party tools to be updated f

Re: Help improve program for parsing simple rules

2009-04-20 Thread pruebauno
On Apr 17, 5:32 pm, Paul McGuire wrote: > On Apr 17, 2:40 pm, prueba...@latinmail.com wrote: > > > > > On Apr 17, 11:26 am, Paul McGuire wrote: > > > > On Apr 16, 10:57 am, prueba...@latinmail.com wrote: > > > > > Another interesting task for those that are looking for some > > > > interesting pr

Re: any(), all() and empty iterable

2009-04-20 Thread Jani Hakala
Raymond Hettinger writes: > FWIW, I wrote the docs. The pure python forms were put in > as an integral part of the documentation. The first > sentence of prose was not meant to stand alone. It is a > lead-in to the code which makes explicit the short-circuiting > behavior and the behavior when

Re: best "void" return of a member function

2009-04-20 Thread Andreas Otto
Stefan Behnel wrote: > Andreas Otto writes: >> I'm writing a native language binding for a library. >> >> http://libmsgque.sourceforge.net/ >> >> Every native method called by PYTHON have to return >> a PyObject* even if the function itself does not >> return anything. >> [...]

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread pruebauno
On Apr 20, 9:47 am, Deep_Feelings wrote: > every one is telling "dont go with python 3 , 3rd party tools and > libraries have no compitability with python 3" > > so from previous experience : when can i expect libraries and third > party tools to be updated for python 3 ? (especially libraries )

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread Gerhard Häring
Deep_Feelings wrote: > every one is telling "dont go with python 3 , 3rd party tools and > libraries have no compitability with python 3" > > so from previous experience : when can i expect libraries and third > party tools to be updated for python 3 ? (especially libraries ) The problem is: ther

Re: How save clipboard data as bmp file

2009-04-20 Thread Tino Wildenhain
gopal mishra wrote: Hi, I am trying to save my clipboard data (format is CF_ENHMETAFILE) as BitMap file (.BMP). Can any on suggest how to do this. Sure. Open "Paint" press ctrl-v and the save as BMP. Regards Tino smime.p7s Description: S/MIME Cryptographic Signature -- http://mail.pyt

Re: Is there a programming language that is combination of Python and Basic?

2009-04-20 Thread david
I was at DG in the early nineties. A lot of very smart people devised some of these conventions, from hard-earned experience in the kernel and system-level software. I've never been one for "fascist-rules documents", but in DG's case many of the rules made good sense. I'm not advocating one approac

Re: How save clipboard data as bmp file

2009-04-20 Thread Tim Golden
gopal mishra wrote: I am trying to save my clipboard data (format is CF_ENHMETAFILE) as BitMap file (.BMP). Have a look at PIL's ImageGrab module: http://www.pythonware.com/library/pil/handbook/imagegrab.htm I'm not sure if the current version supports metafiles, but it's easy enough to try.

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread Ben Finney
(Is there hope that you could set your ‘From’ field using your real name so we can discuss with a real person instead of a pseudonym?) Deep_Feelings writes: > every one is telling "dont go with python 3 , 3rd party tools and > libraries have no compitability with python 3" That's a situation th

out of memory with processing module

2009-04-20 Thread Brian
I'm using the third-party "processing" module in Python 2.5, which may have become the "multiprocessing" module in Python 2.6, to speed up the execution of a computation that takes over a week to run. The relevant code may not be relevant, but it is: q1, q2 = processing.Queue(), proces

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread Jeremiah Dodds
On Mon, Apr 20, 2009 at 3:40 PM, Stefan Behnel wrote: > alessiogiovanni.baroni wrote: > > On 20 Apr, 15:47, Deep_Feelings wrote: > > > every one is telling "dont go with python 3 , 3rd party tools and > > > libraries have no compitability with python 3" > > > > > > so from previous experience : w

Re: The Python standard library and PEP8

2009-04-20 Thread Jeremiah Dodds
On Mon, Apr 20, 2009 at 2:18 PM, Scott David Daniels wrote: > Steven D'Aprano wrote: > >> ... There's an accepted definition for "objected oriented programming >> language": a language which provides "objects", which are constructs >> encapsulating both data and routines to operate on that data in

What is a real name, round 668 (was Re: when can i expect libraries and third party tools to be updated for python 3 ?)

2009-04-20 Thread Aahz
In article <87tz4jl66c@benfinney.id.au>, Ben Finney wrote: > >(Is there hope that you could set your From field using your real name >so we can discuss with a real person instead of a pseudonym?) Could you define what a "real name" is? (If you think the above sounds annoyed, you are certain

Re: best "void" return of a member function

2009-04-20 Thread Andreas Otto
Propable you can help me with an other problem ... the following code crash with: ==31431== Process terminating with default action of signal 11 (SIGSEGV) ==31431== General Protection Fault ==31431==at 0x4EA5151: PyObject_GenericGetAttr (object.c:982) ==31431==by 0x4EF1FBD: PyEval_EvalF

Re: best "void" return of a member function

2009-04-20 Thread Stefan Behnel
Andreas Otto wrote: >if you wrote one language interface you can write every language interface This is like saying: if you used one programming language, you can use every programming language. "Use" is different from "master" or "appreciate". > -> the tasks are allways the same... just

Re: out of memory with processing module

2009-04-20 Thread alessiogiovanni . baroni
On 20 Apr, 17:03, Brian wrote: > I'm using the third-party "processing" module in Python 2.5, which may > have become the "multiprocessing" module in Python 2.6, to speed up > the execution of a computation that takes over a week to run. The > relevant code may not be relevant, but it is: > >    

Re: unpythonic use of property()?

2009-04-20 Thread J Kenneth King
Carl Banks writes: > On Apr 17, 4:00 pm, Scott David Daniels wrote: >> Carl Banks wrote: >> > On Apr 17, 10:21 am, J Kenneth King wrote: >> >> Consider: >> >> >> code: >> >> >> >> >> class MyInterface(object): >> >> >>    

Python and GMP.

2009-04-20 Thread alessiogiovanni . baroni
There are reasons why Python not used the GMP library for implementing its long type? -- http://mail.python.org/mailman/listinfo/python-list

Re: unpythonic use of property()?

2009-04-20 Thread Michele Simionato
On Apr 17, 7:21 pm, J Kenneth King wrote: > Consider: > > code: > > > class MyInterface(object): > >     def __get_id(self): >         return self.__id > >     id = property(fget=__get_id) > >     def __init__(self, id, foo):

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Peter Pearson
On 20 Apr 2009 09:26:34 GMT, Steven D'Aprano wrote: > On Mon, 20 Apr 2009 10:54:40 +0200, Gerhard Häring wrote: [snip] >> I prefer to write it explicitly: >> >> if len(lst) > 0: > > Do you also count the length of a list explicitly? > > n = 0 > for item in lst: > n += 1 > if n > 0: > ... >

python-magic with python2.6

2009-04-20 Thread Gabriel
Is there any way to use python-magic(http://pypi.python.org/pypi/python-magic/0.1) with python2.6? Or do somebody know something similar to this what is running on 2.6? -- Gabriel -- http://mail.python.org/mailman/listinfo/python-list

sorting two corresponding lists?

2009-04-20 Thread Esmail
Hello all, I wonder if someone could help me with sorting two corresponding lists. For instance the first list contains some items, and the second list contains their value (higher is better) items = [apple, car, town, phone] values = [5, 2, 7, 1] I would like to sort the 'items' list based on

Re: any(), all() and empty iterable

2009-04-20 Thread John O'Hagan
On Mon, 20 Apr 2009, Antoon Pardon wrote: > On 2009-04-15, John O'Hagan wrote: > > On Tue, 14 Apr 2009, Mark Dickinson wrote: [...] > >> I'd like to guess that in 93.7% of cases, when a programmer > >> has used all(seq) without having thought in advance about what the > >> right thing to do is

Re: sorting two corresponding lists?

2009-04-20 Thread Diez B. Roggisch
Esmail wrote: > Hello all, > > I wonder if someone could help me with sorting two corresponding lists. > > For instance the first list contains some items, and the second list > contains their value (higher is better) > > items = [apple, car, town, phone] > values = [5, 2, 7, 1] > > I would li

Re: Python and GMP.

2009-04-20 Thread Diez B. Roggisch
alessiogiovanni.bar...@gmail.com wrote: > There are reasons why Python not used the GMP library for implementing > its long type? Any reason it should? I don't know GMP (only that it exists), but adding binary dependencies is always a tricky and in need of careful weighting thing to do. Diez --

Re: sorting two corresponding lists?

2009-04-20 Thread Saketh
On Apr 20, 12:10 pm, Esmail wrote: > Hello all, > > I wonder if someone could help me with sorting two corresponding lists. > > For instance the first list contains some items, and the second list > contains their value (higher is better) > > items = [apple, car, town, phone] > values = [5, 2, 7,

Re: The Python standard library and PEP8

2009-04-20 Thread Colin J. Williams
Emmanuel Surleau wrote: Hi there, Exploring the Python standard library, I was surprised to see that several packages (ConfigParser, logging...) use mixed case for methods all over the place. I assume that they were written back when the Python styling guidelines were not well-defined. Give

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Paul Rubin
Peter Pearson writes: > The "not empty" interpretation is a cute shortcut. But > somebody's gotta put up some resistance to cute shortcuts, > or we'll find ourselves back with Perl. + QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] pyxser-0.2r --- Python XML Serialization

2009-04-20 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stefan Behnel wrote: > Daniel Molina Wegener wrote: >> Sorry, it appears that I've misunderstand your question. By /unicode >> objects/ I mean /python unicode objects/ aka /python unicode strings/. > > Yes, that's exactly what I'm talking about. Ma

Re: out of memory with processing module

2009-04-20 Thread Brian
On Apr 20, 9:18 am, alessiogiovanni.bar...@gmail.com wrote: > On 20 Apr, 17:03, Brian wrote: > > > > > I'm using the third-party "processing" module in Python 2.5, which may > > have become the "multiprocessing" module in Python 2.6, to speed up > > the execution of a computation that takes over a

Re: out of memory with processing module

2009-04-20 Thread Brian
On Apr 20, 9:18 am, alessiogiovanni.bar...@gmail.com wrote: > On 20 Apr, 17:03, Brian wrote: > > > > > I'm using the third-party "processing" module in Python 2.5, which may > > have become the "multiprocessing" module in Python 2.6, to speed up > > the execution of a computation that takes over a

efficiently checking for string.maketrans conflicts?

2009-04-20 Thread Saketh
Hi everyone: I'm using "translation" in the sense of string.maketrans here. I am trying to efficiently compare if two string translations "conflict" -- that is, either they differently translate the same letter, or they translate two different letters to the same one. Here are some examples:

Re: sorting two corresponding lists?

2009-04-20 Thread Luis Alberto Zarrabeitia Gomez
Quoting Esmail : > items = [apple, car, town, phone] > values = [5, 2, 7, 1] > > I would like to sort the 'items' list based on the 'values' list so > that I end up with the following two list: > > items = [town, apple, car, phone] > values = [7, 5, 2, 1] I've used this sometimes: === [unte

Re: Python and GMP.

2009-04-20 Thread Jean-Paul Calderone
On Mon, 20 Apr 2009 18:24:07 +0200, "Diez B. Roggisch" wrote: alessiogiovanni.bar...@gmail.com wrote: There are reasons why Python not used the GMP library for implementing its long type? Any reason it should? I don't know GMP (only that it exists), but adding binary dependencies is always

Re: print as a function in 2.5 ?

2009-04-20 Thread Martin
Hi, On Sun, Apr 19, 2009 at 7:13 PM, Stef Mientki wrote: > hello, > > For several reasons I still use Python version 2.5. > I understand that the print-statement will be replaced in Python version > 3.0. > > At the moment I want to extend the print statement with an optional > traceback. > So I'v

Re: The Python standard library and PEP8

2009-04-20 Thread Emmanuel Surleau
On Monday 20 April 2009 10:55:19 Steven D'Aprano wrote: > On Mon, 20 Apr 2009 08:05:01 +0200, Emmanuel Surleau wrote: > > On Monday 20 April 2009 01:48:04 Steven D'Aprano wrote: > >> It also depends on whether you see the length of a data structure as a > >> property of the data, or the result of a

Re: sorting two corresponding lists?

2009-04-20 Thread Esmail
Hi Diez, Thanks for this, I had seen zip() before but had no idea really what it does, this will serve as good motivation to find out more. I'm amazed at what this language can do (and the helpfulness of the people on the list here). Best, Esmail Diez B. Roggisch wrote: items = zip(*sorted(z

Re: sorting two corresponding lists?

2009-04-20 Thread Esmail
Saketh wrote: Why not use a dictionary instead of two lists? Then you can sort the dictionary by value -- e.g. thanks for the suggestion. I am not sure this is quite suitable for my application (the example I provided was extremely simplified), but this is a useful technique to know and has b

getter and setter and list appends

2009-04-20 Thread dasacc22
Hi, I seem to be having a problem with a list being share across multiple instantiations of it and dont quite understand why this is happening. My class looks like this, class Widget(object): _parent = None _children = [] def __init__(self, parent=None): self.parent = parent

Re: sorting two corresponding lists?

2009-04-20 Thread Esmail
Thanks Luis, more code for me to study and learn from. Esmail Luis Alberto Zarrabeitia Gomez wrote: I've used this sometimes: -- http://mail.python.org/mailman/listinfo/python-list

Re: getter and setter and list appends

2009-04-20 Thread Diez B. Roggisch
dasacc22 wrote: > Hi, > > I seem to be having a problem with a list being share across multiple > instantiations of it and dont quite understand why this is happening. > > My class looks like this, > > class Widget(object): > _parent = None > _children = [] > > def __init__(self, p

Re: getter and setter and list appends

2009-04-20 Thread dasacc22
Ah thank you for clarifying, I did confuse instance and class attributes from creating the list in the class def. I actually just spiffed up that class to represent a portion of a much larger class that needs getter and setter for children. Doing as you said fixed my problem, heres the code as refe

  1   2   >