Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-17 Thread Sébastien Buchoux
beginner a écrit : > Hi All. > > I'd like to do the following in more succint code: > > if k in b: > a=b[k] > else: > a={} > b[k]=a > > a['A']=1 > > > In perl it is just one line: $a=$b->{"A"} ||={}. > > Thanks, > Geoffrey > > One solution I often use in such cases: try: a = b[k

Re: (sort of) deterministic timing in Python

2007-08-17 Thread Hendrik van Rooyen
"Paul Rubin" wrote: >[EMAIL PROTECTED] (John Fisher) writes: >> mark start time >> start event >> event finishes >> count time until next interval >> start second event… >> >> rather than this: >> >> start event >> event finishes >> sleep for interval >> start s

Re: python socket usage

2007-08-17 Thread Bryan Olson
Oğuz Yarımtepe wrote: > As i read pickle module is Python-spesific. I need to talk with a Java > application and get the infortion that it will send. What i do right now is > listening a socket and reding the string that is sent by the java > application. So the java application is sending a str

Re: to property or function in class object

2007-08-17 Thread Steve Holden
james_027 wrote: > hi, > > i am very new to python, not knowing much about good design. I have an > object here for example a Customer object, where I need to retrieve a > info which has a number of lines of code to get it. > > my question is weather what approach should I use? to use the propert

Air conditioners for cars!

2007-08-17 Thread fritz
Have a problem with car air conditioner, go here http://car-air-conditioning.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Guitars, tabs, amps and more

2007-08-17 Thread Lepi Duja
Reviews of latest models of best guitars, fender, gibson, yamaha, and many more, with pictures and prices. http://pro-guitars.blogspot.com/ And if you want to win a free guitar go here http://freeguitars.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification

2007-08-17 Thread Thomas Jollans
On Friday 17 August 2007, Beema shafreen wrote: > hi everybody, > i have a file with data separated by tab > mydata: > fhl1fkh2 > dfp1chk1 > mal3alp14 > mal3moe1 > mal3spi1 > mal3bub1 > mal3bub3 > mal3mph1 > mal3mad3 > hob1nak1 > hob1wsp1 > hob1rad3 >

Tuned cars!!!

2007-08-17 Thread carairconditionersmail
If you like tuned cars, come here, you will fond many interesting stuff http://tuning-styling.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification

2007-08-17 Thread Laurent Pointal
Thomas Jollans a écrit : > On Friday 17 August 2007, Beema shafreen wrote: >> hi everybody, >> i have a file with data separated by tab >> mydata: >> fhl1fkh2 >> shows these two are separated by tab represented as columns >> i have to check the common data between these two coloumn1 an coloumn

Re: clarification

2007-08-17 Thread Laurent Pointal
Laurent Pointal a écrit : [cleaning] fh = open('sheet1') for line in fh: -- http://mail.python.org/mailman/listinfo/python-list

Re: advice about `correct' use of decorator

2007-08-17 Thread Laszlo Nagy
>> >> Are you developing a website or a GUI program? >> >> > It will be used in a web development. It is an important point? Yes, I think. Unless you use AJAX. :-) Most web sites work this way: user clicks -> request to server -> process on server -> response I would rather enclose the whole han

passing variables and values to texboxdisplays

2007-08-17 Thread yadin
hi! Can any one tell me why is it that i can't see my second frame and why is the value of freq not Appended in the First frame ...thanks I know it is wx python but it has to do with passing variables.thanks import wx def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1FREQ,

Re: advice about `correct' use of decorator

2007-08-17 Thread BJörn Lindqvist
On 8/16/07, Gerardo Herzig <[EMAIL PROTECTED]> wrote: > @is_logued_in > def change_pass(): > bla > bla > > And so on for all the other functions who needs that the user is still > loged in. > > where obviosly the is_logued_in() function will determine if the dude is > still loged in, and TH

Naming dictionaries recursively

2007-08-17 Thread TYR
I'd like to do something like this; iterate through a file which consists of data stored in dictionary format, one dict on each line, and read each line into a new dict using one of the values in the dict as its name... for example: stuff = open('data.txt') for eachLine in stuff: name{} nam

Re: Naming dictionaries recursively

2007-08-17 Thread [EMAIL PROTECTED]
On Aug 17, 7:38 am, TYR <[EMAIL PROTECTED]> wrote: > I'd like to do something like this; iterate through a file which > consists of data stored in dictionary format, one dict on each line, > and read each line into a new dict using one of the values in the dict > as its name... > > for example: > >

Re: Naming dictionaries recursively

2007-08-17 Thread Marc 'BlackJack' Rintsch
On Fri, 17 Aug 2007 12:38:16 +, TYR wrote: > I'd like to do something like this; iterate through a file which > consists of data stored in dictionary format, one dict on each line, > and read each line into a new dict using one of the values in the dict > as its name... Store the dictionaries

Downloading multiple csv files from a website

2007-08-17 Thread tkpmep
I'd like to download data from the website http://www.russell.com/Indexes/performance/daily_values_US.asp. On this web page, there are links to a number of .csv files, and I'd like to download all of them automatically each day. The file names are not visible on the page, but if I click on a link,

Re: clarification

2007-08-17 Thread Scott David Daniels
Laurent Pointal wrote: > Thomas Jollans a écrit : >> On Friday 17 August 2007, Beema shafreen wrote: >>> hi everybody, >>> i have a file with data separated by tab >>> mydata: >>> fhl1fkh2 > >>> shows these two are separated by tab represented as columns >>> i have to check the common data bet

Question on SPE and pwintypes.dll

2007-08-17 Thread Gerry
I'm running SPE 8.3.c under XP, on a new PC. The files for SPE and Python were copied to the new machine, but the OS wasn't migrated, so the registry didn't know about either. I reinstalled Python 2.5.1, and Python seems fine. I made a shortcut to SPE.pyw. Clicking on the shortcut g

Need to generate some functions.

2007-08-17 Thread Steven W. Orr
Given a list of names ll = ("n1", "n2", "n3", "n4") I want to create a pair of functions based off of each name. An example of what I want to happen would look like this: def mkn1dict(address): return {'Address': address, 'Control': SOME_CONST} def mkn1Classobj(address): return Class

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-17 Thread beginner
On Aug 17, 2:35 am, Sébastien Buchoux <[EMAIL PROTECTED]> wrote: > beginner a écrit : > > > > > Hi All. > > > I'd like to do the following in more succint code: > > > if k in b: > > a=b[k] > > else: > > a={} > > b[k]=a > > > a['A']=1 > > > In perl it is just one line: $a=$b->{"A"} ||={}

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-17 Thread beginner
On Aug 16, 11:02 pm, "Carsten Haese" <[EMAIL PROTECTED]> wrote: > On Fri, 17 Aug 2007 03:15:10 -, beginner wrote > > > On Aug 16, 9:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > What is the best solution in Perl need not be the best solution in > > > Python. In Python you should just us

best GUI library for vector drawing program

2007-08-17 Thread chewie54
Hello, What would be the best cross-platform GUI library to use for a vector based CAD program ( something like Visio on Windows ) WxWidgets, Tk, PyQt, Java Swing, Java SWT, I need the capibility to draw and edit in a window that looks like a page of paper so WYSIWYG is very important,

Re: best GUI library for vector drawing program

2007-08-17 Thread Victor Bazarov
chewie54 wrote: > What would be the best cross-platform GUI library to use for a vector > based CAD program ( something like Visio on Windows ) WxWidgets, > Tk, PyQt, Java Swing, Java SWT, I need the capibility to > draw and edit in a window that looks like a page of paper so WYSIWYG >

Re: Downloading multiple csv files from a website

2007-08-17 Thread kyosohma
On Aug 17, 8:08 am, [EMAIL PROTECTED] wrote: > I'd like to download data from the > websitehttp://www.russell.com/Indexes/performance/daily_values_US.asp. On > this web page, there are links to a number of .csv files, and I'd like > to download all of them automatically each day. The file names ar

Re: how to pass a custom object to re.search?

2007-08-17 Thread Lawrence Oluyede
<[EMAIL PROTECTED]> wrote: > Is it possible to make what I want (to pass a custom object to > re.search)? Try to implement __str__() for your object and provide a string representation for it. re.search(str(custom_object)) -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man

how to pass a custom object to re.search?

2007-08-17 Thread brunovianarezende
Hi, sorry if this is a faq. I've searched and got no result. I'm willing to pass a custom object to re.search method, but I'm getting the error: TypeError: expected string or buffer I don't want to make my object to inherit from basestring (nor I know how to do it...). Then I was left with 'buff

Re: best GUI library for vector drawing program

2007-08-17 Thread chewie54
On Aug 17, 9:45 am, "Victor Bazarov" <[EMAIL PROTECTED]> wrote: > chewie54 wrote: > > What would be the best cross-platform GUI library to use for a vector > > based CAD program ( something like Visio on Windows ) WxWidgets, > > Tk, PyQt, Java Swing, Java SWT, I need the capibility to >

Re: (sort of) deterministic timing in Python

2007-08-17 Thread Chris Mellon
On 8/17/07, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > > "Paul Rubin" wrote: > > > >[EMAIL PROTECTED] (John Fisher) writes: > >> mark start time > >> start event > >> event finishes > >> count time until next interval > >> start second event… > >> > >> rather than this:

unexpected optparse set_default/set_defaults behavior

2007-08-17 Thread mbeachy
Some rather unexpected behavior in the set_default/set_defaults methods for OptionParser that I noticed recently: >>> import optparse >>> parser = optparse.OptionParser() >>> parser.add_option("-r", "--restart", dest="restart", action="store_true") >>> parser.defaults {'restart': None} >>> parser

Re: best GUI library for vector drawing program

2007-08-17 Thread kyosohma
On Aug 17, 8:27 am, chewie54 <[EMAIL PROTECTED]> wrote: > Hello, > > What would be the best cross-platform GUI library to use for a vector > based CAD program ( something like Visio on Windows ) WxWidgets, > Tk, PyQt, Java Swing, Java SWT, I need the capibility to > draw and edit in a w

Re: Question on SPE and pwintypes.dll

2007-08-17 Thread kyosohma
On Aug 17, 8:38 am, Gerry <[EMAIL PROTECTED]> wrote: >I'm running SPE 8.3.c under XP, on a new PC. > >The files for SPE and Python were copied to the new machine, but > the OS wasn't migrated, so the registry didn't know about either. > >I reinstalled Python 2.5.1, and Python seems fine

Re: how to pass a custom object to re.search?

2007-08-17 Thread brunovianarezende
> Try to implement __str__() for your object and provide a string > representation for it. > > re.search(str(custom_object)) > I've done that (and added __unicode__ too). I only didn't want to, I want to do: re.search(custom_object) so, code that worked before as: re.search(parentobj.custom_obj

Re: Need to generate some functions.

2007-08-17 Thread J. Robertson
you can use the dictionary returned by the built in function vars, along the lines of >>> vars()["foo"] = lambda x: 3*x >>> foo(2) 6 but polluting your name space with data counts as bad style and will probably bite you at some point -- you probably are better of putting closures in a dictio

Re: how to pass a custom object to re.search?

2007-08-17 Thread Lawrence Oluyede
<[EMAIL PROTECTED]> wrote: > and I'm also curious to know if it is possible to do that... :-) Only if re.search() doesn't check for the type of the argument, which it seems it does. -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary

Re: passing variables and values to texboxdisplays

2007-08-17 Thread kyosohma
On Aug 17, 6:57 am, yadin <[EMAIL PROTECTED]> wrote: > hi! > Can any one tell me why is it that i can't see my second frame and why > is the value of freq not Appended in the First frame ...thanks > I know it is wx python but it has to do with passing variables.thanks > > import wx > > def create(

Re: Downloading multiple csv files from a website

2007-08-17 Thread tkpmep
Our systems administrator suggested that I try wget, a GNU utility that is designed to pick up data. It might prove to be the easiest way to get the data I want, and I am going to try that first. Thanks again. Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list

help to make program better

2007-08-17 Thread yadin
hi! Can any one tell me why is it that i can't see my second frame and why is the value of freq not Appended in the First frame ...thanks I know it is wx python but it has to do with passing variables.thanks import wx def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1FREQ,

Re: Naming dictionaries recursively

2007-08-17 Thread Paul McGuire
On Aug 17, 7:38 am, TYR <[EMAIL PROTECTED]> wrote: > I'd like to do something like this; iterate through a file which > consists of data stored in dictionary format, one dict on each line, > and read each line into a new dict using one of the values in the dict > as its name... > > for example: > >

Re: how to pass a custom object to re.search?

2007-08-17 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I've done that (and added __unicode__ too). I only didn't want to, I > want to do: > > re.search(custom_object) > > so, code that worked before as: > > re.search(parentobj.custom_object) > > don't have to be changed for: > > re.search(str(parentobj.custom_object))

Getting the result of a process after exec*()

2007-08-17 Thread AndrewTK
Hi, I am trying to write a Python script that takes a ZIP file from a web form (using CGI) and uses either of the UN*X unzip, gunzip, tar, bunzip2 utilities to expand it. I can use Python to save the script to disk; but processing it is another matter. If for example I have received a *.tar.gz fi

Re: Naming dictionaries recursively

2007-08-17 Thread TYR
> So the tougher problem seems to be parsing those lines. That is not a > valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and > `predatory` are not already defined. So you can't just ``eval`` it. In what way? {'key': val}, right? Anyway, I can always change the format they g

Re: Hijack! Different book:

2007-08-17 Thread kyosohma
On Aug 16, 3:50 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber wrote: > > On Thu, 16 Aug 2007 04:21:07 -0700, Paul Boddie <[EMAIL PROTECTED]> > > declaimed the following in comp.lang.python: > > >> Is this the book that came out before TurboGears even reached 1.0, > >> probably hav

Re: Question on SPE and pwintypes.dll

2007-08-17 Thread Gerry
On Aug 17, 10:14 am, [EMAIL PROTECTED] wrote: > On Aug 17, 8:38 am, Gerry <[EMAIL PROTECTED]> wrote: > > >I'm running SPE 8.3.c under XP, on a new PC. > > >The files for SPE and Python were copied to the new machine, but > > the OS wasn't migrated, so the registry didn't know about either.

Re: Getting the result of a process after exec*()

2007-08-17 Thread Miles
On 8/17/07, AndrewTK <[EMAIL PROTECTED]> wrote: > The problem for me is this: once an external process is called via > exec*() the script has effectively fulfilled its task. Is there any > way one can process a file with an external process and continue > further processing in Python; /once the ext

Re: advice about `correct' use of decorator

2007-08-17 Thread Gerardo Herzig
Laszlo Nagy wrote: > >>> >>> Are you developing a website or a GUI program? >>> >>> >> It will be used in a web development. It is an important point? > > Yes, I think. Unless you use AJAX. :-) Most web sites work this way: > > user clicks -> request to server -> process on server -> response > >

Re: best GUI library for vector drawing program

2007-08-17 Thread [EMAIL PROTECTED]
I used wxWidgets for a work like that. I found it quite easy to use and I found simple to create a Gui with wxdev which is quite rad. bye Pier Paolo -- http://mail.python.org/mailman/listinfo/python-list

Re: advice about `correct' use of decorator

2007-08-17 Thread Gerardo Herzig
BJörn Lindqvist wrote: >On 8/16/07, Gerardo Herzig <[EMAIL PROTECTED]> wrote: > > >>@is_logued_in >>def change_pass(): >>bla >>bla >> >>And so on for all the other functions who needs that the user is still >>loged in. >> >>where obviosly the is_logued_in() function will determine if the

help to make program better

2007-08-17 Thread yadin
hi! Can any one tell me why is it that i can't see my second frame and why is the value of freq not Appended in the First frame ...thanks I know it is wx python but it has to do with passing variables.thanks import wx def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1FREQ,

Re: help to make program better

2007-08-17 Thread math2life
On Aug 17, 9:27 am, yadin <[EMAIL PROTECTED]> wrote: > hi! > Can any one tell me why is it that i can't see my second frame and why > is the value of freq not Appended in the First frame ...thanks > I know it is wx python but it has to do with passing variables.thanks > > import wx > > def create(

help on object programing

2007-08-17 Thread yadin
class big(self): x = 32 list = [] def inside (self): class small(self): # a new class defined inside the first y = 348 list.append(y) # send the value to first list list.append(x) print list how can i define my variables so that there are

Re: best GUI library for vector drawing program

2007-08-17 Thread chewie54
On Aug 17, 12:08 pm, Jeremy Sanders wrote: > chewie54 wrote: > > What would be the best cross-platform GUI library to use for a vector > > based CAD program ( something like Visio on Windows ) WxWidgets, > > Tk, PyQt, Java Swing, Java SWT, I need the capibility to > > draw and edit in

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread Diez B. Roggisch
nikhilketkar schrieb: > What are the implications of the Global Interpreter Lock in Python ? > Does this mean that Python threads cannot exploit a dual core > processor and the only advantage of using threads is in that > computation and IO-bound operations can continue in parallel ? Essentially,

Re: best GUI library for vector drawing program

2007-08-17 Thread Jeremy Sanders
chewie54 wrote: > What would be the best cross-platform GUI library to use for a vector > based CAD program ( something like Visio on Windows ) WxWidgets, > Tk, PyQt, Java Swing, Java SWT, I need the capibility to > draw and edit in a window that looks like a page of paper so WYSIWYG >

Re: best GUI library for vector drawing program

2007-08-17 Thread chewie54
On Aug 17, 9:27 am, chewie54 <[EMAIL PROTECTED]> wrote: > Hello, > > What would be the best cross-platform GUI library to use for a vector > based CAD program ( something like Visio on Windows ) WxWidgets, > Tk, PyQt, Java Swing, Java SWT, I need the capibility to > draw and edit in a w

Can python threads take advantage of use dual core ?

2007-08-17 Thread nikhilketkar
What are the implications of the Global Interpreter Lock in Python ? Does this mean that Python threads cannot exploit a dual core processor and the only advantage of using threads is in that computation and IO-bound operations can continue in parallel ? Thanks, Nikhil -- http://mail.python.org/

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread Stefan Behnel
Diez B. Roggisch wrote: > nikhilketkar schrieb: >> What are the implications of the Global Interpreter Lock in Python ? >> Does this mean that Python threads cannot exploit a dual core >> processor and the only advantage of using threads is in that >> computation and IO-bound operations can continu

Re: Memory leak when creating lots of object

2007-08-17 Thread Terry Reedy
"Godzilla" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | What should I do next? Can I force garbage collection manually? If so, | how do I do that? Read doc for gc module. I think import gc gc.collect() -- http://mail.python.org/mailman/listinfo/python-list

Re: to property or function in class object

2007-08-17 Thread Steven Bethard
james_027 wrote: > i am very new to python, not knowing much about good design. I have an > object here for example a Customer object, where I need to retrieve a > info which has a number of lines of code to get it. > > my question is weather what approach should I use? to use the property > which

Re: help on object programing

2007-08-17 Thread mike
On Aug 17, 11:07 am, yadin <[EMAIL PROTECTED]> wrote: > class big(self): > > x = 32 > list = [] > def inside (self): > > class small(self): # a new class defined inside the first > > y = 348 > list.append(y) # send the value to first list > li

Making a copy (not reference) of a file handle, or starting stdin over at line 0

2007-08-17 Thread Shawn Milochik
I wrote a script which will convert a tab-delimited file to a fixed-width file, or a fixed-width file into a tab-delimited. It reads a config file which defines the field lengths, and uses it to convert either way. Here's an example of the config file: 1:6,7:1,8:9,17:15,32:10 This converts a fix

Python and Tkinter Programming--Expensive!

2007-08-17 Thread W. Watson
Why is the book in Subject (author is Grayson) so expensive? $100 on Amazon and $195 on ABE. Aren't there alternatives? -- Wayne Watson (Nevada City, CA) Web Page: -- http://mail.python.org/mailman/listinfo/python-list

Re: unexpected optparse set_default/set_defaults behavior

2007-08-17 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Some rather unexpected behavior in the set_default/set_defaults > methods for OptionParser that I noticed recently: > import optparse parser = optparse.OptionParser() parser.add_option("-r", "--restart", dest="restart", action="store_true") > parser.

Re: best GUI library for vector drawing program

2007-08-17 Thread chewie54
On Aug 17, 12:07 pm, chewie54 <[EMAIL PROTECTED]> wrote: > On Aug 17, 9:27 am, chewie54 <[EMAIL PROTECTED]> wrote: > > > Hello, > > > What would be the best cross-platform GUI library to use for a vector > > based CAD program ( something like Visio on Windows ) WxWidgets, > > Tk, PyQt, Java Sw

Re: Problem with directory recursion!

2007-08-17 Thread Robert Dailey
Here's part of the output that's incorrect: models\W_BoomerEdge BYOS_C.entity.xml BYOS_C_Collision.entity.xml Notice that the file BYOS_C.entity.xml is showing up as a file in the directory W_BoomerEdge. This file does not exist in this folder, but yet in a different folder. The o

Problem with directory recursion!

2007-08-17 Thread Robert Dailey
Hi, I've created a function that is used to recurse a directory tree in Windows XP using os.walk(). For the most part it works, however in some instances the data is incorrect and I'm getting invalid sub-directory paths. Here's the function: def __doSearch( root_dir, sub_path, restype, ext ):

Re: best GUI library for vector drawing program

2007-08-17 Thread Thomas Kellerer
chewie54 wrote on 17.08.2007 15:27: > Hello, > > What would be the best cross-platform GUI library to use for a vector > based CAD program ( something like Visio on Windows ) WxWidgets, > Tk, PyQt, Java Swing, Java SWT, I need the capibility to > draw and edit in a window that looks l

question

2007-08-17 Thread CarpeSkium
"I've parsed a webpage into a text file. In doing so, I've kept all the text I'm interested in, and removed all the text I don't want. My result is a text file that is comma-separated. However, the text file is one, very long, single string. I need to substitute every eighth (8th) comma with a new

Re: Python and Tkinter Programming--Expensive!

2007-08-17 Thread kyosohma
On Aug 17, 12:59 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > Why is the book in Subject (author is Grayson) so expensive? $100 on Amazon > and $195 on ABE. Aren't there alternatives? > -- > Wayne Watson (Nevada City, CA) > > Web Page: Probably b

Re: help on object programing

2007-08-17 Thread Neil Cerutti
On 2007-08-17, yadin <[EMAIL PROTECTED]> wrote: > class big(self): > > x = 32 > list = [] > def inside (self): > > class small(self): # a new class defined inside the first > > y = 348 > list.append(y) # send the value to first list > list.app

Re: question

2007-08-17 Thread Peter Otten
[EMAIL PROTECTED] wrote: > "I've parsed a webpage into a text file. In doing so, I've kept all > the text I'm interested in, and removed all the text I don't want. My > result is a text file that is comma-separated. However, the text file > is one, very long, single string. I need to substitute e

Re: Making a copy (not reference) of a file handle, or starting stdin over at line 0

2007-08-17 Thread Peter Otten
Shawn Milochik wrote: > How can I check a line (or two) from my input file (or stdin stream) > and still be able to process all the records with my function? One way: from itertools import chain firstline = instream.next() head = [firstline] # loop over entire file for line in chain(head, instr

Re: question

2007-08-17 Thread Shawn Milochik
You need to post some kind of code (even non-working) to show that you've actually done some work. Nobody will do your work for you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming dictionaries recursively

2007-08-17 Thread Paddy
On Aug 17, 3:43 pm, TYR <[EMAIL PROTECTED]> wrote: > > So the tougher problem seems to be parsing those lines. That is not a > > valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and > > `predatory` are not already defined. So you can't just ``eval`` it. > > In what way? {'key':

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread Bjoern Schliessmann
nikhilketkar wrote: > What are the implications of the Global Interpreter Lock in Python > ? Please have a look at the archives. This topic is brought up anew every few weeks. > Does this mean that Python threads cannot exploit a dual core > processor and the only advantage of using threads is

Encryption and hashing

2007-08-17 Thread Kless
Since that I'm working to let encrypt/hash data in the data base of my projects I have been looking for libraries and/or wrappers. So I want give my feedback about it. In the first I found PyCrypto [1] but I see any problems: * I think that isn't been maintained because the last modification of i

Re: Problem with directory recursion!

2007-08-17 Thread Robert Dailey
I figured it out. I was doing a recursive function call when I didn't have to. The walk() method already walks into every possible sub-directory for you! On 8/17/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Here's part of the output that's incorrect: > > models\W_BoomerEdge > BYOS_C.e

Re: Problem with directory recursion!

2007-08-17 Thread Laszlo Nagy
> > Does anyone see anything immediately suspicious about the code? Yes. os.walk does the recursion for you. Either you should use os.listdir instead of os.walk, or use os.walk ONCE and iterate over the results. I prefer to use the former because usually I do not remember how os.walk works. Re

Re: Encryption and hashing

2007-08-17 Thread Laszlo Nagy
> For who knows any of criptography I comment that you can use > algorithms as secure as Rijndael, Twofish, or Serpent with the CFB > cipher mode. And for hash you can use RIPEMD, SHA-2 or WHIRLPOOL. > As I recall, PyCrypto can also use these, and many others. And it can also do RSA. > And the

Re: Downloading multiple csv files from a website

2007-08-17 Thread tkpmep
Mike, Thanks for the pointers. I looked through the ASPN cookbook, but found a more reliable (and easier to implement) way to get the files I want. I downloaded GNU Wget from http://users.ugent.be/~bpuype/wget/( the current version is 1.10.2), and then ran it from Python as follows import os rc =

Re: best GUI library for vector drawing program

2007-08-17 Thread Jeremy Sanders
chewie54 wrote: > I looked at your application, Veusz (it looks very nice), and I see > you have binary distrubitions > for each os. Is is difficult to build these binaries for each > system. Could > you tell me how that is done? I use pyinstaller to make the binaries (see the veusz_pyinst.spe

Re: why psyco using more memery in liunx?

2007-08-17 Thread Michael L Torrie
kyo guan wrote: > Hi all: > > When you import psyco in python2.5, you can see the memery grow up near > 40MB in linux. but the same version python and > psyco, is only grow up 1MB under windows. I have a hunch it's because of how the OS's are reporting shared memory usage. IE, the 1 MB i

Re: how to convert a c program to java program

2007-08-17 Thread Matt McCredie
> I heard I need to port C program to JPython first and compile it to native > JAVA. I don't know > anything about JPython. Is there a tool to do the porting? If not, what is > the quickest way to learn > JPython? I'm assuming that you are refering to Jython. You probably want to start by learn

Re: help on object programing

2007-08-17 Thread DouhetSukd
> how can i define my variables so that there are valid outside the > class??? Not to be obnoxious, but your sample code has a number of fairly big conceptual issues (like subclassing self and assigning 32 at the big class level and printing 'list' which is a built-in type). Been there myself -

round-trip from egg to code and back to egg

2007-08-17 Thread Catherine
I'd like to use Scriptaculous with TurboGears on Python 2.5. Unfortunately, Scriptaculous is currently in the Cheese Shop only as a Python 2.4 egg. If I had the setup.py that was used to generate the egg, I think it would be really easy to generate a new Python 2.5 egg from the existing 2.4 egg.

Array and floating point

2007-08-17 Thread Jonathan Shan
Hello, I'm experiencing a problem where the float being appended to the array is not the same as the result of the appending. >>> from array import * >>> x = array('f') >>> x.append(float("0.1")) >>> x[0] 0.1000149011612 >>> float("0.1") 0.10001 I'm expecting x[0] = 0.100

Re: wxpython log redirect

2007-08-17 Thread kyosohma
On Aug 16, 2:29 pm, [EMAIL PROTECTED] wrote: > Hello, > > Why this wx example don't return \nHELLO WORLD and other text in same > window: > > import wx > import logging > import sys > > def nekaj(): > print "\nHELLO WORLD" > > class WxLog(logging.Handler): > def __init__(self, ctrl): >

Re: Array and floating point

2007-08-17 Thread Zentrader
On Aug 17, 2:06 pm, Jonathan Shan <[EMAIL PROTECTED]> wrote: > Hello, > > I'm experiencing a problem where the float being appended to the array > is not the same as the result of the appending. > > >>> from array import * > >>> x = array('f') > >>> x.append(float("0.1")) > >>> x[0] > 0.1000149

Re: Array and floating point

2007-08-17 Thread Peter Otten
Jonathan Shan wrote: > Hello, > > I'm experiencing a problem where the float being appended to the array > is not the same as the result of the appending. > from array import * x = array('f') x.append(float("0.1")) x[0] > 0.1000149011612 float("0.1") > 0.1000

Re: Array and floating point

2007-08-17 Thread Robert Kern
Jonathan Shan wrote: > Hello, > > I'm experiencing a problem where the float being appended to the array > is not the same as the result of the appending. > from array import * x = array('f') x.append(float("0.1")) x[0] > 0.1000149011612 float("0.1") > 0.1

Re: sub-classing the types in the builtin module datetime

2007-08-17 Thread Colin J. Williams
[EMAIL PROTECTED] wrote: [My question snipped] > > > > This problem arises when you change the function signature of __new__. > I'm a little unclear as to why but it seems for the classmethods > (thosed marked with the METH_CLASS flag in the C source code), you > need to arrange to bypass the no

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread sturlamolden
On Aug 17, 6:00 pm, nikhilketkar <[EMAIL PROTECTED]> wrote: > What are the implications of the Global Interpreter Lock in Python ? This is asked every second week or so. The GIL is similar to the Big Kernel Lock (BKL) use to support SMPs in older versions of the Linux kernel. The GIL prevents t

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread sturlamolden
On Aug 17, 6:00 pm, nikhilketkar <[EMAIL PROTECTED]> wrote: > What are the implications of the Global Interpreter Lock in Python ? This is asked every second week or so. The GIL is similar to the Big Kernel Lock (BKL) use to support SMPs in older versions of the Linux kernel. The GIL prevents t

Re: Encryption and hashing

2007-08-17 Thread Marshall T. Vandegrift
Kless <[EMAIL PROTECTED]> writes: > For who knows any of criptography I comment that you can use > algorithms as secure as Rijndael, Twofish, or Serpent with the CFB > cipher mode. And for hash you can use RIPEMD, SHA-2 or WHIRLPOOL. PyCrypto does includes the AES version of Rijndael as Crypto.Ci

Re: Python and Tkinter Programming--Expensive!

2007-08-17 Thread James Stroud
W. Watson wrote: > Why is the book in Subject (author is Grayson) so expensive? $100 on > Amazon and $195 on ABE. Aren't there alternatives? Read the fine print. Its available as an ebook for about $25.00 at Manning. You can print out just the parts you need--or read it from your iphone. Jame

Problems with threading in embedded Python

2007-08-17 Thread Nico Blodow
Hi all, I hope this hasn't been brought up before, but if it did i missed it, so bear with me please :) anyway, i'm trying to embed Python into a C program. A sample python syript i want to run is as follows: ---SNIP--- import time import threading go_on = 1 t = 0 def ProcessMessage(): prin

wxPython in C++ app using wxWidgets

2007-08-17 Thread Marcin Kalicinski
I have an application written in C++ that uses wxWidgets for GUI. I use embedded Python for scripting inside of this application. I want to use wxPython to add GUI to my scripts - because my C++ App uses wxWidgets I thought it to be easy. The problem is that wxPython knows nothing about wxApp/w

Hiding / encrypting source code

2007-08-17 Thread Ricardo Aráoz
Hi, I'm new to this python stuff so maybe I'm stating the obvious, or worse, maybe I'm completely off track. Not long ago someone was asking about a way to hide source code. I stumbled upon zipimport standard module. It seems it lets you get your imports from zip files. The docs say it is implicit

Re: best GUI library for vector drawing program

2007-08-17 Thread Alexander Schmolck
[x-posts removed] chewie54 <[EMAIL PROTECTED]> writes: > I should have also mentioned that is for a commercial application. That > doesn't rule Qt or PyQt out, but this is a startup company with very little > income so my first choice would be to use some GUI library that is free to > use for comme

Question about 'for' loop

2007-08-17 Thread Robert Dailey
Hi, I noticed that the 'for' loop can be used inline with a list definition. For example: print [i for i in mylist] My first question is what is the name for this? I couldn't find this usage in the python docs; I only managed to learn about it through code samples on the internet. Secondly, I'm

  1   2   >