Re: HTML to dictionary

2007-02-27 Thread Tina I
Thanks people, I learned a lot!! :) I went for Herbert's solution in my application but I explored, and learned from, all of them. Tina -- http://mail.python.org/mailman/listinfo/python-list

Re: spawnl and waitpid

2007-02-27 Thread naima . mans
On 27 fév, 18:54, Thinker <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > [EMAIL PROTECTED] wrote: > > i have tried as you said (cf bellow) and same result... is there > > any link which explain how a server Web read script and send the > > answer ? > >

threading a thread

2007-02-27 Thread tubby
I have a program written in Python that checks a class B network (65536 hosts) for web servers. It does a simple TCP socket connect to port 80 and times out after a certain periods of time. The program is threaded and can do all of the hosts in about 15 minutes or so. I'd like to make it so tha

Re: spawnl and waitpid

2007-02-27 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > On 27 f憝, 18:54, Thinker <[EMAIL PROTECTED]> wrote: > hello > ha ok... > i tried this one and the browser don't write the message at once... > I have alos tried with thread and have the same result... :( Does child-proces

Importing WMI in a child Thread throws an error

2007-02-27 Thread kyosohma
Hi, I am trying to create a post logon script which does various tasks, like setup a printer based on location. While most of it works very fast, I have a second Python script that I run that scans the PC using WMI (among other things) and writes the following to a database: Name, Username, Machin

Re: Lists: Converting Double to Single

2007-02-27 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > If the values vary greatly in magnitude, you probably want to add them > from smallest to biggest; other than that, how else can you calculate the > mean? > It doesn't have to be smallest to largest, but the important thing is not to be adding the mil

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread shredwheat
On Feb 27, 3:35 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > I don't see any QPaintDevice here. Where does that come from? You need to > give more information, a stack trace and a reduced example exhibiting the > behaviour. QWidget is derived from QPaintDevice, under Qt, no widgets can be i

Re: finding out the precision of floats

2007-02-27 Thread Arnaud Delobelle
On 27 Feb, 14:09, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Feb 27, 1:36 pm, Facundo Batista <[EMAIL PROTECTED]> wrote: > > > Arnaud Delobelle wrote: > > > (and I don't want the standard Decimal class :) > > > Why? > > Why should you? It only gives you 28 significant digits, while 64-bit > fl

Tackling setup.py - A bug??

2007-02-27 Thread rh0dium
Hi Folks, I use p4python for all of my perforce and python related needs. I'm on a Mac (OSX 10.4). p4python relies on a perforce provided API which gets compiled when I run the setup.py. The setup.py by default does not support macs so I figured what better way to spend a night than to figure o

Re: book for a starter

2007-02-27 Thread Sriram
Hi, If you have experience programming, just read the online tutorial at http://docs.python.org/tut/tut.html I find Python Essential Reference (3rd Edition) (Developer's Library) (Paperback) invaluable though. BTW I have the 2nd edition. Amazon link : http://www.amazon.com/gp/pdp/profile/A9N9B1L0

Re: finding out the precision of floats

2007-02-27 Thread casevh
> Why should you? It only gives you 28 significant digits, while 64-bit > float (as in 32-bit version of Python) gives you 53 significant > digits. Also note, that on x86 FPU uses 80-bit registers. An then > Decimal executes over 1500 times slower. 64-bit floating point only gives you 53 binary bi

Re: book for a starter

2007-02-27 Thread Knight, Doug
Excellent choice. I used the 2nd edition for better than a year as a reference as I "came up to speed" on the language. Didn't know there was a 3rd edition out. Doug On Tue, 2007-02-27 at 11:08 -0800, Sriram wrote: > Hi, > > If you have experience programming, just read the online tutorial at >

Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1) pickle an object that inherits from "AutoReloader" 2) unpickle the object 3) modify one of the pickled'

Has anybody tried jasper reports

2007-02-27 Thread batok
Has anybody tried jasper reports ( java ) from python using jpype module ? It would be great to see an example of this. I've tried so many times with jpype but can't make this work out. Any hint would be appreciated. Tks. -- http://mail.python.org/mailman/listinfo/python-list

Re: book for a starter

2007-02-27 Thread RickMuller
On Feb 27, 12:08 pm, "Sriram" <[EMAIL PROTECTED]> wrote: > Hi, > > If you have experience programming, just read the online tutorial > athttp://docs.python.org/tut/tut.html > Seconded. It really is a wonderful introduction to Python. Once you've digested that, the Python Library Reference in the

difference between string and list

2007-02-27 Thread lincoln rutledge
I'm having trouble figuring out the difference between a string and a list. I know that: string = "foo bar" is a list of characters, "foo bar", and string[0] is "f". while: list = ["foo", "bar"] and list[0] is "foo". strings have methods like string.count("f") returns 1. What methods do lists

Re: difference between string and list

2007-02-27 Thread Paul Rubin
"lincoln rutledge" <[EMAIL PROTECTED]> writes: > strings have methods like string.count("f") returns 1. What methods do > lists have? Is it a similar class to string? Strings and lists are similar but not the same. dir(string) will show you the methods available for strings. dir(list) will sho

Re: difference between string and list

2007-02-27 Thread skip
lincoln> strings have methods like string.count("f") returns 1. What lincoln> methods do lists have? Is it a similar class to string? Similar in some ways, different in others. Some things to play with: 1. At an interpreter prompt, execute: help("") help([])

Re: Question about idiomatic use of _ and private stuff.

2007-02-27 Thread Bruno Desthuilliers
Eric Brunel a écrit : > On Sun, 25 Feb 2007 22:12:52 +0100, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >> Steven W. Orr a écrit : >> >>> I understand that two leading underscores in a class attribute make >>> the attribute private. >> >> >> Nope. It doesn't make it "private", it mangle

Re: difference between string and list

2007-02-27 Thread Bruno Desthuilliers
lincoln rutledge a écrit : > I'm having trouble figuring out the difference between a string and a > list. ['R', 'e', 'a', 'l', 'l', 'y', ' ', '?', ' ', 'S', 'e', 'e', 'm', 's', ' ', 'q', 'u', 'i', 't', 'e', ' ', 'o', 'b', 'v', 'i', 'o', 'u', 's', ' ', 't', 'o', ' ', 'm', 'e', '.'] > I know th

RE: Python Source Code Beautifier

2007-02-27 Thread Delaney, Timothy (Tim)
Alan Franzoni wrote: >> self.scriptcount = self.scriptcount + 1 => self.scriptcount += 1 > > the += operator is syntactic sugar just to save time... if one > doesn't use it I don't think it's a matter of beauty. This change can have semantic differences, and so should not be done for anything ex

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > Hello all, > > I'm using the metaclass trick for automatic reloading of class member > functions, found > at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 > > My problem is that if I > 1) pickle an object that inherits from "AutoReloader" > 2) unpickle the ob

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread boris . smirnov
shredwheat napísal(a): > On Feb 27, 3:35 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > I don't see any QPaintDevice here. Where does that come from? You need to > > give more information, a stack trace and a reduced example exhibiting the > > behaviour. > > QWidget is derived from QPaintDe

Re: difference between string and list

2007-02-27 Thread lincoln rutledge
Hi Skip, Okay, I actually have those pages up in my browser. I found the string methods: http://docs.python.org/lib/string-methods.html But I am having trouble finding the same information for lists... Thanks I will look into it some more, Lincoln >>> <[EMAIL PROTECTED]> 02/27/07 3:28 PM >>>

import parent

2007-02-27 Thread Greg
How does one get access to the class that imported a module. For example: foo imports bar -- how does bar access foo? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: design question: no new attributes

2007-02-27 Thread Alan Isaac
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] class Difficult(object): def __setattr__(self, name, value): if self.__dict__.has_key(name): print "'%s' exists as an instance attribute" % name self.__dict__[name] = value elif

Re: design question: no new attributes

2007-02-27 Thread Alan Isaac
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def __setattr__(self, attr, val): > if hasattr(self, attr): > self.__dict__[attr] = val > else: > # Tell the user off But then you cannot even set attributes during initialization, right? I wan

Re: import parent

2007-02-27 Thread Bjoern Schliessmann
Greg Hoover wrote: > How does one get access to the class that imported a module. For > example: foo imports bar -- how does bar access foo? Directly? Not at all in sane programs, IMHO. That's the job of clear interfaces. Regards, Björn -- BOFH excuse #407: Route flapping at the NAP. --

Re: threading a thread

2007-02-27 Thread Bjoern Schliessmann
tubby wrote: > Right now I'm just prototyping and the threaded hosts portion > works very well for my needs. I'd just like to add a threaded > ports check and wanted to know if anyone had done something > similar in Python. Taken the vast amount of threads you'll need, there will be a big overhead

Re: Importing WMI in a child Thread throws an error

2007-02-27 Thread Tim Golden
[EMAIL PROTECTED] wrote: > The problem I have is that since I import WMI, it takes a long time > and we have users complaining about it. So I stuck the import > statement into a separate thread and set it to a daemon so it could do > its thing in the background and the rest of the script would fin

boolean flag vs threading.Event

2007-02-27 Thread Daniel
I have a class similar to this: class MyThread(threading.Thread): def __init__(self): self.terminated = False def run(self): while not self.terminated: pass # do stuff here def join(self): self.terminated = True threading.Thread.join(self

Re: gmpy moving to code.google.com

2007-02-27 Thread Ziga Seilnacht
Alex Martelli wrote: > On Feb 27, 2007, at 2:59 AM, Daniel Nogradi wrote: > > > Hi Alex, > > > I did another test, this time with python 2.4 on suse and things are > > worse than in the previous case (which was python 2.5 on fedora 3), > > ouput of 'python gmp_test.py' follows: > > Interesting! gm

Re: threading a thread

2007-02-27 Thread tubby
Bjoern Schliessmann wrote: > tubby wrote: >> Right now I'm just prototyping and the threaded hosts portion >> works very well for my needs. I'd just like to add a threaded >> ports check and wanted to know if anyone had done something >> similar in Python. > > Taken the vast amount of threads you'

Pixel Array => Bitmap File

2007-02-27 Thread Jason B
Hi all, I'm somewhat new to Python and I'm trying to figure out the best way to accomplish the following: >From an array of pixel data in an XML file (given the format, width and height of the image as attributes) I must read in the data and save it off as a bmp file. I've gotten the PIL and

Re: import parent

2007-02-27 Thread John Machin
On Feb 28, 8:01 am, Greg Hoover wrote: > How does one get access to the class that imported a module. For example: > foo imports bar -- how does bar access foo? It shouldn't (in any language, not just Python). Callees should not in general need to inspect their caller's data structures, and shoul

Re: Pixel Array => Bitmap File

2007-02-27 Thread Roel Schroeven
Jason B schreef: > Hi all, > > I'm somewhat new to Python and I'm trying to figure out the best way to > accomplish the following: > > From an array of pixel data in an XML file (given the format, width and > height of the image as attributes) I must read in the data and save it off > as a bmp

Re: boolean flag vs threading.Event

2007-02-27 Thread Chris Mellon
On 27 Feb 2007 13:37:12 -0800, Daniel <[EMAIL PROTECTED]> wrote: > I have a class similar to this: > > > class MyThread(threading.Thread): > > def __init__(self): > self.terminated = False > > def run(self): > while not self.terminated: > pass # do stuff here > >

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:50 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > Hello all, > > > I'm using the metaclass trick for automatic reloading of class member > > functions, found > > at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 > > > My problem is that if I

Re: Pixel Array => Bitmap File

2007-02-27 Thread Jason B
Thanks, Roel... The Image.frombuffer() method looks promising, but the "mode" parameter seems a bit too limited for my needs. I must be able to specify not only the order of the bits (RGB in any order) but also whether the format is 565, 555, etc. Maybe I need to work outside the bounds of PI

Re: Pixel Array => Bitmap File

2007-02-27 Thread Jason B
My mistake, I see the section now about "Writing Your Own File Decoder..." Thanks again for your help! - J "Jason B" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks, Roel... > > The Image.frombuffer() method looks promising, but the "mode" parameter > seems a bit too limi

Re: import parent

2007-02-27 Thread Ben Finney
[EMAIL PROTECTED], [EMAIL PROTECTED] writes: > How does one get access to the class that imported a module. For > example: foo imports bar -- how does bar access foo? If bar needs to know something specific from foo, then bar should expose an interface that asks explicitly for that information,

Re: design question: no new attributes

2007-02-27 Thread Chris Mellon
On 2/27/07, Alan Isaac <[EMAIL PROTECTED]> wrote: > "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > def __setattr__(self, attr, val): > > if hasattr(self, attr): > > self.__dict__[attr] = val > > else: > > # Tell the user off > > But then

Re: book for a starter

2007-02-27 Thread Wensui Liu
Thank you all for your wonderful suggestion and advice. Have a great evening! wensui On 27 Feb 2007 12:08:46 -0800, RickMuller <[EMAIL PROTECTED]> wrote: > On Feb 27, 12:08 pm, "Sriram" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > If you have experience programming, just read the online tutorial

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > > Thanks Ziga. I use pickle protocol 2 and binary file types with the > command: "cPickle.dump(obj, file, 2)" > > I did your suggestion, i commented out the "__call__" function of > MetaInstanceTracker and copied the text to the __new__ function of > AutoReloader (code append

Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread Mattias Brändström
Hello! I'm trying to find what package I should use if I want to: 1. Create 3d vectors. 2. Normalize those vectors. 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in radians. 4. Perform matrix multiplication. It seems to me that perhaps numpy should be able to help me with t

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 5:30 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > > Thanks Ziga. I use pickle protocol 2 and binary file types with the > > command: "cPickle.dump(obj, file, 2)" > > > I did your suggestion, i commented out the "__call__" function of > > MetaInstanceTracker

Running Python scripts from BASH

2007-02-27 Thread Ishpeck
I'm using Python to automate testing software for my company. I wanted the computers in my testing lab to automatically fetch the latest version of the python scripts from a CVS repository and then ask a local database server which of the scripts to run. I built the following: #!/bin/bash # Bat

Re: Running Python scripts from BASH

2007-02-27 Thread Ishpeck
It may be worth noting that I'm running Cygwin on WindowsXP professional. -- http://mail.python.org/mailman/listinfo/python-list

Re: Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread Paul Rubin
"Mattias Brändström" <[EMAIL PROTECTED]> writes: > I'm trying to find what package I should use if I want to: > 1. Create 3d vectors. > 2. Normalize those vectors. > 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in > radians. > 4. Perform matrix multiplication. If this is a m

Re: Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread shredwheat
On Feb 27, 2:49 pm, "Mattias Brändström" <[EMAIL PROTECTED]> wrote: > I'm trying to find what package I should use if I want to: > > 1. Create 3d vectors. > 2. Normalize those vectors. > 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in > radians. > 4. Perform matrix multiplica

database without installation again

2007-02-27 Thread andrew_s
Hi! I'm looking for any database which I could use without need of instalation. I've read some threads here but I couldn't find any complete answer. On my ISP's server I can use Python throu cgi only. There is Python 2.4.3 and it has only standard library modules and no possibility to oficially

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread shredwheat
When your programs stops with the error, it should also be printing a stack trace. This is a list of all the functions that have been called when Python had the problem. You shouldn't have to do anything extra to get the stack trace. -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > I pasted the code into mine and replaced the old. It seems not to > work for either unpickled objects or new objects. I add methods to a > class that inherits from AutoReloader and reload the module, but the > new methods are not callable on the old objects. Man! It seems

Re: import parent

2007-02-27 Thread Larry Bates
Greg Hoover wrote: > How does one get access to the class that imported a module. For example: > foo imports bar -- how does bar access foo? > > Thanks. > I think we are having a problem understanding what you are asking. If you mean an instance of class foo contains an instance of class bar how

Re: database without installation again

2007-02-27 Thread Larry Bates
andrew_s wrote: > Hi! > > I'm looking for any database which I could use without need of instalation. > I've read some threads here but I couldn't find any complete answer. > On my ISP's server I can use Python throu cgi only. There is Python 2.4.3 > and it has only standard library modules and

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:23 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > I pasted the code into mine and replaced the old. It seems not to > > work for either unpickled objects or new objects. I add methods to a > > class that inherits from AutoReloader and reload the module, but

Re: Running Python scripts from BASH

2007-02-27 Thread Ben Finney
"Ishpeck" <[EMAIL PROTECTED]> writes: > I'm using Python to automate testing software for my company. I > wanted the computers in my testing lab to automatically fetch the > latest version of the python scripts from a CVS repository and then > ask a local database server which of the scripts to r

Re: Running Python scripts from BASH

2007-02-27 Thread James Stroud
Ishpeck wrote: > I'm using Python to automate testing software for my company. I > wanted the computers in my testing lab to automatically fetch the > latest version of the python scripts from a CVS repository and then > ask a local database server which of the scripts to run. > > I built the fo

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: > Thanks for checking. I think I narrowed the problem down to > inheritance. I inherit from list or some other container first: > > class PointList( list, AutoReloader ): > def PrintHi1(self): > print "Hi2" > > class MyPrintingClass( AutoReloader ): > def Prin

Re: database without installation again

2007-02-27 Thread Ben Finney
"andrew_s" <[EMAIL PROTECTED]> writes: > I'm looking for any database which I could use without need of > instalation. Python 2.5 comes with SQLite built in. SQLite allows database interaction without a corresponding server; all the code is in the client, in this case provided in the Python stand

how to convert an integer to a float?

2007-02-27 Thread [EMAIL PROTECTED]
Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, i1)' always return 0, can you please tell me how can i convert it from an integer to float? def compareValue(n1, n2): i1 = int(n1) i2 = int(n2) dx = abs(i2 - i1)/min(i2, i1) print dx return dx < 0.05 -- ht

Re: how to convert an integer to a float?

2007-02-27 Thread jeff
On Feb 27, 7:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? > > def compareValue(n1, n2): > i1 = int(n1) > i2 = int(n

Re: Python Source Code Beautifier

2007-02-27 Thread [EMAIL PROTECTED]
On Feb 27, 3:45 am, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: > Hello, I did not find any reasonable pyhton source code beautifier > program (preferable gui). > > Some would ask why? Program it immediatly good. > > (BTW: Would be a nice project, if I would have more spare time). > > Ich have s

Re: how to convert an integer to a float?

2007-02-27 Thread Farshid Lashkari
[EMAIL PROTECTED] wrote: > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? When two integers are involved in a division, the result will also be a division. If one of the operands

Re: how to convert an integer to a float?

2007-02-27 Thread Farshid Lashkari
Farshid Lashkari wrote: > When two integers are involved in a division, the result will also be a > division. My bad, I meant the result will also be an *integer* -Farshid -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert an integer to a float?

2007-02-27 Thread bearophileHUGS
yinglcs, you can use float() or the new division: >>> 1 / 2 0 >>> 1 / float(2) 0.5 >>> from __future__ import division >>> 1 / 2 0.5 Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert an integer to a float?

2007-02-27 Thread Matimus
On Feb 27, 4:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? > > def compareValue(n1, n2): > i1 = int(n1) > i2 = int(n

Re: how to convert an integer to a float?

2007-02-27 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > def compareValue(n1, n2): > i1 = int(n1) > i2 = int(n2) > > dx = abs(i2 - i1)/min(i2, i1) > print dx > return dx < 0.05 You could also prepend from __future__ import division Regards, Björn -- BOFH excuse #237: Plate voltage too low on demod

Re: threading a thread

2007-02-27 Thread Bjoern Schliessmann
tubby wrote: > Have you tried it? Nmap is sequential. RTFM? | NMAP(1)Nmap Reference GuideNMAP(1) | [...] | TIMING AND PERFORMANCE | [...] While Nmap utilizes parallelism and many advanced | algorithms to accelerate these scans, the user has ultimate |

PyCon blogs?

2007-02-27 Thread skip
Was anybody blogging about PyCon (talks and/or sprints)? Got any pointers? Thanks, Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Vector, matrix, normalize, rotate. What package?

2007-02-27 Thread James Stroud
Mattias Brändström wrote: > Hello! > > I'm trying to find what package I should use if I want to: > > 1. Create 3d vectors. > 2. Normalize those vectors. > 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in > radians. > 4. Perform matrix multiplication. > > It seems to me tha

Re: how to convert an integer to a float?

2007-02-27 Thread Grant Edwards
On 2007-02-28, jeff <[EMAIL PROTECTED]> wrote: > On Feb 27, 7:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, >> i1)' always return 0, can you please tell me how can i convert it from >> an integer to float? >> >> def com

Tuples from List

2007-02-27 Thread rshepard
While it should be easy for me to get what I need from a list, it's proving to be more difficult than I expected. I start with this list: [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j 3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948476e-01+0.j 1.43655139e-01+0.j 9.9

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:47 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Andrew Felch wrote: > > Thanks for checking. I think I narrowed the problem down to > > inheritance. I inherit from list or some other container first: > > > class PointList( list, AutoReloader ): > > def PrintHi1(self): > >

Re: import parent

2007-02-27 Thread Gary Herron
[EMAIL PROTECTED] wrote: > How does one get access to the class that imported a module. For example: > foo imports bar -- how does bar access foo? > > Thanks. > > If bar wants to access foo, it just imports it. If foo imports bar as well, then you have circular imports, but Python can handle

Re: Tuples from List

2007-02-27 Thread Robert Kern
[EMAIL PROTECTED] wrote: > While it should be easy for me to get what I need from a list, it's > proving to be more difficult than I expected. > > I start with this list: > > [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j >3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948

Re: Tuples from List

2007-02-27 Thread Ben Finney
[EMAIL PROTECTED] writes: > While it should be easy for me to get what I need from a list, it's > proving to be more difficult than I expected. > > I start with this list: > > [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j >3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948

Special Characters

2007-02-27 Thread Sick Monkey
I have a quick question about handling values with special characters. Lets say I have a file which contains: == blah#blah == Here is what I have for my code: f6 = open(fileAttached) msInfo = f6.readlines(); f6.close() varNam

Python, SOAP & SSL

2007-02-27 Thread Barker, CJ
Was this ever solved? I'm running into the same problem right now. Any help is much appreciated. -cjb -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples from List

2007-02-27 Thread Paul Rubin
[EMAIL PROTECTED] writes: > [ 6.24249034e-01+0.j 5.11335982e-01+0.j 3.67333773e-01+0.j >3.01189122e-01+0.j 2.43449050e-01+0.j 1.82948476e-01+0.j >1.43655139e-01+0.j 9.91225725e-02+0.j] > > and I want a list of floats of only the first 6 digits for each value. If I > write: >

Re: Is there a technic to avoid this bug

2007-02-27 Thread John J. Lee
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > hg wrote: [...] > > In a relatively similar domain, I spent a few hours find this bug: > > > > value == self.Get_Value() > > if value == WHATEVER: > >do this > > > > instead of > > value = self.Get_Value() > > if value == WHATEVER: > >do t

Re: Tuples from List

2007-02-27 Thread rshepard
On 2007-02-28, Robert Kern <[EMAIL PROTECTED]> wrote: > No, that's a numpy array. Robert, That's where I went off. I forgot that I'm still dealing with a 1D NumPy array and not a list. No wonder I had such fits! > Those aren't tuples, but complex numbers. I have not seen the 'j' suffix bef

Re: design question: no new attributes

2007-02-27 Thread Alan Isaac
OK, let me approach this from a new direction. Suppose I define a class that behaves I think as I stipulated:: class NothingNew: a = 0 def __init__(self): self.b = 1 self.initialized = True def __setattr__(self, attr, val): if not hasattr(self,'initialized') or

Re: os.system and quoted strings

2007-02-27 Thread Dan Bishop
On Feb 27, 9:16 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 27 Feb 2007 06:24:41 -0800, svata wrote: ... > > import time > > import os > > > dir = "C:\\Documents and Settings\\somepath\\" > > I believe that Windows will accept forward slashes as directory > separators, so you can write

Re: Special Characters

2007-02-27 Thread Sick Monkey
Sorry guys. It has been a long day today. There is no issues when dealing with "#" in variables. I found out that when I was reading the file, there were additional blank spaces being appended to the value. To correct the issue, I just had to dp varName = msInfo[0].strip() finName = varN

Re: Is there a technic to avoid this bug

2007-02-27 Thread Ben Finney
hg <[EMAIL PROTECTED]> writes: > I spent a few hours find this bug: > > value == self.Get_Value() > if value == WHATEVER: >do this > > instead of > value = self.Get_Value() > if value == WHATEVER: >do this > > Is there a way to avoid such a bug with some type of construct ? Use pylint to

Re: design question: no new attributes

2007-02-27 Thread Ben Finney
"Alan Isaac" <[EMAIL PROTECTED]> writes: > OK, let me approach this from a new direction. Suppose I define a > class that behaves I think as I stipulated:: > > class NothingNew: > a = 0 > def __init__(self): > self.b = 1 > self.initialized = True > def __setattr__(self

Re: how to convert an integer to a float?

2007-02-27 Thread Subscriber123
How did the new division ever get approved?! That's not pythonic! What if you then need to divide two integers and find an element in a list or dict? It will give you an error! I know that at the moment it is not implemented unless imported from __future__, but I expect that it eventually might be

Re: threading a thread

2007-02-27 Thread tubby
Bjoern Schliessmann wrote: > tubby wrote: > >> Have you tried it? Nmap is sequential. > > RTFM? I urge you to actually try it and see for yourself. From my experience, it sucks... even when only doing 1 port it takes hours regarless of what the man page implies. I'll figure it out, thanks, Tu

Yet another unique() function...

2007-02-27 Thread MonkeeSage
Here's yet another take on a unique() function for sequences. It's more terse than others I've seen and works for all the common use cases (please report any errors on the recipe page): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502263 Regards, Jordan -- http://mail.python.org/mail

Re: threading a thread

2007-02-27 Thread tubby
Bjoern Schliessmann wrote: > RTFM? One last things... here's a *very* small sample netstat output from a threaded py script: > tcp0 1 192.168.1.100:41066 192.168.17.132:www SYN_SENT > tcp0 1 192.168.1.100:46412 192.168.5.132:www SYN_SENT > tcp

Re: how to convert an integer to a float?

2007-02-27 Thread Ben Finney
Please don't top-post; instead, reply below the lines you're responding to, and trim any irrelevant lines from the original. Subscriber123 <[EMAIL PROTECTED]> writes: > How did the new division ever get approved?! By being introduced as a PEP, which is now numbered PEP 238. http://www.pytho

Re: design question: no new attributes

2007-02-27 Thread Steven D'Aprano
On Tue, 27 Feb 2007 20:59:03 +, Alan Isaac wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > class Difficult(object): > def __setattr__(self, name, value): > if self.__dict__.has_key(name): > print "'%s' exists as an instance att

Py2EXE problem

2007-02-27 Thread Sick Monkey
Maybe this is not the board to post this, but hopefully with all of the python experts out there maybe one of you have encountered this. I wrote an application that sends an email with an attachment. When I run it, it runs great with no issues what-so--ever. When I thought I was finally finish

Re: Yet another unique() function...

2007-02-27 Thread Paul Rubin
"MonkeeSage" <[EMAIL PROTECTED]> writes: > Here's yet another take on a unique() function for sequences. It's > more terse than others I've seen and works for all the common use > cases (please report any errors on the recipe page): > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/50226

Re: Yet another unique() function...

2007-02-27 Thread Paul Rubin
Paul Rubin writes: > def unique(seq, keepstr=True): > t = type(seq) > if t==str: > t = (list, ''.join)[bool(keepstr)] > seen = [] > return t(c for c in seq if (c not in seen, seen.append(c))[0]) Preferable: def unique(seq, keepstr=True): t =

Re: Yet another unique() function...

2007-02-27 Thread MonkeeSage
On Feb 27, 8:55 pm, Paul Rubin wrote: > Paul Rubin writes: > > def unique(seq, keepstr=True): > > t = type(seq) > > if t==str: > > t = (list, ''.join)[bool(keepstr)] > > seen = [] > > return t(c for c in seq if (c not in

Re: Yet another unique() function...

2007-02-27 Thread MonkeeSage
On Feb 27, 9:03 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: > On Feb 27, 8:55 pm, Paul Rubin wrote: > > > > > Paul Rubin writes: > > > def unique(seq, keepstr=True): > > > t = type(seq) > > > if t==str: > > > t = (list, ''.join)[

PyFit documentation

2007-02-27 Thread David Brochu
I am trying to run some testing using Fitnesse with the PyFit python module. For some reason I am not able to import the fit.ColumnFixture module from PyFit. I use the following command: from fit.ColumnFixture import ColumnFixture I can't find any documentation on the web for PyFit syntax. Anyon

Re: boolean flag vs threading.Event

2007-02-27 Thread Daniel
> But what are you gaining, really [by using a boolean flag instead of an > Event]? I agree Chris, the Event is better and it certainly does not add much if any overhead. Thanks for the response. ~ Daniel -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   >