Re: Finding the instance reference of an object

2008-10-28 Thread Aaron Brady
On Oct 27, 2:11 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 27, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote: > > > I think this "uncontrived" example addresses the C/Python difference > > fairly directly (both were tested): > > That's correct, but of course, C is a decades-old language barely

Re: Do I need a lock here?

2008-10-28 Thread Aaron Brady
On Oct 28, 3:29 pm, jasiu85 <[EMAIL PROTECTED]> wrote: > On Oct 27, 10:12 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > jasiu85 schrieb: > > > > Hey, > > > > Please take a look at the code of the two threads below: > > > > COMMON_DICT = {} > > > > def thread_1(): > > >     global COMM

Re: 2.6, 3.0, and truly independent intepreters

2008-10-28 Thread Martin v. Löwis
> Because then we're back into the GIL not permitting threads efficient > core use on CPU bound scripts running on other threads (when they > otherwise could). Why do you think so? For C code that is carefully written, the GIL allows *very well* to write CPU bound scripts running on other threads.

Re: explanation of values, references, assignment, and method calls

2008-10-28 Thread Aaron Brady
On Oct 28, 11:30 am, Bruno Desthuilliers wrote: > Joe Strout a écrit : > > > I've tried to write up this topic in a clear, step-by-step manner, with > > the help of diagrams and short examples from several different OOP > > languages.  I hope it will help clear up the confusion that seems to be >

Re: Finding the instance reference of an object

2008-10-28 Thread Steven D'Aprano
On Tue, 28 Oct 2008 09:59:57 -0600, Joe Strout wrote: > There are only the two cases, which Greg quite succinctly and accurately > described above. One is by value, the other is by reference. Python > quite clearly uses by value. That is absolute nonsense, based on the idiotic assumption that

Re: Extracting name strings from assigned objects

2008-10-28 Thread Steven D'Aprano
On Tue, 28 Oct 2008 09:23:46 -0700, Shannon Mayne wrote: > I would like to ask how one might obtain the assigned name of an > assigned object as a string. I would like to use object names as an > algorithmic input. > > > To demonstrate... So if i have: > >>>foo = {} > > what can I do to the ob

Re: How to get an object's name as a string?

2008-10-28 Thread Steven D'Aprano
On Tue, 28 Oct 2008 09:15:50 -0600, Joe Strout wrote: > On Oct 28, 2008, at 8:41 AM, Shannon Mayne wrote: > >> I would like to create objects with algorithmically determined names >> based on other object names and use object names for general algorithm >> input. > > What do you mean by the "nam

Re: Deviation from object-relational mapping (pySQLFace)

2008-10-28 Thread sulyokpeti
On okt. 22, 06:27, huy <[EMAIL PROTECTED]> wrote: > On Oct 12, 11:19 am, [EMAIL PROTECTED] wrote: > > > I have made a simple python module to handle SQL > > databases:https://fedorahosted.org/pySQLFace/wiki > > Its goal to separate relational database stuff (SQL) from algorythmic > > code (python)

urlsplit() and windows paths

2008-10-28 Thread Patrick Mézard
Hello, Why does urlparse.urlsplit() succeed here ? """ Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import urlparse >>> urlparse.urlsplit('c:\\foo\\bar') ('c', '',

Re: Tkinter: How to get Label wraplength functionality in Text Box

2008-10-28 Thread Guilherme Polo
On 10/28/08, Mudcat <[EMAIL PROTECTED]> wrote: > I've tried quite a few things to get this correct but have hit a > couple of sticking points that I can't figure out. I need to ge the > Text box to function like the 'wraplength' option in a Label. > > I've been able to adjust the height of the t

calling python from lisp

2008-10-28 Thread Martin Rubey
Dear all, I'm trying to call from common lisp functions written for Sage (www.sagemath.org), which in turn is written in python. To do so, I tried http://common-lisp.net/project/python-on-lisp/. It was quite easy to get it to run and do some simple things with python. However, I was unable to g

Using threads to quit the main python process

2008-10-28 Thread sharpblade
Is there a way I can use threads to quit the main python process? In brief, I have a python script that starts when my computer starts. It chooses a random wallpaper background out of a specified path, and sets it as the desktop wallpaper. It also hooks some windows hot keys so I can cycle through

Re: How to get an object's name as a string?

2008-10-28 Thread Steve Holden
Steven D'Aprano wrote: > On Tue, 28 Oct 2008 09:15:50 -0600, Joe Strout wrote: > >> On Oct 28, 2008, at 8:41 AM, Shannon Mayne wrote: >> >>> I would like to create objects with algorithmically determined names >>> based on other object names and use object names for general algorithm >>> input. >>

Re: How to get an object's name as a string?

2008-10-28 Thread Joe Strout
On Oct 28, 2008, at 4:45 PM, Steven D'Aprano wrote: What do you mean by the "name" of an object? Objects don't generally have names, unless you explicitly define a .name property and assign them names. (Variables have names, of course, but a variable isn't an object -- it's just a reference

Re: gl Multiple versions of python

2008-10-28 Thread Steve Holden
Glenn Linderman wrote: > When using multiple versions of Python co-installed on the same system, > what happens with local .pyc files? If the .py is loaded with a > different version of Python, is the .pyc rebuilt (even if the .py hasn't > changed)? > > Or must one manually delete the .pyc files?

Re: How to get an object's name as a string?

2008-10-28 Thread Joe Strout
On Oct 28, 2008, at 6:58 PM, Steve Holden wrote: Objects in Python *don't* have names. Period. In Python we don't normally talk about variables anyway, except when speaking loosely, we talk about binding names. But please don't let this start another round of "Python programmers don't know ho

Re: Sorting a list

2008-10-28 Thread duncan smith
RC wrote: > unsortedList = list(["XYZ","ABC"]) > > sortedList = unsortedList.sort() > print sortedList > > > Why this return None? Because the sort method sorts the list in place (and returns None). > How do I get return as ["ABC", "XYZ"]? >>> unsortedList = ["XYZ","ABC"] >>> unsortedList.sor

Re: calling python from lisp

2008-10-28 Thread Kaz Kylheku
["Followup-To:" header set to comp.lang.lisp.] On 2008-10-29, Martin Rubey <[EMAIL PROTECTED]> wrote: > Dear all, > > I'm trying to call from common lisp functions written for Sage > (www.sagemath.org), which in turn is written in python. Maybe those functions will work under CLPython? CLPython

Re: Using threads to quit the main python process

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 10:42 AM, sharpblade <[EMAIL PROTECTED]> wrote: > Is there a way I can use threads to quit the main python process? > In brief, I have a python script that starts when my computer starts. It > chooses a random wallpaper background out of a specified path, and sets it > as th

Re: How to get an object's name as a string?

2008-10-28 Thread alex23
On Oct 29, 12:41 am, Shannon Mayne <[EMAIL PROTECTED]> wrote: > I would like to create objects with algorithmically determined names > based on other object names and use object names for general algorithm > input. The simplest and best option here is to store the objects in a dictionary with thei

Earn $$$ Without Investment.

2008-10-28 Thread chinu
hai, i am srinu from india. i am sending a blog url for yours use. Right side Of The Blog Awsurvey Banner will appear. click on the banner and get a free signup with 6$ bonus and you will get more surveys. once you have completed one survey you will get minimem 4$ and more left side of the blog

Re: import foo vs. python -m foo

2008-10-28 Thread Asun Friere
On Oct 29, 7:35 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > It probably contains buggy code inside "if __name__ == '__main__': ...". Or the code contains a run-time error? -- http://mail.python.org/mailman/listinfo/python-list

Re: Contracts for Python

2008-10-28 Thread alex23
On Oct 29, 3:47 am, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > I am wondering if there is any work on contracts for Python. I could > only find PEP316, however, I am wondering if there is any official > support for it already (tools I mean), and if it is or if it will be > officially supported i

Re: gl Multiple versions of python

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 11:50 AM, Glenn Linderman <[EMAIL PROTECTED]> wrote: >>> When using multiple versions of Python co-installed on the same system, >>> what happens with local .pyc files? If the .py is loaded with a >>> different version of Python, is the .pyc rebuilt (even if the .py hasn't

How to get high precision timer in python?

2008-10-28 Thread 甜瓜
Howdy, I use python2.5 in WindowsXP. If using time.time() as timer, it seems the maximum precision is about 10-12ms. Maybe this is caused by the time slice defined in process scheduler. However, in my project, I have to get timer percision up to 1ms. What should I do? Do I have to call Win32 API?

Re: How to get high precision timer in python?

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 <[EMAIL PROTECTED]> wrote: > I use python2.5 in WindowsXP. If using time.time() as timer, it seems On the win32 platform should you not be using time.clock vs. time.time ? --JamesMills -- -- -- "Problems are solved by method" -- http://mail.python.org/mailma

Re: How to get high precision timer in python?

2008-10-28 Thread 甜瓜
2008/10/29 James Mills <[EMAIL PROTECTED]>: > On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 <[EMAIL PROTECTED]> wrote: >> I use python2.5 in WindowsXP. If using time.time() as timer, it seems > > On the win32 platform should you not > be using time.clock vs. time.time ? > Well, whatelse can I use? ShenLei

Re: How to get high precision timer in python?

2008-10-28 Thread James Mills
2008/10/29 甜瓜 <[EMAIL PROTECTED]>: > 2008/10/29 James Mills <[EMAIL PROTECTED]>: >> On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 <[EMAIL PROTECTED]> wrote: >>> I use python2.5 in WindowsXP. If using time.time() as timer, it seems >> >> On the win32 platform should you not >> be using time.clock vs. time.ti

Re: How to get high precision timer in python?

2008-10-28 Thread 甜瓜
^_^ Oh! I did not read the document for time.clock before, and supposed it was same with time.time(). Thank you very much. ShenLei -- http://mail.python.org/mailman/listinfo/python-list

[Novice]Installing eric4 with python 2.6

2008-10-28 Thread Saurabh Agrawal
Hi, I am fairly new to python. Coming from a world of IDEs, I wanted a fancier one than IDLE. Hence, I downloaded eric4. When I tried to compile it, it asked for PyQt4, which I again downloaded (exe for Windows XP) and installed it. It seems to be properly installed as I can invoke "import PyQt4"

Re: print_function and unicode_literals cannot be used at the same time?

2008-10-28 Thread Benjamin
On Oct 27, 1:00 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Gabriel Genellina wrote: > > En Sun, 26 Oct 2008 12:13:08 -0200, Christian Heimes <[EMAIL PROTECTED]> > > escribió: > > >> ?? wrote: > >>> Any ideas? > >>>  Code 1: > >>>  from __future__ import print_function, unicode_literals > >>>

Graphical object browser

2008-10-28 Thread Jason
Hi, I've spent all day looking for a graphical object browser for Python 2.5 under Debian GNU/Linux, ie. something I can just drop into my code with an import and a "browse(my_object)" statement. So far I've only found intractable GUI toolkits or obsolete, non-functional scripts. I was wondering

Re: Unpacking byte strings from a file of unknown size

2008-10-28 Thread Mark
> this code python interprets as: > > data = myfile.read(10) > for chunk in data: > . > Aha - now that you put it that way it makes sense. And thanks to all who replied - I'll try out the other suggestions too. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-10-28 Thread Douglas Alan
Joe Strout <[EMAIL PROTECTED]> writes: > There are only the two cases, which Greg quite succinctly and > accurately described above. One is by value, the other is by > reference. Python quite clearly uses by value. You make a grave error in asserting that there are only two cases. Algol, for in

Re: How to get high precision timer in python?

2008-10-28 Thread Tim Roberts
"" <[EMAIL PROTECTED]> wrote: >2008/10/29 James Mills <[EMAIL PROTECTED]>: >> On Wed, Oct 29, 2008 at 12:14 PM, <[EMAIL PROTECTED]> wrote: >>> I use python2.5 in WindowsXP. If using time.time() as timer, it seems >> >> On the win32 platform should you not >> be using time.clock vs. time.t

Re: how to get the thighest bit position in big integers?

2008-10-28 Thread Nick Mellor
On Oct 6, 3:40 am, Gary Herron <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > > I'm using python to develop some proof-of-concept code for a > > cryptographic application. My code makes extended use of python's > > native bignum capabilities. > > > In many cryptographic applicati

<    1   2