Re: Bit fields in python?

2010-09-06 Thread Stefan Behnel
Kwan Lai Cheng, 07.09.2010 06:06: I'm trying to rewrite a c program in python& encountered several problems. I have some data structures in my c program like below: typedef struct { unsigned short size; unsigned short reserved:8; unsigned short var_a1:2; unsigned short var

Re: list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
More details I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), ((cpu_util,mem_util),(disk_util))] ie, l = [((30,50),(70)), ((50,20),(20))] l.sort(key=lambda x:(-x[0][0], x[1][0])) # sorting cpu_util asc and disk_util desc suppose i changed order that is l = [((mem_util,cpu_util), (d

Re: How to determine if a Python script is being run right after startup on Windows

2010-09-06 Thread Steven D'Aprano
On Mon, 06 Sep 2010 22:19:46 -0700, Ryan George wrote: > My question is this: is there any way I can determine if the program is > being run directly after a startup on a Windows machine? How would you, a human being, determine if the program was being run directly after startup? What counts as

How to determine if a Python script is being run right after startup on Windows

2010-09-06 Thread Ryan George
Hello! I'm a newbie to Python (literally just started last Saturday), and I coded a program that selects a random wallpaper from a directory and swaps it with your current one (Windows only.) What I'm looking to do is have it start up with Windows and automatically swap the wallpapers. This part

Re: Class changes in circular imports when __name__ == '__main__'

2010-09-06 Thread Carl Banks
On Sep 6, 4:44 pm, Dave Angel wrote: > On 2:59 PM, Carl Banks wrote:> On Sep 5, 5:07 pm, Dave Angel   > wrote: > >> On 2:59 PM, Carl Banks wrote: > >>> All of this gets a lot more complicated when packages are involved. > >> Perhaps a better answer would be to import __main__ from the second modul

mail sending -- smtplib

2010-09-06 Thread Kurian Thayil
Hi All, I am a newbie in python. Just 2-3 days old wanting to learn this amazing programming language. I was trying to send mails using smtplib module, so did some google and found a code snippet. The mail gets sent, but doesn't come in the right format when a for-loop is introduced (Not MIME stan

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Ben Finney
Steven D'Aprano writes: > Of course, list comps are so seductively easy, and functional > programming so conceptually different from what many people are used > to, that such over-specification is an awfully easy trap to fall into. > I'm sure my own code is filled with similar examples where I us

Bit fields in python?

2010-09-06 Thread Kwan Lai Cheng
Hi, I'm trying to rewrite a c program in python & encountered several problems. I have some data structures in my c program like below: typedef struct { unsigned short size; unsigned short reserved:8; unsigned short var_a1:2; unsigned short var_a2:2; unsigned short var_a3:2;

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Steven D'Aprano
On Tue, 07 Sep 2010 12:40:57 +1000, Ben Finney wrote: > Steven D'Aprano writes: > >> On Tue, 07 Sep 2010 11:00:45 +1000, Ben Finney wrote: >> >> > If you're going to use the list of float objects, you can convert >> > them all with a list comprehension. >> [...] >> > >>> numbers_as_float = [

The Samurai Principle

2010-09-06 Thread Phlip
Pythonistas: The "Samurai Principle" says to return victorious, or not at all. This is why django.db wisely throws an exception, instead of simply returning None, if it encounters a "record not found". I illustrated the value of that concept, here: http://c2.com/cgi/wiki?SamuraiPrinciple -- htt

Re: Speed-up for loops

2010-09-06 Thread Steven D'Aprano
On Mon, 06 Sep 2010 11:38:22 +0100, BartC wrote: > Modifying the OP's code a little: > > a = 0 > for i in xrange(1): # 100 million > a = a + 10 # add 10 or 100 > print a > > Manually unrolling such a loop four times (ie. 4 copies of the body, and > counting onl

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Ben Finney
Steven D'Aprano writes: > On Tue, 07 Sep 2010 11:00:45 +1000, Ben Finney wrote: > > > If you're going to use the list of float objects, you can convert them > > all with a list comprehension. > [...] > > >>> numbers_as_float = [float(x) for x in numbers_as_str] > > That's awfully verbose. A m

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Steven D'Aprano
On Tue, 07 Sep 2010 11:00:45 +1000, Ben Finney wrote: > If you're going to use the list of float objects, you can convert them > all with a list comprehension. [...] > >>> numbers_as_float = [float(x) for x in numbers_as_str] That's awfully verbose. A map is simpler: numbers_as_float = map(f

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Ben Finney
ceycey writes: > I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', > '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', > '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', > '9.0601']. What I want to do is to find minimum and maximum num

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Albert Hopkins
On Mon, 2010-09-06 at 17:37 -0700, ceycey wrote: > I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', > '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', > '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', > '9.0601']. What I want to do is

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Tim Chase
On 09/06/10 19:37, ceycey wrote: I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', '9.0601']. What I want to do is to find minimum and m

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread MRAB
On 07/09/2010 01:44, Xavier Ho wrote: On 7 September 2010 10:37, ceycey mailto:cuneyt.er...@gmail.com>> wrote: I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', '3.4225', '7.7284', '10.24', '9.0

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Xavier Ho
On 7 September 2010 10:37, ceycey wrote: > I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', > '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', > '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', > '9.0601']. > How can I convert the

Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread ceycey
I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', '9.0601']. What I want to do is to find minimum and maximum number in this list. I used

Re: accessing a text file

2010-09-06 Thread Ben Finney
Ben Finney writes: > We value respect for people here, and that's what you've been shown > consistently. But respect for opinions, or for delicacy about > learning, is not welcome here. Sloppy wording, I apologise. This should say “… is not respect for a person”. > In other words, we treat peop

Re: filecmp.cmp() doesn't seem to do what it says in the documentation

2010-09-06 Thread Carl Banks
On Sep 6, 1:11 pm, tinn...@isbd.co.uk wrote: > Terry Reedy wrote: > > On 9/6/2010 1:18 PM, tinn...@isbd.co.uk wrote: > > > I'm using filecmp.cmp() to compare some files (surprise!). > > > > The documentation says:- > > >      Unless shallow is given and is false, files with identical > > >      os

Re: Class changes in circular imports when __name__ == '__main__'

2010-09-06 Thread Dave Angel
On 2:59 PM, Carl Banks wrote: On Sep 5, 5:07 pm, Dave Angel wrote: On 2:59 PM, Carl Banks wrote: All of this gets a lot more complicated when packages are involved. Perhaps a better answer would be to import __main__ from the second module. Then what if the module is imported from a differ

Re: accessing a text file

2010-09-06 Thread Ben Finney
Baba writes: > Thanks Jeremy, i will take your advice on board! Noone likes to be > taught lessons i think so it is only normal that i reacted. Please reconsider this response. Many of us use this forum precisely because we *do* like to be taught lessons. If you don't want to be taught lessons,

YOU MUST KNOW THIS MAN

2010-09-06 Thread shahama23
In The Name Of Allaah, Most Gracious, Most Merciful YOU MUST KNOW THIS MAN MUHAMMAD (May peace and blessings of God Almighty be upon him) You may be an atheist or an agnostic; or you may belong to anyone of the religious denominations that exist in the world today. You may be a Communist or a bel

Re: redirecting stdout and stderr for a windows service

2010-09-06 Thread Ian
On 06/09/2010 15:29, Ian Hobson wrote: Hi all, Forget this. The problem is that it is a Windows Service, so it is not initialised in the normal way. PythonService.exe loads other code (named __main__) that loads the service proper, so the if test was never true! Regards Ian -- http://m

Re: filecmp.cmp() doesn't seem to do what it says in the documentation

2010-09-06 Thread tinnews
Terry Reedy wrote: > On 9/6/2010 1:18 PM, tinn...@isbd.co.uk wrote: > > I'm using filecmp.cmp() to compare some files (surprise!). > > > > The documentation says:- > > Unless shallow is given and is false, files with identical > > os.stat() signatures are taken to be equal. > > Reword a

The PSF Blog Gets a Transfusion!

2010-09-06 Thread Mike Driscoll
The Python Software Foundation’s Blog staff has been recently expanded by a new set of top-notch bloggers to bring you the latest in PSF news, ranging from the scintillating projects that the PSF has its fingers in to the mundane, but necessary board minutes. Don’t despair if you hate reading blog

Re: using modules

2010-09-06 Thread Terry Reedy
On 9/6/2010 12:55 PM, Sal Lopez wrote: The following code runs OK under 3.1: @filename=cats_and_dogs.py #!/usr/bin/python def make_sound(animal): print(animal + ' says ' + sounds[animal]) sounds = { "cat": "meow", "dog": "woof" } for i in sounds.keys(): make_sound(i) # output: # d

Re: GUibuilder evaluation

2010-09-06 Thread CM
On Sep 6, 3:54 am, Niklasro wrote: > Hello > Making a GUI, could you recommend tkinter or any other proposal? > Thanks Your message referred to a GUI *builder*, whereas tkinter is a GUI *toolkit* (that is, a collection of widgets). A GUI builder is an application that allows one to make GUI apps

Re: Database problems

2010-09-06 Thread Tim Harig
On 2010-09-06, Edward Grefenstette wrote: > I then threw caution to the winds and tried simply using cPickle's > dump in the hope of obtaining some data persistence, but it crashed > fairly early with a "IOError: [Errno 122] Disk quota exceeded". The error is telling you that you have attempted t

Re: GUibuilder evaluation

2010-09-06 Thread CM
On Sep 6, 3:54 am, Niklasro wrote: > Hello > Making a GUI, could you recommend tkinter or any other proposal? > Thanks Your message referred to a GUI *builder*, whereas tkinter is a GUI *toolkit* (that is, a collection of widgets). A builder is an application that allows one to make GUI apps mor

Re: Database problems

2010-09-06 Thread Benjamin Kaplan
On Mon, Sep 6, 2010 at 3:01 PM, Edward Grefenstette wrote: > Dear Pythonistas, > > For a project I'm working on, I need to store fairly large > dictionaries (several million keys) in some form (obviously not in > memory). The obvious course of action was to use a database of some > sort. > > The o

Re: Speed-up for loops

2010-09-06 Thread Terry Reedy
On 9/6/2010 7:20 AM, Stefan Behnel wrote: BartC, 06.09.2010 12:38: (3) Since the loop variable is never used, why not have a special loop statement that repeats code so many times? There sort-of is, just slightly more general. Because special cases are not special enough to break the rules

Database problems

2010-09-06 Thread Edward Grefenstette
Dear Pythonistas, For a project I'm working on, I need to store fairly large dictionaries (several million keys) in some form (obviously not in memory). The obvious course of action was to use a database of some sort. The operation is pretty simple, a function is handed a generator that gives it

Re: Queue cleanup

2010-09-06 Thread Paul Rubin
John Nagle writes: > I've argued for an approach in which only synchronized or immutable > objects can be shared between threads. Then, only synchronized objects > have refcounts. See > "http://www.animats.com/papers/languages/pythonconcurrency.html"; I'm going to have to read this carefull

Re: filecmp.cmp() doesn't seem to do what it says in the documentation

2010-09-06 Thread Terry Reedy
On 9/6/2010 1:18 PM, tinn...@isbd.co.uk wrote: I'm using filecmp.cmp() to compare some files (surprise!). The documentation says:- Unless shallow is given and is false, files with identical os.stat() signatures are taken to be equal. Reword and read carefully: if shallow == True and

Re: using modules

2010-09-06 Thread Richard Thomas
On Sep 6, 5:55 pm, Sal Lopez wrote: > The following code runs OK under 3.1: > > @filename=cats_and_dogs.py > > #!/usr/bin/python > > def make_sound(animal): >     print(animal + ' says ' + sounds[animal]) > > sounds = { "cat": "meow", "dog": "woof" } > > for i in sounds.keys(): >     make_sound(i)

Re: GUibuilder evaluation

2010-09-06 Thread CM
On Sep 6, 3:54 am, Niklasro wrote: > Hello > Making a GUI, could you recommend tkinter or any other proposal? > Thanks Your message referred to a GUI *builder*, whereas tkinter is a GUI *toolkit* (that is, a collection of widgets). A builder is an application that allows you to make GUI apps mor

Re: Arguments from the command line

2010-09-06 Thread Alan Gauld
"aug dawg" wrote Mercurial is written in Python. I know that commit is a function that commits to a repo, but what command does the program use in order to get the commit name, like "This is a commit name" (This would make a commit with "This is a commit name" as the commit name) Take a l

filecmp.cmp() doesn't seem to do what it says in the documentation

2010-09-06 Thread tinnews
I'm using filecmp.cmp() to compare some files (surprise!). The documentation says:- Unless shallow is given and is false, files with identical os.stat() signatures are taken to be equal. I'm not setting shallow explicitly so it's True, thus the function should be comparing the os.stat() r

Re: [RELEASED] Python 3.2 alpha 2

2010-09-06 Thread MRAB
On 06/09/2010 09:22, Georg Brandl wrote: [snip] To download Python 3.2 visit: http://www.python.org/download/releases/3.2/ 3.2 documentation can be found at: http://docs.python.org/3.2/ I did notice the spelling mistake "dynmaic" at: http://docs.python.org/dev/whatsnew/3.2.h

using modules

2010-09-06 Thread Sal Lopez
The following code runs OK under 3.1: @filename=cats_and_dogs.py #!/usr/bin/python def make_sound(animal): print(animal + ' says ' + sounds[animal]) sounds = { "cat": "meow", "dog": "woof" } for i in sounds.keys(): make_sound(i) # output: # dog says woof # cat says meow When I move t

Re: GUibuilder evaluation

2010-09-06 Thread J.O. Aho
Niklasro wrote: > Hello > Making a GUI, could you recommend tkinter or any other proposal? QT Designer from Nokia, I can run my GUI programs both on my desktop and on my cellphone without modifications. -- //Aho -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 18:14, geremy condra wrote: > On Mon, Sep 6, 2010 at 8:53 AM, Baba wrote: > > On 6 sep, 16:58, Thomas Jollans wrote: > >> On Monday 06 September 2010, it occurred to Baba to exclaim: > > >> > On 6 sep, 00:01, Benjamin Kaplan wrote: > >> > > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:

Re: [Tutor] Arguments from the command line

2010-09-06 Thread bob gailer
On 9/6/2010 11:48 AM, aug dawg wrote: I've seen Python programs that can be activated from the command line. For example: hg This displays a list of commands for the Mercurial revision control system. But another command is this: hg commit "This is a commit name" Mercurial is written in P

Re: Iterative vs. Recursive coding

2010-09-06 Thread Aahz
In article <4c70344a$0$1659$742ec...@news.sonic.net>, John Nagle wrote: > >Realistically, recursion isn't that important in Python. It's >there if you need it, and sometimes useful, but generally not used >much without good reason. In some functional languages, recursion >is routinely used

Re: Iterative vs. Recursive coding

2010-09-06 Thread Aahz
In article <4c6e9de9$0$23142$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Steven D'Aprano a écrit : >> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote: >>> >>> Recursion can be quite a trick to get your mind round at first >> >> Really? Do people actually find the *concept* of

Re: accessing a text file

2010-09-06 Thread geremy condra
On Mon, Sep 6, 2010 at 8:53 AM, Baba wrote: > On 6 sep, 16:58, Thomas Jollans wrote: >> On Monday 06 September 2010, it occurred to Baba to exclaim: >> >> >> >> > On 6 sep, 00:01, Benjamin Kaplan wrote: >> > > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote: >> > > > level: beginner >> >> > > > how

Re: [Tutor] Arguments from the command line

2010-09-06 Thread Hugo Arts
On Mon, Sep 6, 2010 at 5:48 PM, aug dawg wrote: > I've seen Python programs that can be activated from the command line. For > example: > hg > > This displays a list of commands for the Mercurial revision control system. > But another command is this: > hg commit "This is a commit name" > Mercuria

Re: Arguments from the command line

2010-09-06 Thread Mark Lawrence
On 06/09/2010 16:48, aug dawg wrote: I've seen Python programs that can be activated from the command line. For example: hg This displays a list of commands for the Mercurial revision control system. But another command is this: hg commit "This is a commit name" Mercurial is written in Python

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 16:58, Thomas Jollans wrote: > On Monday 06 September 2010, it occurred to Baba to exclaim: > > > > > On 6 sep, 00:01, Benjamin Kaplan wrote: > > > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote: > > > > level: beginner > > > > > how can i access the contents of a text file in Python? > >

Arguments from the command line

2010-09-06 Thread aug dawg
I've seen Python programs that can be activated from the command line. For example: hg This displays a list of commands for the Mercurial revision control system. But another command is this: hg commit "This is a commit name" Mercurial is written in Python. I know that commit is a function that

Re: list of tuples with dynamic change in position

2010-09-06 Thread Gerard Flanagan
sajuptpm wrote: I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] and postion of values in the tuple change dynamicaly. I need a way to access correct value even if change in position. from itertools import starmap, izip, imap list(imap(dict, starmap(izip, d)

Re: Embedded Systems development using Python

2010-09-06 Thread Grant Edwards
On 2010-09-06, Stefan Behnel wrote: > VGNU Linux, 06.09.2010 13:02: >> Can Python be used for embedded systems development ? > > It can and has been. > > What kind of embedded system with what set of capabilities are you thinking > about? TV sets? Mobile phones? Smart dust? [The OP never showed

Re: redirecting stdout and stderr for a windows service

2010-09-06 Thread Ulrich Eckhardt
Ian Hobson wrote: > sys.stdout = sys.stderr = open("d:\logfile.txt", "a") "\l" is probably not what you want. Consider using "\\l" or r"\l" instead. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python

Re: list of tuples with dynamic change in position

2010-09-06 Thread Ulrich Eckhardt
sajuptpm wrote: > I need to change position of each values in the list and that dont > affect fuctions which are using this list. So you want to change the list's content but you don't want anyone to be able to detect the difference? That doesn't make sense. > I must have to use list of tuples. >

Re: list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] and postion of values in the tuple change dynamicaly. I need a way to access correct value even if change in position. -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing a text file

2010-09-06 Thread Thomas Jollans
On Monday 06 September 2010, it occurred to Baba to exclaim: > On 6 sep, 00:01, Benjamin Kaplan wrote: > > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote: > > > level: beginner > > > > > > how can i access the contents of a text file in Python? > > > > > > i would like to compare a string (word) wi

list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] some functions using this list and fetch data using index l[0][1], l[1] [1] I need to change position of each values in the list and that dont affect fuctions which are using this list. I must have to use list of

redirecting stdout and stderr for a windows service

2010-09-06 Thread Ian Hobson
Hi all, I am trying to redirect stdout and stderr on a python windows service, so that the service will not stall after 256 chars is written, and so I can use print for simple debugging. I have the following 4 lines (copy/pasted) in the source of my code. if __name__ == '__main__': sys.

Re: Python [repair_cycorder_mov.py]

2010-09-06 Thread ctops.legal
On Sep 5, 12:23 pm, Albert Hopkins wrote: > On Sun, 2010-09-05 at 14:00 +, Steven D'Aprano wrote: > > By the way, there's no need to send three messages in 10 minutes > > asking > > the same question, and adding FORM METHOD links to your post will > > probably just get it flagged as spam by ma

Re: GUibuilder evaluation

2010-09-06 Thread Denis Gomes
Hello, There are really three you can choose from if you are serious about making GUI applications. PyQt as already suggested. wxPython and pyGTK. Tkinter is good in my opinion if you are making smaller gui based programs. PyQt has an extensive number of additional features, including netwo

Re: Embedded Systems development using Python

2010-09-06 Thread Antoine Pitrou
On Mon, 6 Sep 2010 17:22:09 +0530 VGNU Linux wrote: > Hi, > > A small device like a mobile but with only 2 major buttons, with GPS and > GPRS capabilities. > Can anyone tell me from where to start learning about this ? Read the official docs for the C API: http://docs.python.org/extending/embedd

Re: ctypes and garbage collection

2010-09-06 Thread Joakim Hove
> I'd add an "__owner" field to the node, initialised with the owning > container instance. I will - thank you! Joakim -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes and garbage collection

2010-09-06 Thread Ulrich Eckhardt
Joakim Hove wrote: > I have used ctypes to wrap a C-library > [...] > Observe that the c_container_get_node() function does _not_ allocate > memory, it just returns a opaque handle to a node structure, still > fully owned by the container structure. [...] > > class Container: > def __init__(

Re: Embedded Systems development using Python

2010-09-06 Thread Peter Fodrek
On Monday 06 September 2010 13:02:56 VGNU Linux wrote: > Hi List, > Can Python be used for embedded systems development ? It is hard to say yes or no. For hard Real-time systems or hard Real-time parts of complex system answer is no, in another type of embedded systems yes or maybe > If Yes can

Re: Speed-up for loops

2010-09-06 Thread BartC
"Stefan Behnel" wrote in message news:mailman.485.1283772019.29448.python-l...@python.org... BartC, 06.09.2010 12:38: (2) Integer arithmetic seems to go straight from 32-bits to long integers; why not use 64-bits before needing long integers? You are making assumptions based on Python 2, I

ctypes and garbage collection

2010-09-06 Thread Joakim Hove
Hello, I have used ctypes to wrap a C-library - it has been a really painless experience! The C-library instantiates a quite large "container-like" structure. There are then several functions to inspect the content of the container, get at items and free the whole thing: /* C - code */ c_contain

Re: Speed-up for loops

2010-09-06 Thread Antoine Pitrou
On Mon, 06 Sep 2010 13:20:01 +0200 Stefan Behnel wrote: > > > (2) Integer arithmetic seems to go straight from 32-bits to long > > integers; why not use 64-bits before needing long integers? > > You are making assumptions based on Python 2, I guess. Try Python 3.1 or > later instead, where the

Re: Embedded Systems development using Python

2010-09-06 Thread VGNU Linux
Hi, A small device like a mobile but with only 2 major buttons, with GPS and GPRS capabilities. Can anyone tell me from where to start learning about this ? Regards Vivek On Mon, Sep 6, 2010 at 4:52 PM, Stefan Behnel wrote: > VGNU Linux, 06.09.2010 13:02: > > Can Python be used for embedded

Re: Speed-up for loops

2010-09-06 Thread Kushal Kumaran
On Mon, Sep 6, 2010 at 4:08 PM, BartC wrote: > "Stefan Behnel" wrote in message > news:mailman.470.1283712666.29448.python-l...@python.org... >> >> BartC, 05.09.2010 19:09: > >>> All those compilers that offer loop unrolling are therefore wasting >>> their time... >> >> Sometimes they do, yes. >

Re: Embedded Systems development using Python

2010-09-06 Thread Stefan Behnel
VGNU Linux, 06.09.2010 13:02: Can Python be used for embedded systems development ? It can and has been. What kind of embedded system with what set of capabilities are you thinking about? TV sets? Mobile phones? Smart dust? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed-up for loops

2010-09-06 Thread Stefan Behnel
BartC, 06.09.2010 12:38: why doesn't Python 3 just accept 'xrange' as a synonym for 'range'? Because Python 3 deliberately breaks backwards compatibility in order to clean up the language. These are just some simple tests on my particular machine and implementations, but they bring up some

Embedded Systems development using Python

2010-09-06 Thread VGNU Linux
Hi List, Can Python be used for embedded systems development ? If Yes can anyone point me to a tutorial/reference website which explains about this. Thanks and Regards Vgnu -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing by monkey-patching

2010-09-06 Thread Glazner
On Sep 6, 11:08 am, Bruno Desthuilliers wrote: > Jason a écrit : > > > On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: > > m = gio.File(".").monitor_directory() > > C = type(m) > > > 'C' will not necessarily be 'gio.FileMonitor' — I think the internals > > of the GIO methods might

Re: Speed-up for loops

2010-09-06 Thread BartC
"Stefan Behnel" wrote in message news:mailman.470.1283712666.29448.python-l...@python.org... BartC, 05.09.2010 19:09: All those compilers that offer loop unrolling are therefore wasting their time... Sometimes they do, yes. Modifying the OP's code a little: a = 0 for i in xrange(1000

Re: MAKE UPTO $5000 P/M $2000 IN FIRST 30 DAYS! NO INV

2010-09-06 Thread wissem belguidoum
On 6 sep, 06:26, jameser wrote: > MAKE UPTO $5000 P/M $2000 IN FIRST 30 DAYS! NO INV > > Generate $50 to $100 whenever you > have a couple of hours free time to spare. > You could make $50 or more in the next 2 hours. > Starting right Now!Today! > > GET PAID TO: > Take online surveys and make from

Re: GUibuilder evaluation

2010-09-06 Thread wissem belguidoum
On 6 sep, 09:54, Niklasro wrote: > Hello > Making a GUI, could you recommend tkinter or any other proposal? > Thanks Hi, I am considering to learn Qt, which is a multi-platform widget liberary and a RAD IDE..., basically for C++ programing but there is a binding called PyQt for python. Good luc

Re: Python 2.7 module path problems on OS X

2010-09-06 Thread Nicholas Cole
On Sun, Sep 5, 2010 at 8:57 PM, Ned Deily wrote: > In article > , >  Nicholas Cole wrote: > >> On Sun, Sep 5, 2010 at 10:20 AM, Ned Deily wrote: >> > I'm not sure why you think it is broken.  The Apple 2.6 and the >> > python.org 2.7 have different site-package directories in different >> > loca

[RELEASED] Python 3.2 alpha 2

2010-09-06 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the second alpha preview release of Python 3.2. Python 3.2 is a continuation of the efforts to improve and stabilize the Python 3.x line. Since the final release of Python 2.7, the 2.x l

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 00:04, Seth Rees wrote: > On 09/05/10 16:47, Baba wrote: > > > level: beginner > > > how can i access the contents of a text file in Python? > > > i would like to compare a string (word) with the content of a text > > file (word_list). i want to see if word is in word_list. let's assume

Re: Subclassing by monkey-patching

2010-09-06 Thread Bruno Desthuilliers
Jason a écrit : On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: m = gio.File(".").monitor_directory() C = type(m) 'C' will not necessarily be 'gio.FileMonitor' — I think the internals of the GIO methods might further "subclass" it in some way depending on what underlying monitors are

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 00:01, Benjamin Kaplan wrote: > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote: > > level: beginner > > > how can i access the contents of a text file in Python? > > > i would like to compare a string (word) with the content of a text > > file (word_list). i want to see if word is in word_l

GUibuilder evaluation

2010-09-06 Thread Niklasro
Hello Making a GUI, could you recommend tkinter or any other proposal? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: include a file in a python program

2010-09-06 Thread Niklasro(.appspot)
On Sep 5, 10:57 pm, bussiere bussiere wrote: > i've got a python.txt that contain python and it must stay as it (python.txt) > > how can i include it in my program ? > import python.txt doesn't work > is there a way : > a) to make an include("python.txt") > b) tell him to treat .txt as .py file th