Re: Why bool( object )?

2009-04-28 Thread Aaron Brady
On Apr 28, 1:35 am, Lie Ryan wrote: > Aaron Brady wrote: > > What is the rationale for considering all instances true of a user- > > defined type?   > > User-defined objects (or type) can override .__len__() [usually > container types] or .__nonzero__() to make bool() returns False. > > > Is it st

Re: Web based application development using python

2009-04-28 Thread Tim Hoffman
Calling mod_python a web framework is a bit of a stretch. if you want to work at that level though mod_wsgi is worth a look, on top of that you can put a range of frameworks such as repose, django, turbo gears etc.. T On Apr 28, 12:55 pm, Rahul wrote: > > > 2) I have my web based applicat

Re: Web based application development using python

2009-04-28 Thread Rahul
1) Do you have any idea about web based support (like mod_python) provided by python.org (official web site) Details: - As we know mod_python is used for embeding python code into apache server. so, i want to know whether mod_python is officially supported by python.org or if there is other such f

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Diez B. Roggisch
Denis L schrieb: Hello, I'm experiencing odd errors on both windows and linux with the following code: import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class Options(QDialog): def __init__(self, values): QDialog.__init__(self) self.values = values

Re: Why bool( object )?

2009-04-28 Thread Steven D'Aprano
On Mon, 27 Apr 2009 23:11:11 -0700, Aaron Brady wrote: > What is the rationale for considering all instances true of a user- > defined type? Is it strictly a practical stipulation, or is there > something conceptually true about objects? Seven years ago, in an attempt to convince Guido *not* to

Web framework for embedded system

2009-04-28 Thread Thomas Heller
I'm looking for a lightweight web-framework for an embedded system. The system is running a realtime linux-variant on a 200 MHz ARM processor, Python reports a performance of around 500 pystones. The web application will not be too fancy, no databases involved for example, but it will need to cont

sorted() erraticly fails to sort string numbers

2009-04-28 Thread uuid
I would be very interested in a logical explanation why this happens on python 2.5.1: In order to sort an etree by the .text value of one child, I adapted this snippet from effbot.org: import xml.etree.ElementTree as ET tree = ET.parse("data.xml") def getkey(elem): return elem.findtext

Re: Presentation software for Python code

2009-04-28 Thread John Reid
Neal Becker wrote: IPython offers something similar for giving demos. I've found that very useful in the past. Really? Any pointers? http://ipython.scipy.org/doc/manual/html/api/generated/IPython.demo.html -- http://mail.python.org/mailman/listinfo/python-list

Re: sorted() erraticly fails to sort string numbers

2009-04-28 Thread Andre Engels
On Tue, Apr 28, 2009 at 9:47 AM, uuid wrote: > I would be very interested in a logical explanation why this happens on > python 2.5.1: > > In order to sort an etree by the .text value of one child, I adapted this > snippet from effbot.org: > >> import xml.etree.ElementTree as ET >> >> tree = ET.pa

Memory leak on python 2.5 if using str(dict(a='a'))

2009-04-28 Thread Benjamin Liu
Hi, all. I use guppy-pe to identify this issue in my program. The resources links are all embedded in source code already. I developed a test case for your convenience and attached the log. Any gurus help out here? It's really python internal stuff which I can't easily peek into. Thanks, Benja

Re: Web based application development using python

2009-04-28 Thread Marco Mariani
Rahul wrote: 1) Do you have any idea about web based support (like mod_python) provided by python.org (official web site) Details: - As we know mod_python is used for embeding python code into apache server. so, i want to know whether mod_python is officially supported by python.org or if there

Re: sorted() erraticly fails to sort string numbers

2009-04-28 Thread uuid
I am at the same time impressed with the concise answer and disheartened by my inability to see this myself. My heartfelt thanks! On 2009-04-28 10:06:24 +0200, Andre Engels said: When sorting strings, including strings that represent numbers, sorting is done alphabetically. In this alphabeti

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Phil Thompson
On Tue, 28 Apr 2009 03:53:34 +0200, "Denis L" wrote: > Hello, > > I'm experiencing odd errors on both windows and linux with the following > code: > > import sys > from PyQt4.QtCore import * > from PyQt4.QtGui import * > > class Options(QDialog): > def __init__(self, values): > QDi

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Phil Thompson
On Tue, 28 Apr 2009 09:35:31 +0200, "Diez B. Roggisch" wrote: > Denis L schrieb: >> Hello, >> >> I'm experiencing odd errors on both windows and linux with the following >> code: >> >> import sys >> from PyQt4.QtCore import * >> from PyQt4.QtGui import * >> >> class Options(QDialog): >> de

Re: python setup ?

2009-04-28 Thread Andreas Röhler
Xavier Maillard wrote: > Hi > >Xavier Maillard writes: > >> I am starting to do some work with python. I am looking for >> options/setups to introduce into my .emacs file to have the best >> experience possible with this scripting language. >> >> Where should I start ? > >

Re: Web framework for embedded system

2009-04-28 Thread Gerhard Häring
Thomas Heller wrote: > I'm looking for a lightweight web-framework for an embedded system. > The system is running a realtime linux-variant on a 200 MHz ARM > processor, Python reports a performance of around 500 pystones. > > The web application will not be too fancy, no databases involved > for

Re: Lisp mentality vs. Python mentality

2009-04-28 Thread Dan Sommers
On Tue, 28 Apr 2009 02:00:22 -0300, namekuseijin wrote: > Dan Sommers wrote: >> On Mon, 27 Apr 2009 07:57:00 +0300, Ciprian Dorin, Craciun wrote: >>> I agree with your opinion about keeping the abstraction layers >>> shallow, but in my view high-order and helper functions do not >>> comprise a

Re: Restart generator when it is exhausted.

2009-04-28 Thread Chris Rebert
On Tue, Apr 28, 2009 at 2:54 AM, Lacrima wrote: > Hello! > > I am quite new to Python and I have maybe simple (or maybe not) > question. > > Is it possible to restart generator when it is exhausted? No. You have to make a new instance of the generator. > What should I do to get the initial state

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-28 Thread tinnews
Lawrence D'Oliveiro wrote: > In message , Grant > Edwards wrote: > > > On 2009-04-26, Lawrence D'Oliveiro > > wrote: > > > >> In message <[email protected]>, Grant Edwards > >> wrote: > >> > >>> ... if one didn't care about backwards-compatiblity with old e-mail > >>>

Using ascii numbers in regular expression

2009-04-28 Thread jorma kala
Hi, How can I use the ascii number of a character in a regular expression (module re) instead of the character itself? Thanks very much -- http://mail.python.org/mailman/listinfo/python-list

screen scraping with Python?

2009-04-28 Thread Meenakshi, Arun Kumar
Hi Friends, Please let me know whether VT100 (Screen scrapping) emulation is possible or not. If screen scrapping / VT100 emulation is possible, please let me know how to do it. I will be happier, if you can provide me steps and sample codes. I am a beginner in python. So kindly help m

suggestion on a complicated inter-process communication

2009-04-28 Thread Way
Hello friends, I have a little messy situation on IPC. Please if you can, give me some suggestion on how to implement. Thanks a lot! -> denotes create MainProcess -> Process1 -> Process3 (from os.system) | -> Process2 (from os.system) -> Process4 (from os.

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Phil Thompson
On Tue, 28 Apr 2009 11:18:31 +0200, "Diez B. Roggisch" wrote: >>> As the documentation of pyqt clearly states, connecting signals doesn't >>> increment the refcount on a passed slot, thus >>> you need to keep a reference to your slots around. >> >> But it does increase the refcount for lambda s

desperately looking for a howto on running my wxPython app on Vista

2009-04-28 Thread Paul Sijben
python 2.6, py2exe and Vista do not make a happy set. Unfortunately I am in dire need to launch my app not only on WinXP but also on Vista. I need 2.6 because of a number of support packages I am using and some of which I am compiling myself (and python 2.5 needs a version of visual studio that is

Python 2.6 ImportError: cannot import name SSLType

2009-04-28 Thread zerosumgame
I have built python 2.6.1 and 2.6.2 with ssl support (Redhat 3.4.6-9 / Openssl 0.9.8j). I am trying to use this with the Apache Qpid project but cannot bring up an ssl connection because the code relies on socket.SSLType which is missing from my build. The only references to SSLType I can find fo

Re: screen scraping with Python?

2009-04-28 Thread David Lyon
On Mon, 27 Apr 2009 12:28:31 +0530, "Meenakshi, Arun Kumar" wrote: > Hi Friends, > > Please let me know whether VT100 (Screen scrapping) > emulation is possible or not. If screen scrapping / VT100 emulation is > possible, please let me know how to do it. I will be happier, if you ca

Restart generator when it is exhausted.

2009-04-28 Thread Lacrima
Hello! I am quite new to Python and I have maybe simple (or maybe not) question. Is it possible to restart generator when it is exhausted? For example: >>> a = ['a', 'b', 'c'] >>> g = (i for i in a) >>> g.next() 'a' >>> g.next() 'b' >>> g.next() 'c' >>> g.next() Traceback (most recent call last):

Re: Restart generator when it is exhausted.

2009-04-28 Thread Lacrima
On Apr 28, 1:04 pm, Chris Rebert wrote: > On Tue, Apr 28, 2009 at 2:54 AM, Lacrima wrote: > > Hello! > > > I am quite new to Python and I have maybe simple (or maybe not) > > question. > > > Is it possible to restart generator when it is exhausted? > > No. You have to make a new instance of the g

Efficient bits manipulation in Python

2009-04-28 Thread Li Wang
Hi: I have a bit-code :'1011011', how can I reverse it to '1101101'? Another question is I know how to transform the string '110' into integer 6, does anyone know how to transform integer 6 to a string '110'? Thank you very much:) -- Li -- Time is all we have and you may find one day you

RE: screen scraping with Python?

2009-04-28 Thread Meenakshi, Arun Kumar
David, Thanks a ton for your swift reply. I will be more happy, if you could direct me with right API with which I can walk further. Regards, Arun FoneNet : 390-13359 Mobile: 9884471702 -Original Message- From: David Lyon [mailto:[email protected]] Sent: Tue

RE: screen scraping with Python?

2009-04-28 Thread Jean-Paul Calderone
On Tue, 28 Apr 2009 16:57:18 +0530, "Meenakshi, Arun Kumar" wrote: David, Thanks a ton for your swift reply. I will be more happy, if you could direct me with right API with which I can walk further. Twisted includes a vt102 API along with an in-memory emulator implementing many

Re: Efficient bits manipulation in Python

2009-04-28 Thread Maxim Khitrov
On Tue, Apr 28, 2009 at 7:26 AM, Li Wang wrote: > Hi: > > I have a bit-code :'1011011', how can I reverse it to '1101101'? > > Another question is I know how to transform the string '110' into > integer 6, does anyone know how to transform integer 6 to a string > '110'? > > Thank you very much:)

Re: Web based application development using python

2009-04-28 Thread Rahul
On Apr 28, 1:02 pm, Marco Mariani wrote: > Rahul wrote: > > 1) Do you have any idea about web based support (like mod_python) > > provided by python.org (official web site) > > > Details: - As we know mod_python is used for embeding python code into > > apache server. > > so, i want to know whethe

Unknown Visual C++ error

2009-04-28 Thread Stef Mientki
hello, Anyone knows what this error message means ? Python 2.5.2 thanks, Stef -- http://mail.python.org/mailman/listinfo/python-list

Re: Using ascii numbers in regular expression

2009-04-28 Thread jorma kala
Thanks very much for your reply. What I mean is that I would like to use the ascii number in a regular expression pattern. For instance, if I want to substitute the occurrences of character 'a' for the character 'b' in a string, instead of doing this: re.subn('a','b','') I'd like to specify t

Re: Efficient bits manipulation in Python

2009-04-28 Thread Li Wang
>> I have a bit-code :'1011011', how can I reverse it to '1101101'? >> >> Another question is I know how to transform the string '110' into >> integer 6, does anyone know how to transform integer 6 to a string >> '110'? >> >> Thank you very much:) > > Assuming that you are using 2.6: > > a = 0b1011

Re: Web based application development using python

2009-04-28 Thread Tim Hoffman
On Apr 28, 7:50 pm, Rahul wrote: > On Apr 28, 1:02 pm, Marco Mariani wrote: > > > > > Rahul wrote: > > > 1) Do you have any idea about web based support (like mod_python) > > > provided by python.org (official web site) > > > > Details: - As we know mod_python is used for embeding python code int

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Diez B. Roggisch
>> As the documentation of pyqt clearly states, connecting signals doesn't >> increment the refcount on a passed slot, thus >> you need to keep a reference to your slots around. > > But it does increase the refcount for lambda slots. Has that changed? It has been a while, but I've been bitten b

Re: Why bool( object )?

2009-04-28 Thread Colin J. Williams
Lie Ryan wrote: Aaron Brady wrote: What is the rationale for considering all instances true of a user- defined type? User-defined objects (or type) can override .__len__() [usually container types] or .__nonzero__() to make bool() returns False. Is it strictly a practical stipulation, or

Connecting/talking to OpenOffice Base files

2009-04-28 Thread deostroll
Hi, I was wondering if the python interpretor can talk to files with extension *.odb (OpenOffice Base files). They are like flat database files, similar to Microsoft Access files. I want to store data into them as well as extract data out of them. --deostroll -- http://mail.python.org/mailman/lis

Re: Using ascii numbers in regular expression

2009-04-28 Thread Chris Rebert
On Tue, Apr 28, 2009 at 4:58 AM, jorma kala wrote: > Thanks very much for your reply. > What I mean is that I would like to use the ascii number in a regular > expression pattern. > For instance, if I want to substitute the occurrences of character 'a' for > the character 'b' in a string, instead

Re: Using ascii numbers in regular expression

2009-04-28 Thread Chris Rebert
On Tue, Apr 28, 2009 at 4:05 AM, jorma kala wrote: > Hi, > > How can I use the ascii number of a character in a regular expression > (module re) instead of the character itself? > Thanks very much I refer you to the chr() and ord() built-in functions, which can certainly be used to solve your pro

Re: Why bool( object )?

2009-04-28 Thread Lawrence D'Oliveiro
In message <54cb7f8a- [email protected]>, Aaron Brady wrote: > What is the rationale for considering all instances true of a user- > defined type? It's a stupid idea, and there seem to be instances of users tripping over it here in comp.lang.python every wee

Re: The whole story

2009-04-28 Thread andrew cooke
Paul Hemans wrote: > Hi Andrew, > The reason I am using mapped objects is that I need to abstract from the > database implementation allowing the replication to target a number of > different platforms. This will definitely slow things down. have you looked at sqlalchemy's generic sql support? yo

Re: Restart generator when it is exhausted.

2009-04-28 Thread Duncan Booth
Lacrima wrote: > If it is not possible what are common techniques to use iterator or > generator objects that allow restarting when it is needed? The usual thing if you want to use the generator's output more than once would be to convert the generator to a list, then you can iterate over it

Re: Why bool( object )?

2009-04-28 Thread Andre Engels
On Tue, Apr 28, 2009 at 2:22 PM, Colin J. Williams wrote: > Lie Ryan wrote: >> >> Aaron Brady wrote: >>> >>> What is the rationale for considering all instances true of a user- >>> defined type? >> >> User-defined objects (or type) can override .__len__() [usually container >> types] or .__nonzero

Re: Connecting/talking to OpenOffice Base files

2009-04-28 Thread Krishnakant
hi, On Tue, 2009-04-28 at 05:24 -0700, deostroll wrote: > Hi, > > I was wondering if the python interpretor can talk to files with > extension *.odb (OpenOffice Base files). They are like flat database > files, similar to Microsoft Access files. I want to store data into > them as well as extract

[ANN] pyOpenSSL 0.9

2009-04-28 Thread Jean-Paul Calderone
I'm happy to announce the release of pyOpenSSL 0.9. This release includes several new features and a very important bug fix: * APIs have been introduced to get and set the version of an X509 request * Contexts now support loading CA certificates for verification from a specified directory or

Re: Is there a maximum size to a Python program?

2009-04-28 Thread Paul Boddie
On 27 Apr, 05:01, "Carbon Man" wrote: > I have a program that is generated from a generic process. It's job is to > check to see whether records (replicated from another system) exist in a > local table, and if it doesn't, to add them. I have 1 of these programs for > every table in the database.

Re: Web framework for embedded system

2009-04-28 Thread bobicanprogram
On Apr 28, 3:43 am, Thomas Heller wrote: > I'm looking for a lightweight web-framework for an embedded system. > The system is running a realtime linux-variant on a 200 MHz ARM > processor, Python reports a performance of around 500 pystones. > > The web application will not be too fancy, no datab

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Denis L
"Phil Thompson" wrote in message news:[email protected]... > On Tue, 28 Apr 2009 03:53:34 +0200, "Denis L" wrote: >> Hello, >> >> I'm experiencing odd errors on both windows and linux with the following >> code: >> >> import sys >> from PyQt4.QtCore import * >>

Getting the "dir" from the other ancestor ?

2009-04-28 Thread Stef Mientki
hello, I have a class, derived from some user defined class (User_Defined_Ancestor) and some basic class (Basic_Ancestor). One of the major tasks of the Basic_Ancestor, is to hide all kinds of implementation details for the user, so the user can concentrate on the functional design. One of th

Re: Getting the "dir" from the other ancestor ?

2009-04-28 Thread tuxagb
On 28 Apr, 15:01, Stef Mientki wrote: > hello, > > I have a class, derived from some user defined class > (User_Defined_Ancestor) and some basic class (Basic_Ancestor). > > One of the major tasks of the Basic_Ancestor, > is to hide all kinds of implementation details for the user, > so the user ca

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-28 Thread Grant Edwards
On 2009-04-27, Lawrence D'Oliveiro wrote: > In message , Aahz wrote: > >> In article , >> Lawrence D'Oliveiro wrote: >>> >>>It's only in the proprietary-software world that we need to worry about >>>backward compatibility with old, obsolete software that the vendors >>>cannot or will not fix. In

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-28 Thread Grant Edwards
On 2009-04-27, Lawrence D'Oliveiro wrote: >> Who's "we"? Are you volunteering to fix all of the MUAs and >> MTAs out there that have mbox code in them that do follow the >> rules to make them compatible with _one_ broken library >> module? > > All the MUAs and MTAs I'm aware of that are worth bo

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Phil Thompson
On Tue, 28 Apr 2009 14:54:41 +0200, "Denis L" wrote: > "Phil Thompson" wrote in message > news:[email protected]... >> On Tue, 28 Apr 2009 03:53:34 +0200, "Denis L" wrote: >>> Hello, >>> >>> I'm experiencing odd errors on both windows and linux with the follow

Re: Using ascii numbers in regular expression

2009-04-28 Thread MRAB
jorma kala wrote: Thanks very much for your reply. What I mean is that I would like to use the ascii number in a regular expression pattern. For instance, if I want to substitute the occurrences of character 'a' for the character 'b' in a string, instead of doing this: re.subn('a','b','')

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Diez B. Roggisch
Phil Thompson wrote: > On Tue, 28 Apr 2009 11:18:31 +0200, "Diez B. Roggisch" > > wrote: As the documentation of pyqt clearly states, connecting signals doesn't increment the refcount on a passed slot, thus you need to keep a reference to your slots around. >>> >>> But it does i

Query related to matplotlib

2009-04-28 Thread srinivasan srinivas
I would like to draw a chart which takes 'dates' in x axes and some values in y axes.   I would like to draw a simple chart using matplotlib. Can someone tell me which submodule i could use for this purpose? The module has to support in the way that i can draw more than one set can be passed to

Re: Help AIX 5.3 build on Python-3.1a2

2009-04-28 Thread Jeroen Ruigrok van der Werven
-On [20090427 20:31], [email protected] ([email protected]) wrote: >./Modules/ld_so_aix xlc_r -q64 -bI:Modules/python.exp build/ >temp.aix-5.3-3.1//ptst/Python-3.1a2/Modules/_tkinter.o build/ >temp.aix-5.3-3.1//ptst/Python-3.1a2/Modules/tkappinit.o -L/usr/X11R6/ >lib64 -L/usr/X11R6/lib

Re: Web based application development using python

2009-04-28 Thread Rahul
On Apr 28, 5:07 pm, Tim Hoffman wrote: > On Apr 28, 7:50 pm, Rahul wrote: > > > > > On Apr 28, 1:02 pm, Marco Mariani wrote: > > > > Rahul wrote: > > > > 1) Do you have any idea about web based support (like mod_python) > > > > provided by python.org (official web site) > > > > > Details: - As w

Re: Web framework for embedded system

2009-04-28 Thread Suraj Barkale
Thomas Heller python.net> writes: > > I'm looking for a lightweight web-framework for an embedded system. > The system is running a realtime linux-variant on a 200 MHz ARM > processor, Python reports a performance of around 500 pystones. You can start with webpy (http://webpy.org/) and build up

Re: Re: sorted() erraticly fails to sort string numbers

2009-04-28 Thread John Posner
uuid wrote: I am at the same time impressed with the concise answer and disheartened by my inability to see this myself. My heartfelt thanks! Don't be disheartened! Many people -- myself included, absolutely! -- occasionally let a blind spot show in their messages to this list. BTW: contai

How to locate the bit in bits string?

2009-04-28 Thread Li Wang
Hi: If I use an integer to represent bits: e.g. 99 represents '1100011' How can I locate, say the second bit of 99(i.e. '1')? Although bin(99)[4] could be used to locate it, this transform cost too much memory (99 only needs 2Bytes, while string '1100011' needs 7Bytes). Anyone knows how to loca

Re: sorted() erraticly fails to sort string numbers

2009-04-28 Thread uuid
On 2009-04-28 16:18:43 +0200, John Posner said: Don't be disheartened! Many people -- myself included, absolutely! -- occasionally let a blind spot show in their messages to this list. Thanks for the encouragement :) BTW: container[:] = sorted(container, key=getkey) ... is equivalent

Re: Best way to evaluate boolean expressions from strings?

2009-04-28 Thread Gustavo Narea
Thank you very much, Gabriela and Peter! I'm going for Pyparsing. :) -- Gustavo. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to locate the bit in bits string?

2009-04-28 Thread Tim Chase
Li Wang wrote: Hi: If I use an integer to represent bits: e.g. 99 represents '1100011' How can I locate, say the second bit of 99(i.e. '1')? Although bin(99)[4] could be used to locate it, this transform cost too much memory (99 only needs 2Bytes, while string '1100011' needs 7Bytes). Anyone

Third Party Modules

2009-04-28 Thread Brock
Hi Everyone, I know this is most likely a basic question and you will roll your eyes, but I am just starting out with Python (hobbyist) and I see many tutorials on the web referring to the use of external modules. However, when I locate them, they often come as a zipped folder with a number of fi

What do you think of ShowMeDo

2009-04-28 Thread Astley Le Jasper
Hi, I've just stumbled over this (http://showmedo.com/) and being the very visual person I am, it seems like it could be a good way to learn about python. However, before I smack down $60, I wondered if anyone had any opinions on it. My gut feel is that it could be pretty good. ALJ -- http://mail

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Denis L
"Phil Thompson" wrote in message news:[email protected]... > On Tue, 28 Apr 2009 14:54:41 +0200, "Denis L" wrote: >> "Phil Thompson" wrote in message >> news:[email protected]... >>> On Tue, 28 Apr 2009 03:53:34 +0200, "Deni

Re: How to locate the bit in bits string?

2009-04-28 Thread tuxagb
On 28 Apr, 16:36, Li Wang wrote: > Hi: > > If I use an integer to represent bits: > e.g. 99 represents '1100011' > > How can I locate, say the second bit of 99(i.e. '1')? > > Although bin(99)[4] could be used to locate it, this transform cost > too much memory (99 only needs 2Bytes, while string '

Re: How to locate the bit in bits string?

2009-04-28 Thread Li Wang
2009/4/29 Tim Chase : > Li Wang wrote: >> >> Hi: >> >> If I use an integer to represent bits: >> e.g. 99 represents '1100011' >> >> How can I locate, say the second bit of 99(i.e. '1')? >> >> Although bin(99)[4] could be used to locate it, this transform cost >> too much memory (99 only needs 2Byte

Re: Third Party Modules

2009-04-28 Thread tuxagb
On 28 Apr, 17:02, Brock wrote: > Hi Everyone, > > I know this is most likely a basic question and you will roll your > eyes, but I am just starting out with Python (hobbyist) and I see many > tutorials on the web referring to the use of external modules. > > However, when I locate them, they often

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Phil Thompson
On Tue, 28 Apr 2009 17:10:51 +0200, "Denis L" wrote: > "Phil Thompson" wrote in message > news:[email protected]... >> On Tue, 28 Apr 2009 14:54:41 +0200, "Denis L" wrote: >>> "Phil Thompson" wrote in message >>> news:mailman.4664.1240907352.11746.python-l...

Re: How can I get Tkinter to work in Python? (I tried many things)

2009-04-28 Thread Peter Pearson
On Mon, 27 Apr 2009 17:49:26 -0700 (PDT), [email protected] wrote: [snip] > There are errors, but since there is many of them: > here is a cut out of the _tkinter errors: > > libpython2.6.a(_tkinter.o): In function `Tkapp_CallProc': > /home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1263: undef

Re: Restart generator when it is exhausted.

2009-04-28 Thread J. Cliff Dyer
On Tue, 2009-04-28 at 10:41 +, Duncan Booth wrote: > Lacrima wrote: > > > If it is not possible what are common techniques to use iterator or > > generator objects that allow restarting when it is needed? > > The usual thing if you want to use the generator's output more than once > woul

Re: suggestion on a complicated inter-process communication

2009-04-28 Thread Way
Thanks a lot for reply. I understand it is abnormal to implement such IPC, while it is worthy for my application. Well, my process3 and 4 are from an outside application, which both need License Check and os.system to involk. >From my experience, if Process5 involks Process3, such License Check c

Re: What do you think of ShowMeDo

2009-04-28 Thread tuxagb
On 28 Apr, 17:09, Astley Le Jasper wrote: > Hi, > > I've just stumbled over this (http://showmedo.com/) and being the very > visual person I am, it seems like it could be a good way to learn > about python. However, before I smack down $60, I wondered if anyone > had any opinions on it. My gut fee

Re: suggestion on a complicated inter-process communication

2009-04-28 Thread Way
Thanks a lot for the reply. I am not familiar with multi-process in Python. I am now using something like: A_prog is an os.system to involk Process3 B_prog is an os.system to involk Process4 --- In Main Process: Process1 = Popen(["A_prog"], stdin=

Re: How to locate the bit in bits string?

2009-04-28 Thread tuxagb
On 28 Apr, 17:24, Li Wang wrote: > 2009/4/29 Tim Chase : > > > Li Wang wrote: > > >> Hi: > > >> If I use an integer to represent bits: > >> e.g. 99 represents '1100011' > > >> How can I locate, say the second bit of 99(i.e. '1')? > > >> Although bin(99)[4] could be used to locate it, this transfor

Re: suggestion on a complicated inter-process communication

2009-04-28 Thread norseman
Way wrote: Hello friends, I have a little messy situation on IPC. Please if you can, give me some suggestion on how to implement. Thanks a lot! -> denotes create MainProcess -> Process1 -> Process3 (from os.system) | -> Process2 (from os.system) -> Proce

Re: Getting the "dir" from the other ancestor ?

2009-04-28 Thread Stef Mientki
tuxagb wrote: On 28 Apr, 15:01, Stef Mientki wrote: hello, I have a class, derived from some user defined class (User_Defined_Ancestor) and some basic class (Basic_Ancestor). One of the major tasks of the Basic_Ancestor, is to hide all kinds of implementation details for the user, so the u

Re: suggestion on a complicated inter-process communication

2009-04-28 Thread Paul Boddie
On 28 Apr, 17:40, Way wrote: > Thanks a lot for reply. I understand it is abnormal to implement such > IPC, while it is worthy for my application. > > Well, my process3 and 4 are from an outside application, which both > need License Check and os.system to involk. Sounds delightful! Anyway, look

stuck with PyOBEX

2009-04-28 Thread alejandro
So I installed the module and tryed to make it work but... It gave me: Traceback (most recent call last): File "first.py", line 24, in client2.connect() File "C:\Python25\lib\PyOBEX\client.py", line 359, in connect return Client.connect(self, header_list = [headers.Target(uuid)]) Fi

Re: Light (general) Inter-Process Mutex/Wait/Notify Synchronization?

2009-04-28 Thread John Nagle
Gunter Henriksen wrote: If you don't want to use a 3rd party module you could use the multiprocessing module That is definitely good for when I have a tree of processes which are all Python applications. I use it for that. But I am looking for something where the Python application can intera

Re: How to locate the bit in bits string?

2009-04-28 Thread Tim Chase
Li Wang wrote: 2009/4/29 Tim Chase : Li Wang wrote: If I use an integer to represent bits: [snip] Hummm, I have tried this method too, the problem is its time complexity. If the length of my bits is n, then the time complexity is O(n). When I tried to implement this in practice, it did consum

Re: Why bool( object )?

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 09:22:01 -0300, Colin J. Williams escribió: Lie Ryan wrote: Aaron Brady wrote: This makes it so all objects except False, None, 0, and empty containers are true by default. I am not convinced that 'if ' should have any meaning; it should probably throw an exception. Is

Re: inside-out range function

2009-04-28 Thread Scott David Daniels
Steven D'Aprano wrote: ... I wrote a similar function to do this: def monge_shuffle(deck): if len(deck) % 2: # Odd number of items. deck[:] = deck[0::2] + deck[1::2][::-1] else: # Even number of items. deck[:] = deck[1::2] + deck[0::2][::-1] return deck Oooh, shiny

Re: suggestion on a complicated inter-process communication

2009-04-28 Thread Paul Boddie
On 28 Apr, 17:44, Way wrote: > Thanks a lot for the reply. I am not familiar with multi-process in > Python. I am now using something like: > A_prog is an os.system to involk Process3 > B_prog is an os.system to involk Process4 > --- > In Main Pr

Re: stuck with PyOBEX

2009-04-28 Thread Diez B. Roggisch
alejandro wrote: > So I installed the module and tryed to make it work but... > It gave me: > > Traceback (most recent call last): > File "first.py", line 24, in > client2.connect() > File "C:\Python25\lib\PyOBEX\client.py", line 359, in connect > return Client.connect(self, header_l

Re: Connecting/talking to OpenOffice Base files

2009-04-28 Thread norseman
deostroll wrote: Hi, I was wondering if the python interpretor can talk to files with extension *.odb (OpenOffice Base files). They are like flat database files, similar to Microsoft Access files. I want to store data into them as well as extract data out of them. --deostroll -- http://mail.pyt

Re: Third Party Modules

2009-04-28 Thread John Nagle
Brock wrote: Hi Everyone, I know this is most likely a basic question and you will roll your eyes, but I am just starting out with Python (hobbyist) and I see many tutorials on the web referring to the use of external modules. However, when I locate them, they often come as a zipped folder with

Re: Why bool( object )?

2009-04-28 Thread Scott David Daniels
Steven D'Aprano wrote: On Mon, 27 Apr 2009 23:11:11 -0700, Aaron Brady wrote: ... In a boolean (or truth) context, Something and Nothing behave like True > and False in languages with real booleans: if obj: print "I am Something" else: print "I am Nothing" If you define the short-circ

Re: stuck with PyOBEX

2009-04-28 Thread alejandro
Can you tell me what is it? Maybe I can search it and pass it in another way... if it is an address or protocol name > AF_BLUETOOTH seems to be specific to *nix-systems. At least under debian > and > ubuntu, I've got it defined. > > So it seems it is not supported under windows - you should

Re: How to locate the bit in bits string?

2009-04-28 Thread Tim Chase
data = file('source.bin').read() def get_bit(source, bit): idx, bit = divmod(bit, 8) byte = ord(source[len(source) - (1+idx)]) return (byte >> bit) & 1 My understanding is: when doing this step, every bit in the byte will be shifted bit-long. If it is get_bit(data, 100), and the sourc

Re: Web framework for embedded system

2009-04-28 Thread Scott David Daniels
Thomas Heller wrote: I'm looking for a lightweight web-framework for an embedded system. The system is running a realtime linux-variant on a 200 MHz ARM processor, Python reports a performance of around 500 pystones > Does this sound sensible at all? Any suggestions? Look at this talk from

Re: stuck with PyOBEX

2009-04-28 Thread Diez B. Roggisch
alejandro wrote: > Can you tell me what is it? Maybe I can search it and pass it in another > way... if it is an address or protocol name I'm not entirely sure, but I guess no, you can't simply pass it in. Unix uses streams as abstraction for a lot of things - all kinds of devices for exampl

bug with os.rename in 2.4.1?

2009-04-28 Thread t123
I was wondering if anyone has seen this problem before? I have a job that runs hourly. Part of the processing is to rename a file using os.rename. The file name is the same every hour. Sometimes the os.rename fails and the file does not get renamed. It only happens occasionally. Most of the ti

Re: Light (general) Inter-Process Mutex/Wait/Notify Synchronization?

2009-04-28 Thread Gunter Henriksen
> Linux doesn't do interprocess communication very well. > The options are [...] and shared memory (unsafe). I think the bar has to be set pretty high to say shared memory is too unsafe an approach for active entities to communicate. > If you're using CPython, don't worry about socket overhead.

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Denis L
"Phil Thompson" wrote in message news:[email protected]... > If there was a bug with lambda slots it's been fixed by now. I just tried it and I'm getting the same errors with regular functions. Could you try running the code bellow? What output you are gettin

  1   2   >