Re: set function

2008-05-16 Thread Kam-Hung Soh
On Sat, 17 May 2008 15:49:05 +1000, Beema shafreen <[EMAIL PROTECTED]> wrote: Hi all, I need to find the intersection of 10 different files with ids defined as a_items, b_items and so on common_items = a_items&b_items&c_items&\ d_items&e_items&f_items\ &g_items&h

Re: Instance of class "object"

2008-05-16 Thread Carl Banks
On May 16, 4:46 am, "甜瓜" <[EMAIL PROTECTED]> wrote: > Howdy, > I wonder why below does not work. > > a = object() > a.b = 1# dynamic bind attribute failed... > > To make it correct, we have to create a new class: > class MyClass(object): pass > a = MyClass() > a.b = 1 # OK > > Doe

set function

2008-05-16 Thread Beema shafreen
Hi all, I need to find the intersection of 10 different files with ids defined as a_items, b_items and so on common_items = a_items&b_items&c_items&\ d_items&e_items&f_items\ &g_items&h_items&i_items&j_items i have included above line in the script is this an right w

Re: Classmethods are evil

2008-05-16 Thread Gabriel Genellina
En Sat, 17 May 2008 01:01:50 -0300, Ivan Illarionov <[EMAIL PROTECTED]> escribió: After re-reading "Python is not Java" I finally came to conclusion that classmethods in Python are a very Bad Thing. I can't see any use-case of them that couldn't be re-written more clearly with methods of meta

Re: Classmethods are evil

2008-05-16 Thread Carl Banks
On May 17, 12:01 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > After re-reading "Python is not Java" I finally came to conclusion that > classmethods in Python are a very Bad Thing. > > I can't see any use-case of them that couldn't be re-written more clearly > with methods of metaclass or plain

Re: how would you...?

2008-05-16 Thread Mensanator
On May 16, 11:43�pm, Sanoski <[EMAIL PROTECTED]> wrote: > I'm pretty new to programming. I've just been studying a few weeks off > and on. I know a little, and I'm learning as I go. Programming is so > much fun! I really wish I would have gotten into it years ago, but > here's my question. I have a

Re: Is using range() in for loops really Pythonic?

2008-05-16 Thread Graham Breed
George Sakkis wrote: If you push this logic too far, you should del every name immediately after the last statement it is used in the scope. I would generally find less readable some code spread with del every few lines, micro- managing the effective scope of each name. YMMV. Yes, but ... how

Re: Classmethods are evil

2008-05-16 Thread Marc 'BlackJack' Rintsch
On Sat, 17 May 2008 04:01:50 +, Ivan Illarionov wrote: > After re-reading "Python is not Java" I finally came to conclusion that > classmethods in Python are a very Bad Thing. > > I can't see any use-case of them that couldn't be re-written more clearly > with methods of metaclass or plain

Markov Analysis Help

2008-05-16 Thread dave
Hi Guys, I've written a Markov analysis program and would like to get your comments on the code As it stands now the final input comes out as a tuple, then list, then tuple. Something like ('the', 'water') ['us'] ('we', 'took')..etc... I'm still learning so I don't know any advanced techni

how would you...?

2008-05-16 Thread Sanoski
I'm pretty new to programming. I've just been studying a few weeks off and on. I know a little, and I'm learning as I go. Programming is so much fun! I really wish I would have gotten into it years ago, but here's my question. I have a longterm project in mind, and I wont to know if it's feasible a

Re: Rpy Module

2008-05-16 Thread [EMAIL PROTECTED]
On May 16, 3:14 pm, Mike P <[EMAIL PROTECTED]> wrote: > Hi experts, > > I've just seen there is an R module, what i can't see easily is if you > can / how to import other modules for R into the Rpy module > > Can anyone advise on this? > > Cheers > > Mike Do you mean like this? import rpy rpy.r('

Classmethods are evil

2008-05-16 Thread Ivan Illarionov
After re-reading "Python is not Java" I finally came to conclusion that classmethods in Python are a very Bad Thing. I can't see any use-case of them that couldn't be re-written more clearly with methods of metaclass or plain functions. They have the following issues: 1. You mix instance-level

Re: "indexed properties"...

2008-05-16 Thread Gabriel Genellina
(warning: it's a rather long message) En Fri, 16 May 2008 12:58:46 -0300, David C. Ullrich <[EMAIL PROTECTED]> escribió: On Thu, 15 May 2008 10:59:41 -0300, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Wed, 14 May 2008 18:15:41 -0300, David C. Ullrich <[EMAIL PROTECTED]> escribió: Th

help compiling Python on vs 2008!

2008-05-16 Thread inhahe
In order to compile Python, I need to compile 7 external libraries manually that don't come with Python, the first being tcl. I'm compiling on VS 2008. Since the Python source doesn't have a PCBuild9 directory, I'm using the PCBuild8 directory. When following readme.txt to a T, tcl won't compile

Re: writing python extensions in assembly

2008-05-16 Thread Ivan Illarionov
On Fri, 16 May 2008 10:13:04 -0400, inhahe wrote: > Can anyone give me pointers/instructions/a template for writing a Python > extension in assembly (or better, HLA)? Look up pygame sources. They have some hot inline MMX stuff. I experimented with this rescently and I must admit that it's etremel

Re: addendum Re: working with images (PIL ?)

2008-05-16 Thread Ivan Illarionov
On Wed, 14 May 2008 14:35:25 -0400, Poppy wrote: > I've put together some code to demonstrate what my goal is though > looping pixel by pixel it's rather slow. > > import Image > > def check_whitespace(): > im = Image.open("server\\vol\\temp\\image.jpg") > > size = im.size > >

Re: Separate output for log file and stdout

2008-05-16 Thread Ben Finney
[EMAIL PROTECTED] writes: > I've recently jumped big time into python and I'm working on a > software program for testing automation. Welcome, to both fields :-) > I had a question about proper logging of output. What I would like > is: > > 1. a function syslog (to log output to log file only)

Re: can't delete from a dictionary in a loop

2008-05-16 Thread MRAB
On May 16, 10:22 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > This might be more information than necessary, but it's the best way I > can think of to describe the question without being too vague. > > The task: > > I have a list of processes (well, strings to execute said processes) > and I want t

Re: Getting elements and text with lxml

2008-05-16 Thread Gabriel Genellina
En Fri, 16 May 2008 18:53:03 -0300, J. Pablo Fernández <[EMAIL PROTECTED]> escribió: Hello, I have an XML file that starts with: *-a out of it, I'd like to extract something like (I'm just showing one structure, any structure as long as all data is there is fine): [("ofc", "*"), "-",

Re: Malloc error

2008-05-16 Thread Gabriel Genellina
En Fri, 16 May 2008 16:08:41 -0300, mankoff <[EMAIL PROTECTED]> escribió: I'm brand spanking new to Python. Never coded in it, but I'm comfortable coding in general in other languages. Welcome...! I'm Trying to get some legacy code to run on a newer machine. I don't have access to the legacy

addendum Re: working with images (PIL ?)

2008-05-16 Thread Poppy
I've put together some code to demonstrate what my goal is though looping pixel by pixel it's rather slow. import Image def check_whitespace(): im = Image.open("server\\vol\\temp\\image.jpg") size = im.size i = 0 whitePixCount = 0 while i in range(size[1]): j =

working with images (PIL ?)

2008-05-16 Thread Poppy
I need to write a program to examine images (JPG) and determine how much area is whitespace. We need to throw a returned image out if too much of it is whitespace from the dataset we're working with. I've been examining the Python Image Library and can not determine if it offers the needed func

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
Ok. Here's the deal.. I've gathered a string of bytes that are turned into floats and stored in an array of floats. The stream gives me color channels represented in bytes. stream = 'ggbarrrggbb..' etc.. the number of

Separate output for log file and stdout

2008-05-16 Thread amit . uttam
Hey everyone, I've recently jumped big time into python and I'm working on a software program for testing automation. I had a question about proper logging of output. What I would like is: 1. a function syslog (to log output to log file only) 2. a function stdout (to log output to stdout only)

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
Very cool. > > a = ([''],['']) a represents a tile with height of 2 and width of 4 with 4 bits/pixel for each color. > >>> b = numpy.frombuffer(''.join(sum(a,[])),dtype='S1') this seperates the stream into individual values - Check > >>> b.shape=(2,4,4) This

Re: default object comparison considered harmful?

2008-05-16 Thread Terry Reedy
| On 16 Mai, 10:03, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: | > Yesterday we found the cause of a bug that has caused problems for a long time. | > It appeared to be the following: | > | > class A(object): | > pass | > | > print min(1.0, A()) | > | > which is accepted by Python even though th

Re: SImple python print question

2008-05-16 Thread amit . uttam
On May 16, 4:03 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On May 16, 6:38 pm, [EMAIL PROTECTED] wrote: > > > > > Hey there, > > > I have a simple question about python print statement. Take the > > following code snippet for example... > > > 1 print "-#- executing: %s" % section, > > 2 tests[sect

Re: SImple python print question

2008-05-16 Thread amit . uttam
On May 16, 4:02 pm, Hans Nowak <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hey there, > > > I have a simple question about python print statement. Take the > > following code snippet for example... > > > 1 print "-#- executing: %s" % section, > > 2 tests[section] = test.testcase(name=

Re: numpy.frombuffer != unpack() ??

2008-05-16 Thread Robert Kern
Marlin Rowley wrote: All: Say I have an array: a = ([''],['']) I'm sorry, you are going to have to be less elliptical. Exactly what do you have there? It's certainly not an array, but a tuple of single-element lists each containing a single string which can

Re: Get all the instances of one class

2008-05-16 Thread Gabriel Genellina
En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> escribió: Is there a simple way to get all the instances of one class? I mean without any additional change to the class. Try with gc.get_referrers() py> import gc py> class A(object): pass ... py> a,b,c = A(),A(),A() py> A py>

Re: Instance of class "object"

2008-05-16 Thread Terry Reedy
"Ìð¹Ï" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | > # an efficient 'Pair' class holding two objects | > class Pair(object): | >__slots__ = 'first', 'second' | > | > Instances of Pair take up even less room that 2-element tuples | > because they don't carry the size informat

Re: numpy.frombuffer != unpack() ??

2008-05-16 Thread Gary Herron
Marlin Rowley wrote: All: Say I have an array: a = ([''],['']) How do I make it so that I now have: starting with first element (a[0]) new_arr[0] = 'r' new_arr[1] = 'g' new_arr[2] = 'b' new_arr[3] = 'a' new_arr[4] = 'r' . continuing "through" a[1] wi

Re: Get all the instances of one class

2008-05-16 Thread Ben Finney
Terry <[EMAIL PROTECTED]> writes: > Is there a simple way to get all the instances of one class? Define "all". All the instances in the current scope? Perhaps more pertinent: What problem are you trying to address? -- \ “We demand rigidly defined areas of doubt and uncertainty!” | `

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Terry Reedy
"Dan Upton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | RuntimeError: dictionary changed size during iteration If you do not actually need a dict, an explicitly managed list is an [untested]alternative. maxproc = # procs = [] while True: if len(procs) < maxproc: [populate p

Get all the instances of one class

2008-05-16 Thread Terry
Hi, Is there a simple way to get all the instances of one class? I mean without any additional change to the class. br, Terry -- http://mail.python.org/mailman/listinfo/python-list

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
All: Say I have an array: a = ([''],['']) How do I make it so that I now have: starting with first element (a[0])new_arr[0] = 'r'new_arr[1] = 'g'new_arr[2] = 'b'new_arr[3] = 'a'new_arr[4] = 'r'. continuing "through" a[1] with the same new_arrnew_arr[N] = 'r'ne

Re: SImple python print question

2008-05-16 Thread Carl Banks
On May 16, 6:38 pm, [EMAIL PROTECTED] wrote: > Hey there, > > I have a simple question about python print statement. Take the > following code snippet for example... > > 1 print "-#- executing: %s" % section, > 2 tests[section] = test.testcase(name=config.get(section,'name')) > 3 tests[section].run

Re: SImple python print question

2008-05-16 Thread Hans Nowak
[EMAIL PROTECTED] wrote: Hey there, I have a simple question about python print statement. Take the following code snippet for example... 1 print "-#- executing: %s" % section, 2 tests[section] = test.testcase(name=config.get(section,'name')) 3 tests[section].runTest() 4 printStatus(tests[secti

Re: write to specific line in file?

2008-05-16 Thread castironpi
On May 16, 5:22 pm, castironpi <[EMAIL PROTECTED]> wrote: > On May 16, 2:25 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > > > globalrev wrote: > > > i ahve a program that takes certain textsnippets out of one file and > > > inserts them into another. > > > > problem is it jsut overwrites the first

Re: Instance of class "object"

2008-05-16 Thread Hrvoje Niksic
"甜瓜" <[EMAIL PROTECTED]> writes: >> # an efficient 'Pair' class holding two objects >> class Pair(object): >>__slots__ = 'first', 'second' >> >> Instances of Pair take up even less room that 2-element tuples >> because they don't carry the size information in the object. >> >> Now, if the obje

SImple python print question

2008-05-16 Thread amit . uttam
Hey there, I have a simple question about python print statement. Take the following code snippet for example... 1 print "-#- executing: %s" % section, 2 tests[section] = test.testcase(name=config.get(section,'name')) 3 tests[section].runTest() 4 printStatus(tests[section]) Now the problem is th

Re: save dictionary for later use?

2008-05-16 Thread castironpi
On May 16, 5:19 pm, castironpi <[EMAIL PROTECTED]> wrote: > On May 16, 4:29 pm, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > > On 16 mai, 22:24, globalrev <[EMAIL PROTECTED]> wrote: > > > > On 16 Maj, 21:22, jay graves <[EMAIL PROTECTED]> wrote: > > > > > On May 16, 2:17 pm, globalr

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Eduardo O. Padoan
On Fri, May 16, 2008 at 6:40 PM, Gary Herron <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> >> On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: >> >>> >>> Dan Upton wrote: >>> for pid in procs_dict: if procs_dict[pid].poll() != None # do the counter updates >

Re: Rpy Module

2008-05-16 Thread Manu Hack
On Fri, May 16, 2008 at 6:14 PM, Mike P <[EMAIL PROTECTED]> wrote: > Hi experts, > > I've just seen there is an R module, what i can't see easily is if you > can / how to import other modules for R into the Rpy module > > Can anyone advise on this? Say if you want to use Hmisc within rpy, impor

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
Thank you! That solved it! -M > To: python-list@python.org> From: [EMAIL PROTECTED]> Subject: Re: > numpy.frombuffer != unpack() ??> Date: Fri, 16 May 2008 17:25:00 -0500> > > Marlin Rowley wrote:> > All:> > > > I'm getting different floating point > values when I use numpy vs. unpack().>

Re: numpy.frombuffer != unpack() ??

2008-05-16 Thread Robert Kern
Marlin Rowley wrote: All: I'm getting different floating point values when I use numpy vs. unpack(). frgba = numpy.frombuffer(, dtype=float32) buffer = unpack("!f", byte) frgba[0] != buffer[0] why? This is forcing me use the unpack() function since it's giving me the correct values. W

Re: write to specific line in file?

2008-05-16 Thread castironpi
On May 16, 2:25 pm, 7stud <[EMAIL PROTECTED]> wrote: > globalrev wrote: > > i ahve a program that takes certain textsnippets out of one file and > > inserts them into another. > > > problem is it jsut overwrites the first riow every time. > > > i want to insert every new piece of text into the next

Re: save dictionary for later use?

2008-05-16 Thread castironpi
On May 16, 4:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 16 mai, 22:24, globalrev <[EMAIL PROTECTED]> wrote: > > > > > > > On 16 Maj, 21:22, jay graves <[EMAIL PROTECTED]> wrote: > > > > On May 16, 2:17 pm, globalrev <[EMAIL PROTECTED]> wrote: > > > > > i extract info from one file a

Re: can't delete from a dictionary in a loop

2008-05-16 Thread castironpi
On May 16, 4:51 pm, Hans Nowak <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On 16 mai, 23:34, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > >> On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: > > >>> Dan Upton wrote: > for pid in procs_dict: > > (snip) > >>>    for p

numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
All: I'm getting different floating point values when I use numpy vs. unpack(). frgba = numpy.frombuffer(, dtype=float32) buffer = unpack("!f", byte) frgba[0] != buffer[0] why? This is forcing me use the unpack() function since it's giving me the correct values. What am I doing wrong?

Rpy Module

2008-05-16 Thread Mike P
Hi experts, I've just seen there is an R module, what i can't see easily is if you can / how to import other modules for R into the Rpy module Can anyone advise on this? Cheers Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: namespaces and eval

2008-05-16 Thread dave . g1234
On May 16, 2:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 16 mai, 23:23, [EMAIL PROTECTED] wrote: > > > Thanks for the responses. I'm well aware that the function can be > > passed in the parameters, passing in the functino as an arg defeats > > the purpose of what I'm going after. >

Re: downloading a link with javascript in it..

2008-05-16 Thread Jan Claeys
Op Mon, 12 May 2008 22:06:28 +0200, schreef Diez B. Roggisch: > There is no way to interpret the JS in Python, There is at least one way: -- JanC -- http://mail.python.org/mailman/listinfo/python-list

Getting elements and text with lxml

2008-05-16 Thread J . Pablo Fernández
Hello, I have an XML file that starts with: *-a out of it, I'd like to extract something like (I'm just showing one structure, any structure as long as all data is there is fine): [("ofc", "*"), "-", ("rad", "a")] How can I do it? I managed to get the content of boths tags and the text u

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Hans Nowak
[EMAIL PROTECTED] wrote: On 16 mai, 23:34, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: Dan Upton wrote: for pid in procs_dict: (snip) for pid in procs_dict.keys(): I'm afraid this will do the same exact thing. A for loop on a d

Re: namespaces and eval

2008-05-16 Thread [EMAIL PROTECTED]
On 16 mai, 23:23, [EMAIL PROTECTED] wrote: > Thanks for the responses. I'm well aware that the function can be > passed in the parameters, passing in the functino as an arg defeats > the purpose of what I'm going after. Why so ? > @ Arnaud - Nice. I'm not sure what the performance of mine vs. yo

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Gary Herron
[EMAIL PROTECTED] wrote: On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: Dan Upton wrote: for pid in procs_dict: if procs_dict[pid].poll() != None # do the counter updates del procs_dict[pid] The problem: RuntimeError: dictionary changed size during iterati

Re: can't delete from a dictionary in a loop

2008-05-16 Thread [EMAIL PROTECTED]
On 16 mai, 23:34, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: > > > > Dan Upton wrote: > > > for pid in procs_dict: (snip) > >for pid in procs_dict.keys(): > > I'm afraid this will do the same exact thing. A for loop on a dict > itera

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Gary Herron
Dan Upton wrote: This might be more information than necessary, but it's the best way I can think of to describe the question without being too vague. The task: I have a list of processes (well, strings to execute said processes) and I want to, roughly, keep some number N running at a time. If

Re: can't delete from a dictionary in a loop

2008-05-16 Thread [EMAIL PROTECTED]
On 16 mai, 23:28, Hans Nowak <[EMAIL PROTECTED]> wrote: > Dan Upton wrote: > > for pid in procs_dict: > > if procs_dict[pid].poll() != None > ># do the counter updates > >del procs_dict[pid] > > > The problem: > > > RuntimeError: dictionary changed size during iteration > > I don't know i

Re: save dictionary for later use?

2008-05-16 Thread [EMAIL PROTECTED]
On 16 mai, 22:24, globalrev <[EMAIL PROTECTED]> wrote: > On 16 Maj, 21:22, jay graves <[EMAIL PROTECTED]> wrote: > > > On May 16, 2:17 pm, globalrev <[EMAIL PROTECTED]> wrote: > > > > i extract info from one file and put it into a dictionary. > > > i want to save that dictionary for later use, how

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Hans Nowak
Dan Upton wrote: for pid in procs_dict: if procs_dict[pid].poll() != None # do the counter updates del procs_dict[pid] The problem: RuntimeError: dictionary changed size during iteration I don't know if the setup with the pids in a dictionary is the best way to manage a pool of proc

Re: save dictionary for later use?

2008-05-16 Thread Hans Nowak
globalrev wrote: pickle.dumps(mg) pickle.load(mg) 'dict' object has no attribute 'readline' dumps load(well i dont know but i get no complaint but running load generates that error) The 'loads' and 'dumps' methods use strings: >>> import pickle >>> d = {"this": 42, "that": 101, "other": 17}

Re: namespaces and eval

2008-05-16 Thread dave . g1234
Thanks for the responses. I'm well aware that the function can be passed in the parameters, passing in the functino as an arg defeats the purpose of what I'm going after. @ Arnaud - Nice. I'm not sure what the performance of mine vs. yours, but a perfunctory glance looks like we're doing the clos

Re: save dictionary for later use?

2008-05-16 Thread jay graves
On May 16, 3:24 pm, globalrev <[EMAIL PROTECTED]> wrote: > On 16 Maj, 21:22, jay graves <[EMAIL PROTECTED]> wrote: > > On May 16, 2:17 pm, globalrev <[EMAIL PROTECTED]> wrote: > > > i extract info from one file and put it into a dictionary. > > > i want to save that dictionary for later use, how do

can't delete from a dictionary in a loop

2008-05-16 Thread Dan Upton
This might be more information than necessary, but it's the best way I can think of to describe the question without being too vague. The task: I have a list of processes (well, strings to execute said processes) and I want to, roughly, keep some number N running at a time. If one terminates, I

Re: encoding problem

2008-05-16 Thread Mike Driscoll
On May 16, 3:31 pm, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > Hi, guys. > I'm trying to read an xml file and output some of the nodes. For that, I'm > doing a > print node.toprettyxml() > > However, I get this exception: > > === >     out.write(tag.toxml()) > UnicodeEncodeError: 'ascii' codec c

Re: namespaces and eval

2008-05-16 Thread [EMAIL PROTECTED]
On 16 mai, 20:44, [EMAIL PROTECTED] wrote: > Suppose I have a function in module X that calls eval e.g, > > X.py > ___ > Def foo(bar): > Eval(bar) > ___ > > Now eval will be called using the default eval(bar,globals(),locals()) > and globals will pull in anything in module X. > > No

Re: namespaces and eval

2008-05-16 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: > Sorry for the repost, didnt' quite finish > > Suppose I have a function in module X that calls eval e.g, > > X.py > ___ > Def foo(bar): > Eval(bar) > ___ > > Now eval will be called using the default eval(bar,globals(),locals()) > and globals will pull i

Re: IDE for Python

2008-05-16 Thread Benjamin Kaplan
On Fri, May 16, 2008 at 4:08 PM, Joshua Kugler <[EMAIL PROTECTED]> wrote: > Jonathan Barbero wrote: > > I´m newbie with Python and to learn it better I want to use a good IDE > to > > concentrate on Python power. There is any IDE like Eclipse for Java for > > Python? If not, what is the best Pyth

Re: Scanning through Windows registry...

2008-05-16 Thread Lie
On May 17, 2:06 am, Lie <[EMAIL PROTECTED]> wrote: > On May 9, 7:36 pm, Unknown Hero <[EMAIL PROTECTED]> wrote:> Ah, never mind, > got it to work. Here's the code now. I hope I won't > > run into another problems later :D > > > > > #Goes through all keys and subkeys in the selected hive (defined

encoding problem

2008-05-16 Thread Luis Zarrabeitia
Hi, guys. I'm trying to read an xml file and output some of the nodes. For that, I'm doing a print node.toprettyxml() However, I get this exception: === out.write(tag.toxml()) UnicodeEncodeError: 'ascii' codec can't encode character u'\xba' in position 190: ordinal not in range(128) ===

Professional Grant Proposal Writing Workshop (August 2008: Boston, Massachusetts - University of Phoenix Campus)

2008-05-16 Thread Anthony Jones
The Grant Institute: Certificate in Professional Program Development and Grant Communication will be held at the University of Phoenix - Burlington Campus, August 18 - 22, 2008.  Interested development professionals, researchers, faculty, and graduate students should register as soon as possible

Re: save dictionary for later use?

2008-05-16 Thread globalrev
On 16 Maj, 21:22, jay graves <[EMAIL PROTECTED]> wrote: > On May 16, 2:17 pm, globalrev <[EMAIL PROTECTED]> wrote: > > > i extract info from one file and put it into a dictionary. > > i want to save that dictionary for later use, how do i do that? > > might save a list of dictionaries or a list of

Arch problems--how do I build PIL to be 64 bit so it plays nicely on OS X?

2008-05-16 Thread lampshade
Hello, I'm using python + django to do some web design and I would really like to use the python image library as part of this. There seems to be a problem, however, with apache and mod_python being 64 bit while my python image library(PIL) is only 32 bit. Does anyone have experience with buildi

Re: morning in Python

2008-05-16 Thread Chad Wilhite
On Fri, May 16, 2008 at 2:54 PM, Dan Upton <[EMAIL PROTECTED]> wrote: > On Fri, May 16, 2008 at 2:12 PM, inhahe <[EMAIL PROTECTED]> wrote: > > > > "George Sakkis" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > On May 16, 11:58 am, "inhahe" <[EMAIL PROTECTED]> wrote: > >> I'm n

Re: IDE for Python

2008-05-16 Thread Joshua Kugler
Jonathan Barbero wrote: > I´m newbie with Python and to learn it better I want to use a good IDE to > concentrate on Python power. There is any IDE like Eclipse for Java for > Python? If not, what is the best Python´s IDE for you? This is an EFAQ (extremely frequently asked question). http://www

Re: IDE for Python

2008-05-16 Thread Chad Wilhite
On Fri, May 16, 2008 at 11:33 AM, Jonathan Barbero < [EMAIL PROTECTED]> wrote: > Hi! > > I´m newbie with Python and to learn it better I want to use a good IDE to > concentrate on Python power. There is any IDE like Eclipse for Java for > Python? If not, what is the best Python´s IDE for you? > >

Re: write to specific line in file?

2008-05-16 Thread 7stud
globalrev wrote: > i ahve a program that takes certain textsnippets out of one file and > inserts them into another. > > problem is it jsut overwrites the first riow every time. > > i want to insert every new piece of text into the next row. > so: > 1. how do i write to a new line every time i writ

Professional Grant Proposal Writing Workshop (August 2008: Boston, Massachusetts - University of Phoenix Campus)

2008-05-16 Thread Anthony Jones
The Grant Institute: Certificate in Professional Program Development and Grant Communication will be held at the University of Phoenix - Burlington Campus, August 18 - 22, 2008.  Interested development professionals, researchers, faculty, and graduate students should register as soon as possible

Re: save dictionary for later use?

2008-05-16 Thread jay graves
On May 16, 2:17 pm, globalrev <[EMAIL PROTECTED]> wrote: > i extract info from one file and put it into a dictionary. > i want to save that dictionary for later use, how do i do that? > might save a list of dictionaries or a list of classobjects too if > there is any difference. use the 'pickle' m

save dictionary for later use?

2008-05-16 Thread globalrev
i extract info from one file and put it into a dictionary. i want to save that dictionary for later use, how do i do that? might save a list of dictionaries or a list of classobjects too if there is any difference. -- http://mail.python.org/mailman/listinfo/python-list

Malloc error

2008-05-16 Thread mankoff
Hi Group, I'm brand spanking new to Python. Never coded in it, but I'm comfortable coding in general in other languages. I'm Trying to get some legacy code to run on a newer machine. I don't have access to the legacy box for debugging. I'm getting the following error: Python(36979) malloc: *** e

Re: Scanning through Windows registry...

2008-05-16 Thread Lie
On May 9, 7:36 pm, Unknown Hero <[EMAIL PROTECTED]> wrote: > Ah, never mind, got it to work. Here's the code now. I hope I won't > run into another problems later :D > > > #Goes through all keys and subkeys in the selected hive (defined as > root) and replaces the value 'old' with the value 'new'

Re: morning in Python

2008-05-16 Thread castironpi
On May 16, 10:58 am, "inhahe" <[EMAIL PROTECTED]> wrote: > I'm not an expert in this but what does it mean to emphasize state?  It > seems the opposite of that would be a) functional programming, and b) > passing parameters instead of using global or relatively local variables. > And maybe c) corou

Re: write to specific line in file?

2008-05-16 Thread I-T
Open the file inside your script in append mode. open('filename', 'wa') On May 16, 11:41 pm, globalrev <[EMAIL PROTECTED]> wrote: > i ahve a program that takes certain textsnippets out of one file and > inserts them into another. > > problem is it jsut overwrites the first riow every time. > > i

Re: morning in Python

2008-05-16 Thread Dan Upton
On Fri, May 16, 2008 at 2:12 PM, inhahe <[EMAIL PROTECTED]> wrote: > > "George Sakkis" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > On May 16, 11:58 am, "inhahe" <[EMAIL PROTECTED]> wrote: >> I'm not an expert in this but what does it mean to emphasize state? It >> seems the oppo

namespaces and eval

2008-05-16 Thread dave . g1234
Sorry for the repost, didnt' quite finish Suppose I have a function in module X that calls eval e.g, X.py ___ Def foo(bar): Eval(bar) ___ Now eval will be called using the default eval(bar,globals(),locals()) and globals will pull in anything in module X. Now I have module Y tha

namespaces and eval

2008-05-16 Thread dave . g1234
Suppose I have a function in module X that calls eval e.g, X.py ___ Def foo(bar): Eval(bar) ___ Now eval will be called using the default eval(bar,globals(),locals()) and globals will pull in anything in module X. Now I have module Y that calls bar like so Y.py from x im

write to specific line in file?

2008-05-16 Thread globalrev
i ahve a program that takes certain textsnippets out of one file and inserts them into another. problem is it jsut overwrites the first riow every time. i want to insert every new piece of text into the next row. so: 1. how do i write to a new line every time i write to the file? 2. if i dont wa

Re: writing python extensions in assembly

2008-05-16 Thread Dan Upton
On Fri, May 16, 2008 at 2:08 PM, inhahe <[EMAIL PROTECTED]> wrote: > > "Dan Upton" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > >> >> On Fri, May 16, 2008 at 1:27 PM, Mensanator <[EMAIL PROTECTED]> wrote: >>> >>> Why wouldn't the compilers support it? It's part of the x86 >>> a

Re: morning in Python

2008-05-16 Thread inhahe
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On May 16, 11:58 am, "inhahe" <[EMAIL PROTECTED]> wrote: > I'm not an expert in this but what does it mean to emphasize state? It > seems the opposite of that would be a) functional programming, and b) > passing parameter

Re: writing python extensions in assembly

2008-05-16 Thread inhahe
"Dan Upton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Fri, May 16, 2008 at 1:27 PM, Mensanator <[EMAIL PROTECTED]> wrote: >> >> Why wouldn't the compilers support it? It's part of the x86 >> architexture, >> isn't it? > > Yeah, but I don't know if it uses it by default,

Re: Pyparsing Question

2008-05-16 Thread castironpi
On May 16, 10:45 am, Ant <[EMAIL PROTECTED]> wrote: > Hi Paul, > > > LineStart *really* wants to be parsed at the beginning of a line. > > Your textline reads up to but not including the LineEnd.  Try making > > these changes. > > > 1. Change textline to: > > >      textline = pp.Combine( > >      

Re: writing python extensions in assembly

2008-05-16 Thread [EMAIL PROTECTED]
On May 16, 12:24 pm, "inhahe" <[EMAIL PROTECTED]> wrote: > "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote in messagenews:[EMAIL PROTECTED] > > > > > 2. Once the code is functioning, benchmark it and find the > > bottlenecks. Replace the problem methods with a C extension. Refactor > > (and check yo

Re: Thread killing - I know I know!

2008-05-16 Thread [EMAIL PROTECTED]
On May 16, 11:40 am, Roger Heathcote <[EMAIL PROTECTED]> wrote: > Hello everyone, this is my first post so hello & please be gentle! > > Despite many peoples insistence that allowing for the arbitrary killing > of threads is a cardinal sin and although I have no particular threading > problem to cr

Re: writing python extensions in assembly

2008-05-16 Thread Dan Upton
>> 3. If it is still slow, embed some assembler where it is slowing down. >> > > I won't know if the assembler is faster until I embed it, and if I'm going > to do that I might as well use it. > Although it's true I'd only have to embed it for one system to see (more or > less). > Regardless of w

Re: Dbase / foxpro files

2008-05-16 Thread Ethan Furman
Johny wrote: Is there a module for reading/modifing db files from Python? Thanks for help B. -- http://mail.python.org/mailman/listinfo/python-list I'm switching my company's software base over from FoxPro 6 to Python. As part of that effort I have written (and am still enhancing :) a dbf.

Re: writing python extensions in assembly

2008-05-16 Thread Mensanator
On May 16, 11:24 am, "inhahe" <[EMAIL PROTECTED]> wrote: > "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote in messagenews:[EMAIL PROTECTED] > > > > > 2. Once the code is functioning, benchmark it and find the > > bottlenecks.  Replace the problem methods with a C extension.  Refactor > > (and check yo

Re: writing python extensions in assembly

2008-05-16 Thread Henrique Dante de Almeida
> > yeah I don't know much about that,  I was figuring perhaps I could limit the > assembler parts / methodology to something I could write generically > enough.. and if all else fails write for the other OS's or only support > windows.   also I think I should be using SIMD of some sort, and I'm no

  1   2   3   >