Re: Bypassing __setattr__ for changing special attributes

2007-02-19 Thread Ziga Seilnacht
George Sakkis wrote: > I was kinda surprised that setting __class__ or __dict__ goes through > the __setattr__ mechanism, like a normal attribute: > > class Foo(object): > def __setattr__(self, attr, value): > pass > > class Bar(object): > pass > > >>> f = Foo() > >>> f.__class__ =

Re: How to test if one dict is subset of another?

2007-02-19 Thread Hendrik van Rooyen
"Jay Tee" <[EMAIL PROTECTED]> wrote: > Hi, > > I have some code that does, essentially, the following: > > - gather information on tens of thousands of items (in this case, jobs > running on a > compute cluster) > - store the information as a list (one per job) of Job items > (essentially

SICP video lectures

2007-02-19 Thread Paul Rubin
I didn't know about these! Enjoy. http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/ -- http://mail.python.org/mailman/listinfo/python-list

Re: 'import dl' on AMD64 platform

2007-02-19 Thread Nick Craig-Wood
John Pye <[EMAIL PROTECTED]> wrote: > On Feb 19, 6:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > John Pye <[EMAIL PROTECTED]> wrote: > > > application from running on the Debian Etch AMD64 platform. > > > It seems that the 'dl' module is not available on that platform. The > > > only re

file io (lagged values) newbie question

2007-02-19 Thread hiro
Hey there, I'm currently doing data preprocessing (generating lagged values for a time series) and I'm having some difficulties trying to write a file to disk. A friend of mine, wrote this quick example for me: ---

Re: threading and multicores, pros and cons

2007-02-19 Thread Paul Rubin
Nikita the Spider <[EMAIL PROTECTED]> writes: > note, there a (sort of) new module available that allows interprocess > communication via shared memory and semaphores with Python. You can find > it here: > http://NikitaTheSpider.com/python/shm/ This is from the old shm module that was floating

Re: exec "def.." in globals(), locals() does not work

2007-02-19 Thread xml0x1a
On Feb 19, 8:15 pm, "George Sakkis" <[EMAIL PROTECTED]> wrote: > On Feb 19, 10:52 pm, [EMAIL PROTECTED] wrote: > > > How do I use exec? > > Before you ask this question, the one you should have an answer for is > "why do I (think I) have to use exec ?". At least for the example you > gave, you don'

Bypassing __setattr__ for changing special attributes

2007-02-19 Thread George Sakkis
I was kinda surprised that setting __class__ or __dict__ goes through the __setattr__ mechanism, like a normal attribute: class Foo(object): def __setattr__(self, attr, value): pass class Bar(object): pass >>> f = Foo() >>> f.__class__ = Bar >>> print f.__class__ is Foo True Is

Re: exec "def.." in globals(), locals() does not work

2007-02-19 Thread George Sakkis
On Feb 19, 10:52 pm, [EMAIL PROTECTED] wrote: > How do I use exec? Before you ask this question, the one you should have an answer for is "why do I (think I) have to use exec ?". At least for the example you gave, you don't; Python supports local functions and nested scopes, with no need for exec:

exec "def.." in globals(), locals() does not work

2007-02-19 Thread xml0x1a
How do I use exec? >python -V Python 2.4.3 from math import * G = 1 def d(): L = 1 exec "def f(x): return L + log(G) " in globals(), locals() f(1) How do I use exec() such that: 1. A function defined in exec is available to the local scope (after exec returns) 2. The defined funct

Found a product for running Python-based websites off CDROM -have anybody tried it?

2007-02-19 Thread David Wishnie
Hello, Recently I've found a product that allows to create CDs or DVDs with mod_python -based websites (and CGI python of course) so that apache-based webserver, python and mod_python are run directly off CD on Windows, MacOS X and Linux at the same time (also it seems to support perl, java,

Re: Checking for EOF in stream

2007-02-19 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > So this is the way to check for EOF. If you don't like how it was spelled, > try this: > >if data=="": break How about: if not data: break ? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: pylab, integral of sinc function

2007-02-19 Thread Robert Kern
Schüle Daniel wrote: > Hello, > > In [19]: def simple_integral(func,a,b,dx = 0.001): > : return sum(map(lambda x:dx*x, func(arange(a,b,dx > : > > In [20]: simple_integral(sin, 0, 2*pi) > Out[20]: -7.5484213527594133e-08 > > ok, can be thought as zero > > In [21]: simple_

Re: Checking for EOF in stream

2007-02-19 Thread Grant Edwards
On 2007-02-20, GiBo <[EMAIL PROTECTED]> wrote: >>> stream = sys.stdin >>> while True: >>> data = stream.read(1024) >> if len(data) == 0: >> break #EOF >>> process_data(data) > > Right, not a big difference though. Isn't there a cleaner / > more intuitive way? A file is at E

Re: pylab, integral of sinc function

2007-02-19 Thread Paul Rubin
Schüle Daniel <[EMAIL PROTECTED]> writes: > > return dx * sum(map(func, arange(a,b,dx))) > yes, this should be faster :) You should actually use itertools.imap instead of map, to avoid creating a big intermediate list. However I was mainly concerned that the original version might be incorrec

Re: pylab, integral of sinc function

2007-02-19 Thread Schüle Daniel
[...] >> In [19]: def simple_integral(func,a,b,dx = 0.001): >> : return sum(map(lambda x:dx*x, func(arange(a,b,dx > > Do you mean > > def simple_integral(func,a,b,dx = 0.001): > return dx * sum(map(func, arange(a,b,dx))) > yes, this should be faster :) -- http://mail.pyth

Re: New-style classes (was Re: Checking for EOF in stream)

2007-02-19 Thread Steven Bethard
GiBo wrote: > One more question - is it likely that StringIO will be turned into > new-style class in the future? The reason I ask is whether I should try > to deal with detection of new-/old-style classes or take the > old-styleness for granted and set in stone instead. In Python 3.0, everything

Re: Newbie help looping/reducing code

2007-02-19 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >Lance Hoffmeyer <[EMAIL PROTECTED]> writes: >> def even_odd_round(num): >> if(round(num,2) + .5 == int(round(num,2)) + 1): >> if num > .5: >> if(int(num) % 2): >>

Re: New-style classes (was Re: Checking for EOF in stream)

2007-02-19 Thread GiBo
Gabriel Genellina wrote: > En Mon, 19 Feb 2007 22:30:59 -0300, GiBo <[EMAIL PROTECTED]> escribió: > >> Is there a reason why some classes distributed with Python 2.5 are not >> new-style classes? For instance StringIO is apparently "old-style" class >> i.e. not inherited from "object". Can I someh

Re: Checking for EOF in stream

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 21:50:11 -0300, GiBo <[EMAIL PROTECTED]> escribió: > Grant Edwards wrote: >> On 2007-02-19, GiBo <[EMAIL PROTECTED]> wrote: >>> >>> Classic situation - I have to process an input stream of unknown length >>> until a I reach its end (EOF, End Of File). How do I check for EOF? Th

Re: pylab, integral of sinc function

2007-02-19 Thread Paul Rubin
Schüle Daniel <[EMAIL PROTECTED]> writes: > In [19]: def simple_integral(func,a,b,dx = 0.001): > : return sum(map(lambda x:dx*x, func(arange(a,b,dx Do you mean def simple_integral(func,a,b,dx = 0.001): return dx * sum(map(func, arange(a,b,dx))) -- http://mail.python.org/mai

Re: New-style classes (was Re: Checking for EOF in stream)

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 22:30:59 -0300, GiBo <[EMAIL PROTECTED]> escribió: > Is there a reason why some classes distributed with Python 2.5 are not > new-style classes? For instance StringIO is apparently "old-style" class > i.e. not inherited from "object". Can I somehow turn an existing > old-style

Re: Checking for EOF in stream

2007-02-19 Thread GiBo
Grant Edwards wrote: > On 2007-02-19, GiBo <[EMAIL PROTECTED]> wrote: >> Hi! >> >> Classic situation - I have to process an input stream of unknown length >> until a I reach its end (EOF, End Of File). How do I check for EOF? The >> input stream can be anything from opened file through sys.stdin to

Re: FPE: Add bindings to exception tracebacks.

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 19:47:26 -0300, Nathan <[EMAIL PROTECTED]> escribió: > Throughout my python development career, I've occasionally made > various developer tools to show more information about assertions or > exceptions with less hassle to the programmer. Until now, these tools > didn't pass a

New-style classes (was Re: Checking for EOF in stream)

2007-02-19 Thread GiBo
GiBo wrote: > Hi! > > Classic situation - I have to process an input stream of unknown length > until a I reach its end (EOF, End Of File). How do I check for EOF? > [...] > I'd better like something like: > > while not stream.eof(): > ... Is there a reason why some classes distributed wi

Re: pylab, integral of sinc function

2007-02-19 Thread Schüle Daniel
my fault In [31]: simple_integral(lambda x:sinc(x/pi), -1000, 1000) Out[31]: 3.14046624406611 -- http://mail.python.org/mailman/listinfo/python-list

pylab, integral of sinc function

2007-02-19 Thread Schüle Daniel
Hello, In [19]: def simple_integral(func,a,b,dx = 0.001): : return sum(map(lambda x:dx*x, func(arange(a,b,dx : In [20]: simple_integral(sin, 0, 2*pi) Out[20]: -7.5484213527594133e-08 ok, can be thought as zero In [21]: simple_integral(sinc, -1000, 1000) Out[21]: 0.999797

Re: Getting a class name

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 17:25:56 -0300, Fuzzyman <[EMAIL PROTECTED]> escribió: > On Feb 19, 5:11 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Sun, 18 Feb 2007 20:56:48 -0300, Fuzzyman <[EMAIL PROTECTED]> >> escribió: >> > [somebody] wrote: >> >> >>> > def getCodeName(deap=0): >> >> >>> >

Re: Newbie help looping/reducing code

2007-02-19 Thread Paul Rubin
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > def even_odd_round(num): > if(round(num,2) + .5 == int(round(num,2)) + 1): > if num > .5: >if(int(num) % 2): > num = round(num,2) + .1 #an odd number >else: >

Re: search cursor in pythonwin 2.1

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 12:21:27 -0300, GISDude <[EMAIL PROTECTED]> escribió: > Thanks for the reply. After looking at the docs again, you are correct > "NAMES" IS NOT NULL would be the correct syntax. > > I thought it was "NAMES" <> NULL Python has some gotchas like default mutable arguments, that

Re: Checking for EOF in stream

2007-02-19 Thread Grant Edwards
On 2007-02-19, GiBo <[EMAIL PROTECTED]> wrote: > Hi! > > Classic situation - I have to process an input stream of unknown length > until a I reach its end (EOF, End Of File). How do I check for EOF? The > input stream can be anything from opened file through sys.stdin to a > network socket. And it'

Re: writing a file:newbie question

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 08:02:29 -0300, kavitha thankaian <[EMAIL PROTECTED]> escribió: > Hi, > i have a file test.txt and it contains a list of strings say,,, > "a","b","c","d","a1","b1","c1","d1","a2","b2","c2","d2", > i would like to write the file as > "a","b","c","d" > "a1","b1","c1","d1

Re: Building Python Pagage for Newer Python Version

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 11:00:18 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: >> I have just downloaded the source for PyXML-0.8.4, which I would like >> to build for Python 2.5. How exactly do I go about doing this? > > python2.5 setup.py install usually does the trick. Beware of this mes

Re: Pep 3105: the end of print?

2007-02-19 Thread Peter mayne
Steven D'Aprano wrote: > If Python 3 dropped the print > statement and replaced it with official_print_function(), how would that > help you in your goal to have a single code base that will run on both > Python 2.3 and Python 3, while still using print? Is there any reason why official_print_func

Re: cmd all commands method?

2007-02-19 Thread Gabriel Genellina
En Mon, 19 Feb 2007 00:08:45 -0300, placid <[EMAIL PROTECTED]> escribió: > If anyone can provide a suggestion to replicate the following Tcl > command in Python, i would greatly appreciate it. > > namespace eval foo { > variable bar 12345 > } > > what this does is create a namespace foo with t

Checking for EOF in stream

2007-02-19 Thread GiBo
Hi! Classic situation - I have to process an input stream of unknown length until a I reach its end (EOF, End Of File). How do I check for EOF? The input stream can be anything from opened file through sys.stdin to a network socket. And it's binary and potentially huge (gigabytes), thus "for line

Re: Newbie help looping/reducing code

2007-02-19 Thread Paul Rubin
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > T2B = even_odd_round(float(str(T2B))) > VS = even_odd_round(float(str(VS))) > SS = even_odd_round(float(str(SS))) > sh.Cells(21,lastcol+1).Value = float(str(T2B))/100 > sh.Cells(22,lastcol+1).Value = float(str(VS))/100 > sh.Cells(23,lastcol+1).Va

Free Flash Games

2007-02-19 Thread Flash Games
Free Flash Games http://www.clipplay.com/ fun videos games and more. Fun flash games. Free flash games... -- http://mail.python.org/mailman/listinfo/python-list

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Stef Mientki
> > It's now the *3rd* time I mention Glade, wxGlade and QTDesigner in this > thread. Hendrik, I know *exactly* what Stef is talking about - been > here, done that. Doubt, that know what I'm talking about ... ... Glade, wxGlade, QTDesigner are not my choice ;-) ... at the moment I tend towards

Newbie help looping/reducing code

2007-02-19 Thread Lance Hoffmeyer
Hey all, Can someone help me reduce this code? It sure seems like there ought to be a way to loop this or combine things so that there is only 1 or 3 lines to this instead of 6. I've been scratching my head over this for a while though I can't come up with anything. Just as a note, I need even_

Re: PyDev on Mac

2007-02-19 Thread Mark
On Sun, 18 Feb 2007 10:50:37 +0100, Diez B. Roggisch wrote: > Just wait until my crystal ball comes back from the cleaners, and I > will start looking at your problem. > > As you can lay back and do nothing while that happens, I suggest you > take this highly entertaining read: Now that is an ente

FPE: Add bindings to exception tracebacks.

2007-02-19 Thread Nathan
Hi folks! Throughout my python development career, I've occasionally made various developer tools to show more information about assertions or exceptions with less hassle to the programmer. Until now, these tools didn't pass a utility vs pain-to-use threshold. Now I've created a tool I believe t

Re: How do I create an array of functions?

2007-02-19 Thread Steven D'Aprano
On Mon, 19 Feb 2007 05:17:03 -0800, Rob Wolfe wrote: >> > # test.py >> > >> > def fun1(): return "fun1" >> > def fun2(): return "fun2" >> > def fun3(): return "fun3" >> > >> > # list of functions >> > dsp = [f for fname, f in sorted(globals().items()) if callable(f)] >> >> Hmmm... when I try that,

Re: Declare a variable global

2007-02-19 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> >>> Hi, >>> I have the following code: >>> colorIndex = 0; >>> def test(): >>> print colorIndex; >>> This won't work

Re: Declare a variable global

2007-02-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > >>On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> >> >>>Hi, >> >>>I have the following code: >> >>>colorIndex = 0; >> >>>def test(): >>>print colorIndex; >> >>>T

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Feb 16, 4:22 pm, [EMAIL PROTECTED] wrote: > >>I am VB6 programmer and wants to start new programming language but i >>am unable to deciced. >> >>i have read about Python, Ruby and Visual C++. but i want to go >>through with GUI based programming language like VB.ne

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Bruno Desthuilliers
Hendrik van Rooyen a écrit : > "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote: > > > >>Stef Mientki a écrit : >>(snip) >> >>>I've been using Python for just 2 months, and didn't try any graphical >>>design, >> >>So how can you comment on GUI programming with Python ? > > > I think we have a

Re: Declare a variable global

2007-02-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi, > > I have the following code: > > colorIndex = 0; You don't need the ; > > def test(): > print colorIndex; Idem. > This won't work. Why ? Or more exactly : for which definition of "won't work" ? (hint: this code prints 0 on sys.stdout - I don't know

Re: How to call a function defined in another py file

2007-02-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi, > > I have a function called 'test' defined in A.py. > How can I call that function test in my another file B.py? > > Thank you. > # b.py import A A.test() -- http://mail.python.org/mailman/listinfo/python-list

Re: How to call a function defined in another py file

2007-02-19 Thread Martin Blume
<[EMAIL PROTECTED]> schrieb >> >>> I have a function called 'test' defined in A.py. >>> How can I call that function test in my another file B.py? >> >> In B.py: >> import A >> A.test() >> > > But Do I need to put A.py and B.py in the same directory? No, but then you have to take certain preca

Re: How to call a function defined in another py file

2007-02-19 Thread Jeremy Gransden
On Feb 19, 2007, at 3:27 PM, [EMAIL PROTECTED] wrote: > On Feb 19, 2:22 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: >> <[EMAIL PROTECTED]> schrieb >> >>> I have a function called 'test' defined in A.py. >>> How can I call that function test in my another file B.py? >> >> In B.py: >> >> import A

Re: How to call a function defined in another py file

2007-02-19 Thread Jeremy Gransden
from a import test be sure a is in your path. jeremy On Feb 19, 2007, at 3:20 PM, [EMAIL PROTECTED] wrote: > Hi, > > I have a function called 'test' defined in A.py. > How can I call that function test in my another file B.py? > > Thank you. > > -- > http://mail.python.org/mailman/listinfo/p

Re: bluetooth on windows.......

2007-02-19 Thread M�ta-MCI
Hi! >> try to find a PyBluez version already built for your Python 2.5 On the site : http://org.csail.mit.edu/pybluez/release/PyBluez-0.9.1.win32-py2.5.exe -- http://mail.python.org/mailman/listinfo/python-list

Re: How to call a function defined in another py file

2007-02-19 Thread silverburgh . meryl
On Feb 19, 2:22 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> schrieb > > > I have a function called 'test' defined in A.py. > > How can I call that function test in my another file B.py? > > In B.py: > > import A > > A.test() > > HTH > Martin But Do I need to put A.py and B.

Re: Getting a class name

2007-02-19 Thread Fuzzyman
On Feb 19, 5:11 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 18 Feb 2007 20:56:48 -0300, Fuzzyman <[EMAIL PROTECTED]> escribió: > > > > > [somebody] wrote: > >> >>> > def getCodeName(deap=0): > >> >>> > return sys._getframe(deap+1).f_code.co_name > > >> >>> > class MyClass (obje

Re: How to call a function defined in another py file

2007-02-19 Thread Martin Blume
<[EMAIL PROTECTED]> schrieb > > I have a function called 'test' defined in A.py. > How can I call that function test in my another file B.py? > In B.py: import A A.test() HTH Martin -- http://mail.python.org/mailman/listinfo/python-list

How to call a function defined in another py file

2007-02-19 Thread silverburgh . meryl
Hi, I have a function called 'test' defined in A.py. How can I call that function test in my another file B.py? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Forking SocketServer daemon -- updating state

2007-02-19 Thread Irmen de Jong
Reid Priedhorsky wrote: > Another possibility is that the signal handler simply sets a needs_update > flag, which I could check for in a handle_request() loop. The disadvantage > here is that the update wouldn't happen until after the next request is > handled, and I would like the state to be ava

Forking SocketServer daemon -- updating state

2007-02-19 Thread Reid Priedhorsky
Hi folks, I am implementing a forking SocketServer daemon that maintains significant internal state (a graph that takes ~30s to build by fetching from a SQL database, and eventually further state that may take up to an hour to build). I would like to be able to notify the daemon that it needs to

Re: ocaml to python

2007-02-19 Thread Jon Harrop
Gigs_ wrote: > Is there any way to convert ocaml code to python? but not manually Translating between dissimilar high-level languages is very difficult, so difficult that it is hard to do such a task justice by hand, let alone automating the procedure. If you must do it then write a compiler that

Re: Declare a variable global

2007-02-19 Thread Terry Reedy
| Here is my complete script: | #!/usr/bin/python | | import re | import sys | import time | import os | import shutil | | colors = ["#FF", "#00FF00", "#FF", | "#00" ,"#FFA500" ,"#DA70D6"] | colorIndex = 0 | | def getText( intputstr): |rc = "" | |maxX = 0; |maxY = 0; |m

Re: PyDev on Mac

2007-02-19 Thread Fabio Zadrozny
On 19 Feb 2007 10:41:41 -0800, Ahmer <[EMAIL PROTECTED]> wrote: On Feb 18, 4:50 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Ahmer schrieb: > > > I've been trying to set up PyDev on my new MacBook Pro, but i have not > > had an success. > > > Could you please help! > > Just wait until my

Re: PyDev on Mac

2007-02-19 Thread Ahmer
On Feb 18, 4:50 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Ahmer schrieb: > > > I've been trying to set up PyDev on my new MacBook Pro, but i have not > > had an success. > > > Could you please help! > > Just wait until my crystal ball comes back from the cleaners, and I will > start looki

Re: How to detect closing of wx.Panel?

2007-02-19 Thread Jacol
Morpheus wrote: > On Mon, 19 Feb 2007 01:18:11 +, Jacol wrote: > >> Hi everybody, >> >> I have poblem with detecting closing of wx.Panel by user. How to detect >> that event? > > Don't know why you want to do that, but you could register with the > enclosing (hosting) widget. In my program

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Peter Decker
On 19 Feb 2007 09:56:06 -0800, Mark Morss <[EMAIL PROTECTED]> wrote: > Good grief. I suppose it is Microsoft to whom we owe the idea that > there could be such a thing as a "GUI based" programming language. Who do we blame for the idea that everyone in the world should be able to express themsel

Re: function & class

2007-02-19 Thread Bjoern Schliessmann
jupiter wrote: > I am getting this error when I am using sql command within > class.function accessing from another class > > how can I create seperate instance for sqlite objects ??? Trying to help you gets boring. I suggest reading the material that's being offered. Regards, Björn --

Re: What is more efficient?

2007-02-19 Thread Karlo Lozovina
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > It doesn't matter whether you have 0 or a million instances, > methods do not occupy more memory. That's what I was looking for! Thanks, to you and all the others. -- ___Ka

Re: Declare a variable global

2007-02-19 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I have the following code: > > colorIndex = 0; > > def test(): > print colorIndex; Don't use ";". It's redundant. > This won't work. But it works if i do this: > > colorIndex = 0; > > def test(): > global colorIndex; > print colorIndex; > > My qu

Re: Declare a variable global

2007-02-19 Thread Peter Otten
[EMAIL PROTECTED] wrote: > On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> wrote: >> >> >Hi, >> >> >I have the following code: >> >> >colorIndex = 0; >> >> >def test(): >> > print colorIndex; >> >>

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Mark Morss
On Feb 16, 4:22 pm, [EMAIL PROTECTED] wrote: > I am VB6 programmer and wants to start new programming language but i > am unable to deciced. > > i have read about Python, Ruby and Visual C++. but i want to go > through with GUI based programming language like VB.net > > so will you please guide me

Re: Declare a variable global

2007-02-19 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Hi, > > I have the following code: > > colorIndex = 0; > > def test(): > print colorIndex; > > This won't work. But it works if i do this: > Yes, it does work. Can you be more explicit about why you think it doesn't? (Also, this is Python not C/C++. Get *RID* o

Raw Imager

2007-02-19 Thread Andrew
Im looking at building a tool for previewing raw images as Thumbnails no editing really just viewing in a simple Tkinter GUI however from what I can tell Pil does not support raw images Does anyone have a link to a module that would allow this I guess I would need support for as many different

Re: Declare a variable global

2007-02-19 Thread [EMAIL PROTECTED]
On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > >Hi, > > >I have the following code: > > >colorIndex = 0; > > >def test(): > > print colorIndex; > > >This won't work. > > Are you sure? > >

Re: timeout in urllib.open()

2007-02-19 Thread Paul Rubin
Stefan Palme <[EMAIL PROTECTED]> writes: > is there a way to modify the time a call of > > urllib.open(...) > > waits for an answer from the other side? Have a tool which > automatically checks a list of websites for certain content. The > tool "hangs" when one of the contacted websites behaves

Re: Declare a variable global

2007-02-19 Thread Jean-Paul Calderone
On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >Hi, > >I have the following code: > >colorIndex = 0; > >def test(): > print colorIndex; > >This won't work. Are you sure? [EMAIL PROTECTED]:~$ cat foo.py colorIndex = 0 def test(): print

Declare a variable global

2007-02-19 Thread [EMAIL PROTECTED]
Hi, I have the following code: colorIndex = 0; def test(): print colorIndex; This won't work. But it works if i do this: colorIndex = 0; def test(): global colorIndex; print colorIndex; My question is why do I have to explicit declaring 'global' for 'colorIndex'? Can't pyth

Re: PyDev on Mac

2007-02-19 Thread Fabio Zadrozny
Pythin runs but PyDev won't use the inerpreter. It gives me an error saying I'm using an invalid interpreter. Is there a way to do this using jPython? Pydev usually outputs something into your error log when it says you've specified an invalid interpreter... can you check it? (see http://pyde

Re: timeout in urllib.open()

2007-02-19 Thread Steve Holden
Stefan Palme wrote: [Peter] I believe this can only be set globally: import socket socket.setdefaulttimeout(seconds) >>> [Stefan] >>> ... >>> But when there is a "default timeout" (as indicated by >>> the method name) - isn't there a "per-socket timeout" >>> too? >> [P

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread Stargaming
[EMAIL PROTECTED] wrote: > Thx > but is there any simpleir way, if using not class, but just struct (or > something like that, MATLAB equivalent for that one)? Use this:: >>> A = type('', (), {}) >>> a = A() >>> a <__main__. object at 0x009E8490> >>> a.foo = 42 >>> a.foo 42 But perhaps usin

Re: Does Python have equivalent to MATLAB "varargin", "varargout", "nargin", "nargout"?

2007-02-19 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Ok, thx > But can I somehow determing how many outputs does caller func require? > for example: > MATLAB: > function [objFunVal firstDerive secondDerive] = simpleObjFun(x) > objFunVal = x^3; > if nargout>1 > firstDerive = 3*x^2; > end > if nargout>2 > secondDerive = 6*x;

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Andy Dingley
On 16 Feb, 21:22, [EMAIL PROTECTED] wrote: > I am VB6 programmer and wants to start new programming language Why? What is causing you to do this, and what do you need to achieve by doing it? > i want to go through with GUI based programming language like VB.net "GUI-based" is fairly unimportant

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Steve Holden
Muntasir Azam Khan wrote: > On Feb 17, 3:22 am, [EMAIL PROTECTED] wrote: >> I am VB6 programmer and wants to start new programming language but i >> am unable to deciced. >> >> i have read about Python, Ruby and Visual C++. but i want to go >> through with GUI based programming language like VB.net

Re: Python Threads

2007-02-19 Thread Sick Monkey
Great, thanks for the tip Gabriel! On 2/18/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Sun, 18 Feb 2007 23:37:02 -0300, Sick Monkey <[EMAIL PROTECTED]> escribió: > Well if this cannot be done, can a thread call a function in the main > method? > I have been trying and have not been suc

Re: search cursor in pythonwin 2.1

2007-02-19 Thread GISDude
On Feb 18, 2:19 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 18 Feb 2007 13:12:20 -0300, GISDude <[EMAIL PROTECTED]> > escribió: > > > I am a GIS(geographic information systems) Analyst and in our > > software(ESRI ARCGIS 9.1) ESRI has implemented Python 2.1 as the > > scripting lan

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Muntasir Azam Khan
On Feb 17, 3:22 am, [EMAIL PROTECTED] wrote: > I am VB6 programmer and wants to start new programming language but i > am unable to deciced. > > i have read about Python, Ruby and Visual C++. but i want to go > through with GUI based programming language like VB.net > > so will you please guide me

Re: PyDev on Mac

2007-02-19 Thread Ahmer
On Feb 18, 12:01 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Ahmer schrieb: > > > > > On Feb 18, 4:50 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> Ahmer schrieb: > > >>> I've been trying to set up PyDev on my new MacBook Pro, but i have not > >>> had an success. > >>> Could you pl

Re: Building Python Pagage for Newer Python Version

2007-02-19 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi, > > I have just downloaded the source for PyXML-0.8.4, which I would like > to build for Python 2.5. How exactly do I go about doing this? python2.5 setup.py install usually does the trick. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I create an array of functions?

2007-02-19 Thread John Machin
On Feb 19, 11:47 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote: > > > Steven W. Orr wrote: > >> I have a table of integers and each time I look up a value from the table > >> I want to call a function using the table entry as an index into an a

Re: How do I create an array of functions?

2007-02-19 Thread Rob Wolfe
Steven D'Aprano wrote: > On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote: > > > > > Steven W. Orr wrote: > >> I have a table of integers and each time I look up a value from the table > >> I want to call a function using the table entry as an index into an array > >> whose values are the diffe

Re: How do I create an array of functions?

2007-02-19 Thread Steven D'Aprano
On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote: > > Steven W. Orr wrote: >> I have a table of integers and each time I look up a value from the table >> I want to call a function using the table entry as an index into an array >> whose values are the different functions. I haven't seen anyt

Re: ANN: java2python 0.2

2007-02-19 Thread Troy Melhase
> Hi Troy. What is the rationale for your project? Hi Kay, I maintain a python port of a java library. It finally got too complicated to do by hand, so I wrote java2python to make my life easier. I wrote more extensively about the library and this tool in my blog: http://blog.melhase.net/artic

Free Url submission, Forum, Free Ebooks, Articles etc

2007-02-19 Thread mona_jamil2000
Free Url submission, Forum, Free Ebooks, Articles etc.. http://www.aonearticles.com -- http://mail.python.org/mailman/listinfo/python-list

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread openopt
Thx but is there any simpleir way, if using not class, but just struct (or something like that, MATLAB equivalent for that one)? I'm thinking of rewriting some optimization solvers (non-smooth, constrained, with (sub)gradients or patterns provided by user) to Python and I don't know currently is it

World Funniest Video

2007-02-19 Thread sidoy
you can find here the World Funniest Video at http://www.supperlaffn.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

ocaml to python

2007-02-19 Thread Gigs_
Is there any way to convert ocaml code to python? but not manually thx -- http://mail.python.org/mailman/listinfo/python-list

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Thx > but is there any simpleir way, if using not class, but just struct (or > something like that, MATLAB equivalent for that one)? > I'm thinking of rewriting some optimization solvers (non-smooth, > constrained, with (sub)gradients or patterns provided by user) to > P

Re: How to test if one dict is subset of another?

2007-02-19 Thread Peter Otten
Jay Tee wrote: > On Feb 19, 11:07 am, Peter Otten <[EMAIL PROTECTED]> wrote: > >> Use a RDBMS (a database), they tend to be good at this kind of >> operations. > > yeah, one of the options is metakit ... sqlite and buzhug both looked > promising but the constraint of pythons 2.2 and 2.3 ruled th

Re: timeout in urllib.open()

2007-02-19 Thread Stefan Palme
>>> [Peter] >>> I believe this can only be set globally: >>> >>> import socket >>> socket.setdefaulttimeout(seconds) >>> >> [Stefan] >> ... >> But when there is a "default timeout" (as indicated by >> the method name) - isn't there a "per-socket timeout" >> too? > > [Peter] > Yes, but it isn't as

Re: Choices: scipy, matplot ...

2007-02-19 Thread sturlamolden
On Feb 19, 11:34 am, "dug" <[EMAIL PROTECTED]> wrote: > I would like to do some real time signal processing with a graphical > display and I would like your advice as to what I should use. I would > like to be able to view the results and to change parameters of some > signal processing in 'real

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread openopt
Thx but is there any simpleir way, if using not class, but just struct (or something like that, MATLAB equivalent for that one)? I'm thinking of rewriting some optimization solvers (non-smooth, constrained, with (sub)gradients or patterns provided by user) to Python and I don't know currently is it

  1   2   >