Re: ActivePython 2.6.1.1 and 3.0.0.0 released!

2008-12-12 Thread M�ta-MCI (MVP)
Hi! M. Hammond said (wrote) said that the work is enormous, because modifications of the C architecture of Python 3 was largely modified. (sorry for my bad english) -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing execution of a method

2008-12-12 Thread boyombo
On Dec 12, 9:09 am, Bruno Desthuilliers wrote: > Emanuele D'Arrigo a écrit : > > > On Dec 11, 7:48 pm, Bruno Desthuilliers > > wrote: > >>> or to provide read-only > >>> access. I.e. right now I'm working on the graphical client which > >>> potentially could be rewritten entirely by the users. It

Re: HGE and Python (again)

2008-12-12 Thread Cro
Good day. Thank you so much for your answer Diez! I managed to call HGE dll the way you told: >>> HGE = windll.LoadLibrary("C:/hge181/hge") >>> HGE.hgeCreate(0x180) But it's not helpful. It would mean that i have to re-create all the header files from "include" directory in python, and all helper

using google search api for python

2008-12-12 Thread Matt
You might want to try this Google Search API for Python. Sample implementation: >>> from Google import Google, search >>> results = search('blackcodeseo.com', 3) >>> for result in results: … print 'Title: %s' % (result.title()) … pri

Re: Python, threading

2008-12-12 Thread Aahz
In article , SMALLp wrote: > >Hy. I have a problem! I'm making multi thread application (client, >server) using wxPython for GUI, and threading.Thread for threding. > >Clients connect and when they are connected (evry thread handles one >connection) threads change main window. > >I neded tip ho

Re: Deeper tracebacks?

2008-12-12 Thread R. Bernstein
"Gabriel Genellina" writes: .. > No, last_traceback is the last *printed* traceback in the interactive > interpreter. Well more precisely the traceback that is passed to sys.excepthook() when an unhandled exception occcurs, since the hook that might not decide to print anything ;-) > Use the t

Re: Bidirectional Networking

2008-12-12 Thread Bryan Olson
Emanuele D'Arrigo wrote: All the examples though are based on a client interrogating a server, with the client initiating the connection, obtaining something and then closing the connection. Basically the server is a reactive party: only if the client get in touch the server respond. Indeed, to

Re: ActivePython 2.6.1.1 and 3.0.0.0 released!

2008-12-12 Thread Kay Schluehr
On 13 Dez., 00:16, Trent Mick wrote: > Note that currently PyWin32 is not included in ActivePython 3.0. Is there any activity in this direction? -- http://mail.python.org/mailman/listinfo/python-list

Re: forcing future re-import from with an imported module

2008-12-12 Thread Gabriel Genellina
En Fri, 12 Dec 2008 19:44:32 -0200, _wolf escribió: On Dec 11, 12:43 am, rdmur...@bitdance.com wrote: "Why can't you have the code that is doing the import [...] call a function [...] to produce [the] side effect [...]? Explicit is better than implicit. A python programmer is going to expec

Re: Py_GetPath() C API in python 3

2008-12-12 Thread Gabriel Genellina
En Fri, 12 Dec 2008 04:50:06 -0200, stalex escribió: I want to build a new, requires total control, python interpreter. So I implement my own version of Py_GetPath(), Py_GetPrefix(), Py_GetExecPrefix() and Py_GetProgramFullPath(). When compiling, I always get error messages, for each API functi

Re: var or inout parm?

2008-12-12 Thread Hrvoje Niksic
sturlamolden writes: > What? Take a look at the code again: > > mytuple[0] += 1 > > should never attempt an __iadd__ on mytuple. > > A sane parser would see this as: > > tmp = mytuple.__getitem__(0) > tmp = tmp.__iadd__(1) > mytuple.__setitem__(0, tmp) # should this always raise an exception? Wh

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Scott David Daniels
feb...@gmail.com wrote: ... elif bank >= 1 and bank <= 24999: rate = 0.0085 > ... Also, (although not useful here as others have pointed out), note that particular code means the same thing as: ... elif 1 <= bank <= 24999: rate = 0.0085 ... --Scott

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-12 Thread David Cournapeau
On Sat, Dec 13, 2008 at 1:30 AM, Nick Craig-Wood wrote: > David Cournapeau wrote: >> On Thu, Dec 11, 2008 at 10:30 PM, Nick Craig-Wood >> wrote: >> > David Cournapeau wrote: >> >> On Wed, Dec 10, 2008 at 12:04 PM, Chris Rebert wrote: >> >> > On Tue, Dec 9, 2008 at 6:49 PM, wrote: >> >> >>

Re: PyQt: Pulling Abstract Item Data from Mime Data using Drag and Drop.

2008-12-12 Thread David Boddie
On Friday 12 December 2008 02:05, Mudcat wrote: > The drag is working up until the point I try to actually retrieve the > data. At that point I get an unhandled Runtime Error saying "no access > to protected functions or signals for objects not created in Python". That's correct, retrieveData() i

Re: __future__ and unrecognised flags

2008-12-12 Thread Terry Reedy
Poor Yorick wrote: I have a future statement in a script I intend to work on 2.6 and 3. Shouldn't __future__ statements basically be noops for versions that already support the feature? doctest is complaining about compiler flags. This illustrates the problem: Python 3.0 (r30:67507, Dec

Re: Bidirectional Networking

2008-12-12 Thread James Mills
Just as a matter of completeness for my own suggestion, here is my implementation of your code (using circuits): cheers James -- import random from circuits import listener, Event, Manager from circuits.lib.sockets import TCPServer, TCPClient class Server(TCPServer):

Re: var or inout parm?

2008-12-12 Thread Steven D'Aprano
On Fri, 12 Dec 2008 08:43:31 -0800, sturlamolden wrote: > On Dec 12, 5:13 pm, Steve Holden wrote: > >> > It should be the tuple's __setitem__ that was invoked here, not >> > __iadd__, or the parser is faulty. >> >> OK, so now you are proposing to alter the parser, and possibly the >> implementat

Re: Removing None objects from a sequence

2008-12-12 Thread Terry Reedy
Tim Chase wrote: If you want to literally remove None objects from a list(or mutable sequence) def deNone(alist): n=len(alist) i=j=0 while i < n: if alist[i] is not None: alist[j] = alist[i] j += 1 i += 1 alist[j:i] = [] blist=[None,1,None,2,None,3,None,

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread bearophileHUGS
Kirk Strauser: > def get_rate(balance): >for threshold, rate in ((10, .0173), >(5, .0149), >(25000, .0124), >(1, .0085), >(0, .006)): >if balance > threshold: >

Re: Removing None objects from a sequence

2008-12-12 Thread Erik Max Francis
Filip Gruszczyński wrote: I don't mean memory, but space in code ;-) Your goal should be clarity of code, not saving keystrokes. Writing something that is compact in terms of the amount of code to write does not mean its function is clear or even that it is more efficient to run, for that

Re: os.lstat : proper way to do this

2008-12-12 Thread MRAB
m1k...@gmail.com wrote: I'm converting from Perl to Python, so I'm learning the basics - please be gentle! :) In Perl, I can lstat($file) whether $file exists or not: lstat($file); unless (-e _) { print STDERR "$file: No such file or directory\n"; } unless (-l _) { print STDERR "$file: N

Re: os.lstat : proper way to do this

2008-12-12 Thread Benjamin Kaplan
On Fri, Dec 12, 2008 at 6:06 PM, wrote: > I'm converting from Perl to Python, so I'm learning the basics - > please be gentle! :) > > In Perl, I can lstat($file) whether $file exists or not: > lstat($file); > unless (-e _) { >print STDERR "$file: No such file or directory\n"; > } > unless (-l

Re: var or inout parm?

2008-12-12 Thread Chris Rebert
On Fri, Dec 12, 2008 at 4:56 AM, sturlamolden wrote: > On Dec 12, 1:44 pm, "Chris Rebert" wrote: > >> Python begs to differ, as those two statements are both semantically >> identical in this case: > > That is because integers are immutable. When x += 1 is done on an int, > there will be a rebind

ActivePython 2.6.1.1 and 3.0.0.0 released!

2008-12-12 Thread Trent Mick
I'm happy to announce that ActivePython 2.6.1.1 and ActivePython 3.0.0.0 are now available. Details and download links for 2.6 here: http://www.activestate.com/Products/activepython/feature_list.mhtml Details and download links for 3.0 here: http://www.activestate.com/Products/activepython/

os.lstat : proper way to do this

2008-12-12 Thread m1k3b0
I'm converting from Perl to Python, so I'm learning the basics - please be gentle! :) In Perl, I can lstat($file) whether $file exists or not: lstat($file); unless (-e _) { print STDERR "$file: No such file or directory\n"; } unless (-l _) { print STDERR "$file: Not a symbolic link\n"; }

Re: Removing None objects from a sequence

2008-12-12 Thread Steven D'Aprano
On Fri, 12 Dec 2008 21:18:36 +, Lie Ryan wrote: > On Fri, 12 Dec 2008 11:50:38 -0500, Steve Holden wrote: > >> Kirk Strauser wrote: >>> At 2008-12-12T15:51:15Z, Marco Mariani writes: >>> Filip Gruszczyński wrote: > I am not doing it, because I need it. I can as well use "if no

Re: concept of creating structures in python

2008-12-12 Thread Steven D'Aprano
On Fri, 12 Dec 2008 09:07:21 -0700, Joe Strout wrote: >> Joe missed a piece out here. If you change the signature of your >> D.__init__() to read >> >> def __init__(self, dataName='ND', index = 0, ele_obj=None): >> >> then you need to insert the following code at the top of the method: >> >>

Re: Removing None objects from a sequence

2008-12-12 Thread Steven D'Aprano
On Fri, 12 Dec 2008 10:08:23 -0600, Kirk Strauser wrote: > At 2008-12-12T15:51:15Z, Marco Mariani writes: > >> Filip Gruszczyński wrote: >> >>> I am not doing it, because I need it. I can as well use "if not elem >>> is None", > >> I suggest "if elem is not None", which is not quite the same. >

Re: Removing None objects from a sequence

2008-12-12 Thread Tim Chase
If you want to literally remove None objects from a list(or mutable sequence) def deNone(alist): n=len(alist) i=j=0 while i < n: if alist[i] is not None: alist[j] = alist[i] j += 1 i += 1 alist[j:i] = [] blist=[None,1,None,2,None,3,None,None,4,None] deNon

Re: Removing None objects from a sequence

2008-12-12 Thread Terry Reedy
If you want to literally remove None objects from a list(or mutable sequence) def deNone(alist): n=len(alist) i=j=0 while i < n: if alist[i] is not None: alist[j] = alist[i] j += 1 i += 1 alist[j:i] = [] blist=[None,1,None,2,None,3,None,None,4,None] deNone(blist)

__future__ and unrecognised flags

2008-12-12 Thread Poor Yorick
I have a future statement in a script I intend to work on 2.6 and 3. Shouldn't __future__ statements basically be noops for versions that already support the feature? doctest is complaining about compiler flags. This illustrates the problem: Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [

Re: Interface & Implementation

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 16:07:26 +0530, J Ramesh Kumar wrote: > Hi, > > I am new to python. I require some help on implementing interface and > its implementation. I could not find any sample code in the web. Can you > please send me some sample code which is similar to the below java code > ? Thanks

Re: forcing future re-import from with an imported module

2008-12-12 Thread _wolf
On Dec 11, 12:43 am, rdmur...@bitdance.com wrote: > "Why can't you have the code that is doing the import [...] > call a function [...] to produce [the] side effect [...]? > Explicit is better than implicit. A python programmer is > going to expect that importing a module is idempotent" you’re co

Re: Mathematica 7 compares to other languages

2008-12-12 Thread Bakul Shah
George Neuner wrote: On Thu, 11 Dec 2008 10:41:59 -0800 (PST), Xah Lee wrote: On Dec 10, 2:47 pm, John W Kennedy wrote: Xah Lee wrote: In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java, you'll have 50 or hundreds lines. C: #include #include void normal(int dim, float

Re: Removing None objects from a sequence

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 11:50:38 -0500, Steve Holden wrote: > Kirk Strauser wrote: >> At 2008-12-12T15:51:15Z, Marco Mariani writes: >> >>> Filip Gruszczyński wrote: >>> I am not doing it, because I need it. I can as well use "if not elem is None", >> >>> I suggest "if elem is not None",

Re: Testing against different versions of Python

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 14:42:24 -0500, mercado wrote: > What is the best way to go about testing against different versions of > Python? For example, I have 2.5.2 installed on my machine (Ubuntu Hardy > 8.04), and I want to test a script against 2.5.2 and 2.5.1 (and possibly > other versions as well

Re: Bidirectional Networking

2008-12-12 Thread Gabriel Genellina
En Fri, 12 Dec 2008 15:22:34 -0200, Emanuele D'Arrigo escribió: Thank you both for the suggestions! Eventually I tried with threading as illustrated in the code below. And it works pretty well! The only problem I'm having with it is that as the server is a daemon the program should end when t

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 09:50:43 -0800, Dennis Lee Bieber wrote: > On Fri, 12 Dec 2008 03:42:55 -0800 (PST), feb...@gmail.com declaimed the > following in comp.lang.python: > >> #!/usr/bin/python >> #Py3k, UTF-8 >> >> bank = int(input("How much money is in your account?\n>>")) target = >> int(input(

Re: Umlauts in idle

2008-12-12 Thread Benjamin Kaplan
On Fri, Dec 12, 2008 at 3:51 PM, a_olme wrote: > Hello all, > > When I try to use umlauts in idle it will only print out as Unicode > escape characters. Is it possible to configure idle to print them as > ordinary characters? > Best Regards Anders Olme Make sure you are using Unicode strings

Umlauts in idle

2008-12-12 Thread a_olme
Hello all, When I try to use umlauts in idle it will only print out as Unicode escape characters. Is it possible to configure idle to print them as ordinary characters? Best Regards Anders Olme -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing against different versions of Python

2008-12-12 Thread Benjamin Kaplan
On Fri, Dec 12, 2008 at 2:42 PM, mercado wrote: > What is the best way to go about testing against different versions of > Python? For example, I have 2.5.2 installed on my machine (Ubuntu Hardy > 8.04), and I want to test a script against 2.5.2 and 2.5.1 (and possibly > other versions as well).

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 04:58:36 -0800, feba wrote: > Actually, I have gedit set to four spaces per tab. I have no reason why > it's showing up that large on copy/paste, but the file itself is fine. You've set gedit to _show tabs_ as four spaces, but not to substitute tabs with four spaces. Go to g

No Scams plz! Read only if you are interested to work from home.

2008-12-12 Thread suppertra...@gmail.com
Lowest air fares, tickets, packages, all inclusive, lower than any other agencies, we beat other prices: http://suppertravel.worldventures.com/ Become a travel agent and work from home make , we even pay for your car payment and mortgage: http://suppertravel.worldventures.biz/ -- http://m

Re: Python is slow

2008-12-12 Thread Bruno Desthuilliers
sturlamolden a écrit : (snip) Creating a fast implementation of a dynamic language is almost rocket science. But it has been done. There is Stronghold, the fastest version of Smalltalk known to man, on which the Sun Java VM is based. On a recent benchmark Java 6 -server beats C compiled by GCC 4

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Bruno Desthuilliers
Tim Rowe a écrit : 2008/12/12 Kirk Strauser : def get_rate(balance): for threshold, rate in ((10, .0173), (5, .0149), (25000, .0124), (1, .0085), (0, .006)): if bala

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread John Machin
On Dec 13, 6:49 am, "Tim Rowe" wrote: > 2008/12/12 John Machin : > > > (4) in practice, the "default" action would not be "return 0.0"; > > perhaps something along these lines: > > > if balance < -overdraft_limit: > >   raise Exception(...) > > That's more likely to be in the withdrawal routine

Re: newbie question...

2008-12-12 Thread Tim Rowe
2008/12/12 : > ah, ok. now what if I want the variable to be an integer that I > send? for instance if I send 99 to the program, it is picking it up > as a string instead of an integer value. How do I handle this with > python?? As 'r' has said, you can cast it to integer. In the real world y

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Kirk Strauser
At 2008-12-12T19:20:52Z, John Machin writes: > (1) you meant "if balance > threshold:" balance >= threshold. We both mistyped. :-) > (2) sequential search can be very fast if the sequence is in > descending order of probability of occurence ... you might like to > consider reversing the order

Re: newbie question: if var1 == var2:

2008-12-12 Thread Ethan Furman
Andrew Robert wrote: Two issues regarding script. You have a typo on the file you are trying to open. It is listed with a file extension of .in when it should be .ini . Pardon? The OPs original post used .in both in the python code and the command line. Doesn't look like a typo to me. Ou

Re: Mathematica 7 compares to other languages

2008-12-12 Thread George Neuner
On Mon, 8 Dec 2008 15:14:18 -0800 (PST), Xah Lee wrote: >Dear George Neuner, > >Xah Lee wrote: >> >For example, >> >the level or power of lang can be roughly order as >> >this: >> >> >assembly langs >> >C, pascal >> >C++, java, c# >> >unix shells >> >perl, python, ruby, php >> >lisp >> >Mathemati

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Tim Rowe
2008/12/12 John Machin : > (2) sequential search can be very fast if the sequence is in > descending order of probability of occurence ... you might like to > consider reversing the order I find it hard to imagine a bank with so many interest rate thresholds that the search of the table is likely

Testing against different versions of Python

2008-12-12 Thread mercado
What is the best way to go about testing against different versions of Python? For example, I have 2.5.2 installed on my machine (Ubuntu Hardy 8.04), and I want to test a script against 2.5.2 and 2.5.1 (and possibly other versions as well). Thanks in advance. -- http://mail.python.org/mailman/lis

Re: newbie question...

2008-12-12 Thread r
i was just giving you an example from my TextEditor.py script. this is how arg works lets say you have a script named MyScript.py --- import sys print sys.argv --- call the script with arguments > MyScript.py 99 100 ['C:\\Python25\\MyScript.py', '99', '100'] int(sys.argv[1]) -> 99 -- http://mail

Re: Removing None objects from a sequence

2008-12-12 Thread Arnaud Delobelle
alex23 writes: > Rather than a list comprehension, use a generator expression: > > for item in (x for x in sequence if x is not None): >do_something(x) I much prefer for item in sequence: if x is not None: do_something(x) -- Arnaud -- http://mail.python.org/mailman/listinfo/py

Re: var or inout parm?

2008-12-12 Thread Arnaud Delobelle
Marc 'BlackJack' Rintsch writes: > On Fri, 12 Dec 2008 07:56:58 -0800, sturlamolden wrote: > >> On Dec 12, 4:55 pm, sturlamolden wrote: >> >>> def __setitem__(self, index, value): >>>if _buf[index] is not value: # given that _buf is the tuple's >>> internal buffer >>> raise TypeError,

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread John Machin
On Dec 13, 5:18 am, Kirk Strauser wrote: > At 2008-12-12T18:12:39Z, "Tim Rowe" writes: > > > > > Is there a tidy way of making rates and thresholds local to get_rate, > > without recalculating each time? I suppose going object oriented is > > the proper way. > > > #Py3k,UTF-8 > > > rates = {0: 0.

Re: [wxpython-users] Dabo 0.9.0 Released

2008-12-12 Thread Peter Decker
On Wed, Dec 10, 2008 at 1:24 PM, Ed Leafe wrote: > We are proud (and relieved!) to finally release Dabo 0.9.0, the first > official release of the framework in six months. We haven't been taking it > easy during that period; rather, we made some changes that clean up some > weak spots in the codeb

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Tim Rowe
2008/12/12 Kirk Strauser : > def get_rate(balance): >for threshold, rate in ((10, .0173), >(5, .0149), >(25000, .0124), >(1, .0085), >(0, .006)): >if balance > th

Re: Python extension: callbacks blocked when holding button down

2008-12-12 Thread skip
alan> I'm developing a Python extension. It's a wrapper for some alan> firmware, and simulates the target hardware environment. I'm using alan> wxPython. I pass a function to the extension so it can let Python alan> know about certain events. The code is currently single threaded.

Re: newbie question...

2008-12-12 Thread trfilmographer
On Dec 12, 12:59 pm, r wrote: > yes, but your script will need to know hoe to handle this.the > following will open a file who's name was passed to the script > > if len(sys.argv) > 1: >     try: >         open_file(fname=sys.argv[1]) >     except: >         pass ah, ok. now what if I want the

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread John Machin
On Dec 13, 4:50 am, Dennis Lee Bieber wrote: > On Fri, 12 Dec 2008 03:42:55 -0800 (PST), feb...@gmail.com declaimed the > following in comp.lang.python: > > > #!/usr/bin/python > > #Py3k, UTF-8 > > > bank = int(input("How much money is in your account?\n>>")) > > target = int(input("How much money

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Kirk Strauser
At 2008-12-12T18:12:39Z, "Tim Rowe" writes: > Is there a tidy way of making rates and thresholds local to get_rate, > without recalculating each time? I suppose going object oriented is > the proper way. > > #Py3k,UTF-8 > > rates = {0: 0.006, 1: 0.0085, 25000: 0.0124, 5: 0.0149, 10:

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread MRAB
Tim Rowe wrote: Since we all seem to be having a go, here's my take. By pulling the rates and thresholds into a dictionary I feel I'm getting a step closer to the real world, where these would presumably be pulled in from a database and the number of interest bands might vary. But is there a tidi

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Tim Rowe
Since we all seem to be having a go, here's my take. By pulling the rates and thresholds into a dictionary I feel I'm getting a step closer to the real world, where these would presumably be pulled in from a database and the number of interest bands might vary. But is there a tidier way to get 'thr

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Benjamin Kaplan
On Fri, Dec 12, 2008 at 12:50 PM, Dennis Lee Bieber wrote: > On Fri, 12 Dec 2008 03:42:55 -0800 (PST), feb...@gmail.com declaimed the > following in comp.lang.python: > > > #!/usr/bin/python > > #Py3k, UTF-8 > > > > bank = int(input("How much money is in your account?\n>>")) > > target = int(input

Re: newbie question...

2008-12-12 Thread r
yes, but your script will need to know hoe to handle this.the following will open a file who's name was passed to the script if len(sys.argv) > 1: try: open_file(fname=sys.argv[1]) except: pass -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question...

2008-12-12 Thread Tim Chase
Im new at python and I just want to know if (and how) it is possible to send parameters to a program. what I mean is that when we start python I can call a file that should be run like this: python myfile.py can I send additional parameters along with it? like::: python myfile.py myVar1 myVar2

newbie question...

2008-12-12 Thread trfilmographer
Hi! Im new at python and I just want to know if (and how) it is possible to send parameters to a program. what I mean is that when we start python I can call a file that should be run like this: python myfile.py can I send additional parameters along with it? like::: python myfile.py myVar1 myVa

Re: Python is slow

2008-12-12 Thread Andreas Kostyrka
On Fri, Dec 12, 2008 at 06:17:43AM -0800, sturlamolden wrote: > None of those projects addresses inefficacies in the CPython > interpreter, except for psyco - which died of an overdose PyPy. Bullshit. All that discussion about performance forgets that performance is a function of the whole system

Re: Mathematica 7 compares to other languages

2008-12-12 Thread George Neuner
On Thu, 11 Dec 2008 10:41:59 -0800 (PST), Xah Lee wrote: >On Dec 10, 2:47 pm, John W Kennedy wrote: >> Xah Lee wrote: >> > In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java, >> > you'll have 50 or hundreds lines. >> >> C: >> >> #include >> #include >> >> void normal(int dim,

Re: Python is slow

2008-12-12 Thread Luis M . González
On Dec 12, 11:17 am, sturlamolden wrote: > On Dec 12, 3:04 pm, Luis M. González wrote: > > > Why don't you guys google a little bit to know what's being done to > > address python's "slowness"?? > > Nothing is being done, and woth Py3k it got even worse. > > > It has been mentioned in this thread

Re: Bidirectional Networking

2008-12-12 Thread Emanuele D'Arrigo
Thank you both for the suggestions! Eventually I tried with threading as illustrated in the code below. And it works pretty well! The only problem I'm having with it is that as the server is a daemon the program should end when the client thread cease to be alive. But it doesn't seem to work that w

Re: Mathematica 7 compares to other languages

2008-12-12 Thread George Neuner
On Wed, 10 Dec 2008 21:37:34 + (UTC), Kaz Kylheku wrote: >Now try writing a device driver for your wireless LAN adapter in Mathematica. Notice how Xah chose not to respond to this. George -- http://mail.python.org/mailman/listinfo/python-list

Python extension: callbacks blocked when holding button down

2008-12-12 Thread alan . chambers
I'm developing a Python extension. It's a wrapper for some firmware, and simulates the target hardware environment. I'm using wxPython. I pass a function to the extension so it can let Python know about certain events. The code is currently single threaded. My problem is that the callback seems to

Re: concept of creating structures in python

2008-12-12 Thread Steve Holden
Joe Strout wrote: > On Dec 12, 2008, at 9:00 AM, Steve Holden wrote: > >>> Change the default value of ds_obj here to None. Otherwise, you will >>> certainly confuse yourself (there would be just one default object >>> shared among all instances). >>> >> Joe missed a piece out here. If you change

Re: var or inout parm?

2008-12-12 Thread sturlamolden
On Dec 12, 5:13 pm, Steve Holden wrote: > OK, so now you are proposing to alter the parser, and possibly the > implementation of the INPLACE_ADD opcode in eval.c, so can you give us > the patch for those, please? That is not where the problem resides. -- http://mail.python.org/mailman/listinfo/

Re: var or inout parm?

2008-12-12 Thread Steve Holden
sturlamolden wrote: > On Dec 12, 5:13 pm, Steve Holden wrote: > >>> It should be the tuple's __setitem__ that was invoked here, not >>> __iadd__, or the parser is faulty. >> OK, so now you are proposing to alter the parser, and possibly the >> implementation of the INPLACE_ADD opcode in eval.c, s

Re: Removing None objects from a sequence

2008-12-12 Thread Steve Holden
Kirk Strauser wrote: > At 2008-12-12T15:51:15Z, Marco Mariani writes: > >> Filip Gruszczyński wrote: >> >>> I am not doing it, because I need it. I can as well use "if not elem >>> is None", > >> I suggest "if elem is not None", which is not quite the same. > > So what's the difference exactly?

Re: newbie question: if var1 == var2:

2008-12-12 Thread MRAB
Kirk Strauser wrote: At 2008-12-12T15:35:11Z, "J. Cliff Dyer" writes: Python has a version equally good: def chomp(s): return s.rstrip('\r\n') You'll hardly miss Perl at all. ;) I haven't missed Perl in years! I just wish there was a basestring.stripeol method because I seem to end up

Re: Removing None objects from a sequence

2008-12-12 Thread MRAB
Kirk Strauser wrote: At 2008-12-12T15:51:15Z, Marco Mariani writes: Filip Gruszczyński wrote: I am not doing it, because I need it. I can as well use "if not elem is None", I suggest "if elem is not None", which is not quite the same. So what's the difference exactly? "foo is not None"

Re: var or inout parm?

2008-12-12 Thread sturlamolden
On Dec 12, 5:13 pm, Steve Holden wrote: > > It should be the tuple's __setitem__ that was invoked here, not > > __iadd__, or the parser is faulty. > > OK, so now you are proposing to alter the parser, and possibly the > implementation of the INPLACE_ADD opcode in eval.c, so can you give us > the

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-12 Thread Nick Craig-Wood
David Cournapeau wrote: > On Thu, Dec 11, 2008 at 10:30 PM, Nick Craig-Wood > wrote: > > David Cournapeau wrote: > >> On Wed, Dec 10, 2008 at 12:04 PM, Chris Rebert wrote: > >> > On Tue, Dec 9, 2008 at 6:49 PM, wrote: > >> >> On Ubuntu, I accidentally manually installed setuptools > >> >>

Re: var or inout parm?

2008-12-12 Thread Marc 'BlackJack' Rintsch
On Fri, 12 Dec 2008 07:56:58 -0800, sturlamolden wrote: > On Dec 12, 4:55 pm, sturlamolden wrote: > >> def __setitem__(self, index, value): >>if _buf[index] is not value: # given that _buf is the tuple's >> internal buffer >> raise TypeError, 'tuple' object does not support item >> ass

Re: Removing None objects from a sequence

2008-12-12 Thread Marco Mariani
Kirk Strauser wrote: So what's the difference exactly? "foo is not None" is actually surprising to me, since "not None" is True. "0 is True" is False, but "0 is not None" is True. Why is that? Cause I was tired of course, and got the not precedente not right!! Argh -- http://mail.python.org

Re: Reading online zip files - zipfile and zlib, wbits

2008-12-12 Thread Brendan
On Dec 12, 11:36 am, Brendan wrote: > On Dec 12, 10:46 am, Brendan wrote: > > > > > > > On Dec 12, 10:25 am, Brendan wrote: > > > > I am fooling around with accessing contents of zip files online. I > > > download the tail end of the zip and use zipfile to get the zip > > > central directory str

Re: Removing None objects from a sequence

2008-12-12 Thread Kirk Strauser
At 2008-12-12T15:51:15Z, Marco Mariani writes: > Filip Gruszczyński wrote: > >> I am not doing it, because I need it. I can as well use "if not elem >> is None", > I suggest "if elem is not None", which is not quite the same. So what's the difference exactly? "foo is not None" is actually surp

Re: Removing None objects from a sequence

2008-12-12 Thread Marc 'BlackJack' Rintsch
On Fri, 12 Dec 2008 16:51:15 +0100, Marco Mariani wrote: > Filip Gruszczyński wrote: > > >> I am not doing it, because I need it. I can as well use "if not elem is >> None", > > I suggest "if elem is not None", which is not quite the same. In which way is it not the same? Has the same behavio

Re: var or inout parm?

2008-12-12 Thread Steve Holden
sturlamolden wrote: > On Dec 12, 3:54 pm, Steve Holden wrote: [...] >> The interpreter "should not" have a GIL. > >> The tuple "should" check that >> it is actually being mutated. How? > > In Python it would be something similar to: > > def __setitem__(self, index, value): >if _buf[index] i

Re: concept of creating structures in python

2008-12-12 Thread Joe Strout
On Dec 12, 2008, at 9:00 AM, Steve Holden wrote: Change the default value of ds_obj here to None. Otherwise, you will certainly confuse yourself (there would be just one default object shared among all instances). Joe missed a piece out here. If you change the signature of your D.__init__() t

Re: newbie question: if var1 == var2:

2008-12-12 Thread Kirk Strauser
At 2008-12-12T15:35:11Z, "J. Cliff Dyer" writes: > Python has a version equally good: > > def chomp(s): > return s.rstrip('\r\n') > > You'll hardly miss Perl at all. ;) I haven't missed Perl in years! I just wish there was a basestring.stripeol method because I seem to end up writing the in

Re: concept of creating structures in python

2008-12-12 Thread Steve Holden
Joe Strout wrote: > On Dec 11, 2008, at 10:52 PM, navneet khanna wrote: > >> I want to create a structure within a structure i.e. nested structures >> in python. >> I tried with everything but its not working. >> my code is like this: >> >> class L(Structure): >> >> def __init__(self,Name='ND'

Re: var or inout parm?

2008-12-12 Thread sturlamolden
On Dec 12, 4:55 pm, sturlamolden wrote: > def __setitem__(self, index, value): >if _buf[index] is not value: # given that _buf is the tuple's > internal buffer > raise TypeError, 'tuple' object does not support item > assignment blæh, that should be self._buf[index] -- http://mail.

Re: var or inout parm?

2008-12-12 Thread sturlamolden
On Dec 12, 3:54 pm, Steve Holden wrote: > sturlamolden wrote: > > On Dec 12, 3:08 pm, Marc 'BlackJack' Rintsch wrote: > > >> No bug because a mutation *is* attempted. ``a += x`` calls `a.__iadd__` > >> which *always* returns the result which is *always* rebound to the name > >> `a`. Even with m

Re: Python is slow

2008-12-12 Thread Christian Heimes
sturlamolden schrieb: > On Dec 12, 3:04 pm, Luis M. González wrote: > >> Why don't you guys google a little bit to know what's being done to >> address python's "slowness"?? > > Nothing is being done, and woth Py3k it got even worse. Indeed, it *is* slower for now. As I already said in another

Re: Removing None objects from a sequence

2008-12-12 Thread Marco Mariani
Filip Gruszczyński wrote: I am not doing it, because I need it. I can as well use "if not elem is None", I suggest "if elem is not None", which is not quite the same. If you slip such an error in a post, I suggest to practice some time writing correct code before having one-liner contests w

Re: Mathematica 7 compares to other languages

2008-12-12 Thread Tom McGlynn
On Dec 11, 6:46 am, "William James" wrote: > John W Kennedy wrote: > > Xah Lee wrote: > > > In lisp, python, perl, etc, you'll have 10 or so lines. In C or > > > Java, you'll have 50 or hundreds lines. > > > Java: > > > static float[] normal(final float[] x) { > >float sum = 0.0f; > >for (

Re: Reading online zip files - zipfile and zlib, wbits

2008-12-12 Thread Brendan
On Dec 12, 10:46 am, Brendan wrote: > On Dec 12, 10:25 am, Brendan wrote: > > > I am fooling around with accessing contents of zip files online. I > > download the tail end of the zip and use zipfile to get the zip > > central directory structure. I download the section of the zip file I > > need

Re: concept of creating structures in python

2008-12-12 Thread Joe Strout
On Dec 11, 2008, at 10:52 PM, navneet khanna wrote: I want to create a structure within a structure i.e. nested structures in python. I tried with everything but its not working. my code is like this: class L(Structure): def __init__(self,Name='ND',Addr=0,ds_obj = D()): Change the defa

Re: newbie question: if var1 == var2:

2008-12-12 Thread J. Cliff Dyer
On Thu, 2008-12-11 at 13:44 -0600, Kirk Strauser wrote: > At 2008-12-11T17:24:44Z, rdmur...@bitdance.com writes: > > > >>> ' ab c \r\n'.rstrip('\r\n') > > ' ab c ' > > >>> ' ab c \n'.rstrip('\r\n') > > ' ab c ' > > >>> ' ab c '.rstrip('\r\n') > > ' ab c ' > >

Re: Removing None objects from a sequence

2008-12-12 Thread Vito De Tullio
Filip Gruszczyński wrote: > I checked itertools, but the only thing that > seemed ok, was ifilter - this requires seperate function though, so > doesn't seem too short. is this too much long? >>> from itertools import ifilter >>> for element in ifilter(lambda x: x is not None, [0,1,2,None,3,Non

  1   2   >