Re: dictionary of dictionaries

2007-12-10 Thread Peter Otten
kettle wrote: On Dec 9, 5:49 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sun, 09 Dec 2007 00:35:18 -0800, kettle wrote: Hi, I'm wondering what the best practice is for creating an extensible dictionary-of-dictionaries in python? In perl I would just do something like:

Re: a strange SyntaxError

2007-12-10 Thread Peter Otten
John Machin wrote: As viewed with Google Groups, lines 40/41, 63/69, and 89 are indented 8 spaces more than they should be. When I save your file and try to run it, I get this: C:\junkcoolgenie.py File C:\junk\coolgenie.py, line 40 self.w = 520 ^ IndentationError: unexpected

Re: Distinguishing attributes and methods

2007-12-10 Thread Bruno Desthuilliers
MonkeeSage a écrit : On Dec 8, 4:11 pm, Bruno Desthuilliers (snip) I think it muddies the water to say that a.a() and a.a are the same thing--obviously they are not. Indeed. a.a yields the object bound to name 'a' in object a, while a.a() yields the value returned by calling the object bound

Importing functions that require parameters

2007-12-10 Thread Matt_D
Good afternoon. As a self-tutoring project I am writing a one-time-pad encrypt/decrypt script. I have completed the encryption portion and am working currently on the decryption algorithm. My goal is to have the encrypt and decrypt be individual modules vice two parts of the same. My problem, or

Re: My very first python web app (no framework)

2007-12-10 Thread A.T.Hofkamp
On 2007-12-10, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 9 Dic, 15:43, [EMAIL PROTECTED] wrote: Is it the right way to go? Is it safe in a web production environment ? Is it thread-friendly (since flup is threaded) ? tnx Any hint ? If you as author are asking, my bet is on no for

Re: Is a real C-Python possible?

2007-12-10 Thread Bruno Desthuilliers
Jack a écrit : I understand that the standard Python distribution is considered the C-Python. Howerver, the current C-Python is really a combination of C and Python implementation. There are about 2000 Python files included in the Windows version of Python distribution. I'm not sure how much

Re: Newbie edit/compile/run cycle question

2007-12-10 Thread Simon Forman
On Dec 8, 6:45 pm, Jeremy C B Nicoll [EMAIL PROTECTED] wrote: Steve Howell [EMAIL PROTECTED] wrote: --- Jeremy C B Nicoll [EMAIL PROTECTED] wrote: What command (in XP) does one need to issue to syntaxcheck a saved python script without running it? Perhaps oversimplifying a bit,

Re: Best way to protect my new commercial software.

2007-12-10 Thread farsheed
So you say there is not any trusted way? -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing functions that require parameters

2007-12-10 Thread Chris
On Dec 10, 12:41 pm, Matt_D [EMAIL PROTECTED] wrote: Good afternoon. As a self-tutoring project I am writing a one-time-pad encrypt/decrypt script. I have completed the encryption portion and am working currently on the decryption algorithm. My goal is to have the encrypt and decrypt be

Re: Best way to protect my new commercial software.

2007-12-10 Thread Paul Boddie
On Dec 10, 9:55 am, farsheed [EMAIL PROTECTED] wrote: Thanks. But I ask this question technically, I mean I know nothing is uncrackable and popular softwares are not well protected. But my software is not that type and I don't want this specific software popular. Understood. It is some kind

Re: Best way to protect my new commercial software.

2007-12-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Dec 2007 00:55:13 -0800, farsheed wrote: Thanks. But I ask this question technically, I mean I know nothing is uncrackable and popular softwares are not well protected. But my software is not that type and I don't want this specific software popular. Then make it as ugly and

Re: Best way to protect my new commercial software.

2007-12-10 Thread Tim Chase
So you say there is not any trusted way? You cannot distribute any program with the expectation that it cannot be reverse engineered. Despite what various protection companies would have folks believe. At some point, the user's CPU has to execute the code, and at that point, it can be

Re: __iadd__ useless in sub-classed int

2007-12-10 Thread A.T.Hofkamp
On 2007-12-06, samwyse [EMAIL PROTECTED] wrote: On Dec 6, 1:12 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: And that's my complaint. The value in zed is being replaced by something almost, but not quite, identical to the original value. Python's internal implementation of __iadd__ for int

Re: Importing functions that require parameters

2007-12-10 Thread John Machin
On Dec 10, 9:41 pm, Matt_D [EMAIL PROTECTED] wrote: Good afternoon. As a self-tutoring project I am writing a one-time-pad encrypt/decrypt script. I have completed the encryption portion and am working currently on the decryption algorithm. My goal is to have the encrypt and decrypt be

Re: Is a real C-Python possible?

2007-12-10 Thread Paul Boddie
On Dec 9, 10:43 pm, Jack [EMAIL PROTECTED] wrote: http://blog.snaplogic.org/?p=55 There's some choice nonsense here, albeit on a different topic: Coding for wxwidgets, using a QT or GTK bridge, or using TCL/TK is hardly an optimal solution when writing complex graphical applications, and Java

Re: Distinguishing attributes and methods

2007-12-10 Thread MonkeeSage
It seems that I've got a short-circuit somewhere here. I understand that everything is an object and the the storage/lookup system is object-agnostic, and that it is only the descriptors (or tags as I called them generically) that determine how an attribute is bound, whether it is bound at all,

Re: Best way to protect my new commercial software.

2007-12-10 Thread Carl Banks
On Dec 10, 6:26 am, Tim Chase [EMAIL PROTECTED] wrote: So you say there is not any trusted way? You cannot distribute any program with the expectation that it cannot be reverse engineered. [snip] From the OP's post, it seemed likely to me that the OP was asked by a misguided management to

Re: Best way to protect my new commercial software.

2007-12-10 Thread BlueBird
On Dec 10, 8:15 am, farsheed [EMAIL PROTECTED] wrote: I wrote a software and I want to protect it so can not be cracked easily. I wrote it in python and compile it using py2exe. what is the best way in your opinion? I used SoftwarePassport ( http://www.siliconrealms.com/ ) for exactly this. I

Re: Equivalent of perl's Pod::Usage?

2007-12-10 Thread Adam Funk
On 2007-12-08, Neil Cerutti wrote: On 2007-12-08, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Fri, 7 Dec 2007 20:12:21 +, Adam Funk [EMAIL PROTECTED] declaimed the following in comp.lang.python: I'm using to using Pod::Usage in my Perl programs (a snipped example is shown below, if

Re: Equivalent of perl's Pod::Usage?

2007-12-10 Thread Adam Funk
On 2007-12-08, Dennis Lee Bieber wrote: On Fri, 7 Dec 2007 20:12:21 +, Adam Funk [EMAIL PROTECTED] declaimed the following in comp.lang.python: I'm using to using Pod::Usage in my Perl programs (a snipped example is shown below, if you're interested) to generate a little man page when

Re: Best way to protect my new commercial software.

2007-12-10 Thread Tim Chase
So, are there any ways to make it harder to reverse engineer a program? In addition to the standby of -Don't distribute your program (SaaS) I'll add to the list: -Only distribute your program to people too non-technical to consider reverse-engineering -Don't document your program (or even

Error when executing the library reference echo server example

2007-12-10 Thread diego . martin . a
Hi. Python newbie speaking, I've copy/pasted the example of the echo server that comes in the IDLE documentation (Python Library Reference section 17.2.3) to see how the sockets work. The only change I've made is in the host address which I've set to 'localhost' in the client. You can see the

Re: how to convert 3 byte to float

2007-12-10 Thread Mario M. Mueller
[EMAIL PROTECTED] wrote: [...] But I'm experiencing some strange jumps in the data (seismic data is mostly quite smooth at 40 Hz sampling rate). I think I did some mistake in the byte order... Probably. In your code sample, when you pad it to 32-bits, why are you inserting every third byte,

Re: how to convert 3 byte to float

2007-12-10 Thread Mario M. Mueller
Hendrik van Rooyen wrote: Mario M. Mueller [EMAIL PROTECTED] wrote: I uploaded a short sample data file under http://www.FastShare.org/download/test.bin - maybe one can give me another hint... In a full data example max value is 1179760 (in case one looks only at the eye-cathing 65535+-

GUI development with 3D view

2007-12-10 Thread Achim Domma
Hi, I'm looking for quite some time now for a gui library for python, which allows me to display 3D graphics. Main OS is windows, Mac OS X and Linux would be nice to have. I want to use python 2.5. My first try was wx + pyOpenGL but there are no working binaries for python 2.5. I simply have to

Re: Error when executing the library reference echo server example

2007-12-10 Thread Chris
On Dec 10, 2:16 pm, [EMAIL PROTECTED] wrote: Hi. Python newbie speaking, I've copy/pasted the example of the echo server that comes in the IDLE documentation (Python Library Reference section 17.2.3) to see how the sockets work. The only change I've made is in the host address which I've set

Re: Error when executing the library reference echo server example

2007-12-10 Thread Jean-Paul Calderone
On Mon, 10 Dec 2007 04:16:03 -0800 (PST), [EMAIL PROTECTED] wrote: Hi. Python newbie speaking, I've copy/pasted the example of the echo server that comes in the IDLE documentation (Python Library Reference section 17.2.3) to see how the sockets work. The only change I've made is in the host

Re: Are Python deques linked lists?

2007-12-10 Thread Neil Cerutti
On 2007-12-10, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-12-09, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: I'm looking for a linked list implementation. Something iterable with constant time insertion anywhere in the list. I was wondering if deque() is the class

Re: GUI development with 3D view

2007-12-10 Thread Diez B. Roggisch
Achim Domma wrote: Hi, I'm looking for quite some time now for a gui library for python, which allows me to display 3D graphics. Main OS is windows, Mac OS X and Linux would be nice to have. I want to use python 2.5. My first try was wx + pyOpenGL but there are no working binaries for

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 3:50 am, Seongsu Lee [EMAIL PROTECTED] wrote: On 12월10일, 오후12시18분, Adonis Vargas [EMAIL PROTECTED] wrote: Seongsu Lee wrote: Hi, I have a dictionary with million keys. Each value in the dictionary has a list with up to thousand integers. Follow is a simple example

Re: Distinguishing attributes and methods

2007-12-10 Thread Bruno Desthuilliers
MonkeeSage a écrit : It seems that I've got a short-circuit somewhere here. I understand that everything is an object and the the storage/lookup system is object-agnostic, and that it is only the descriptors (or tags as I called them generically) descriptor is a protocol - an interface if you

Re: Job Offer: Python Ninja or Pirate!

2007-12-10 Thread James Matthews
Please post on the job forum! On Dec 10, 2007 9:14 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Etsy is an online marketplace for buying and selling all things handmade: clothing, music, furniture, software, jewelry, robots. We launched on June 18, 2005, and ever since then have been

Re: Are Python deques linked lists?

2007-12-10 Thread Peter Otten
Neil Cerutti wrote: [linked lists] don't work well with Python iterators, which aren't suitable for a linked list's purposes--so you have to give up the happy-joy for loop syntax in favor of Python's frowny-sad while loops. You can always move the while-loop into a generator and use

Re: Importing functions that require parameters

2007-12-10 Thread Matt_D
On Dec 10, 2:46 pm, John Machin [EMAIL PROTECTED] wrote: requires a parameter from elsewhere in the imported module is a concept I don't understand. Here is what I think that you need to do in your main script: import sys import otp_encrypt the_key = opt_encrypt.get_key(sys.argv[1]) If

Re: Is a real C-Python possible?

2007-12-10 Thread hunter . grubbs
On Dec 9, 3:23 pm, [EMAIL PROTECTED] (Aahz) wrote: In article [EMAIL PROTECTED], Jack [EMAIL PROTECTED] wrote: I understand that the standard Python distribution is considered the C-Python. Howerver, the current C-Python is really a combination of C and Python implementation. There are

Re: Distinguishing attributes and methods

2007-12-10 Thread Steven D'Aprano
On Mon, 10 Dec 2007 03:56:10 -0800, MonkeeSage wrote: So, when I say that all callable attributes (or to be more precise, all callable attributes bound to objects other than toplevel) are methods, what am I missing? Everything that isn't a method but is callable. class Callable(object):

Re: Distinguishing attributes and methods

2007-12-10 Thread MonkeeSage
On Dec 10, 7:19 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: MonkeeSage a écrit : It seems that I've got a short-circuit somewhere here. I understand that everything is an object and the the storage/lookup system is object-agnostic, and that it is only the descriptors (or tags

Re: Importing functions that require parameters

2007-12-10 Thread Peter Otten
Matt_D wrote: import sys import otp_encrypt the_key = opt_encrypt.get_key(sys.argv[1]) If that isn't what you want, you'll need to explain the sentence that starts Now I understand, with examples of what you have tried. When I try: from otp_encrypt import get_key I get:

detecting disc serial number without win32

2007-12-10 Thread PiErre
Hi, I have to run a python script on a Linux machine. This script was developed on a windows workstation and it uses the win32 library to detect the cd (or dvd) serial number (in the - format). How can I change the script to do the same task on linux? I found an old post on the same task

Re: Ruby's Template Engine for Python

2007-12-10 Thread kyosohma
On Dec 8, 3:24 pm, Samuel [EMAIL PROTECTED] wrote: On Sat, 08 Dec 2007 13:06:15 -0800, Steve Howell wrote: This is what I came up with: http://pylonshq.com/pastetags/form_remote_tag I see that Pylons uses a standard templating systems with all the JS renderers hooked into it as standard

Re: Distinguishing attributes and methods

2007-12-10 Thread Bruno Desthuilliers
MonkeeSage a écrit : On Dec 10, 7:19 am, Bruno Desthuilliers bruno. (snip) I'm going to give the Data Model section a thorough going-over again, and try to pay more attention this time(!) ;) Also make sure you read the docs about new-style classes, the descriptor protocol and metaclasses.

Re: Job Offer: Python Ninja or Pirate!

2007-12-10 Thread Nikos Vergas
Challenge: A valid response will be either a solution to the problem below, or a link to some code of which you are particularly proud. Problem: In the dynamic language of your choice, write a short program that will: 1. define a list of the following user ids 42346, 77290, 729 (you can

Re: Importing functions that require parameters

2007-12-10 Thread Matt_D
On Dec 10, 4:49 pm, Peter Otten [EMAIL PROTECTED] wrote: Peter Thanks, Peter. You answered my question precisely. I'm successfully encrypting and decrypting now. Thank you again. R, Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python deques linked lists?

2007-12-10 Thread Neil Cerutti
On 2007-12-10, Peter Otten [EMAIL PROTECTED] wrote: Neil Cerutti wrote: [linked lists] don't work well with Python iterators, which aren't suitable for a linked list's purposes--so you have to give up the happy-joy for loop syntax in favor of Python's frowny-sad while loops. You can always

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread Neil Cerutti
On 2007-12-10, MonkeeSage [EMAIL PROTECTED] wrote: If I'm not mistaken, building a reverse dictionary like that will be O(n*m) because dict/list access is O(n) (ammortized). Somebody correct me if I'm wrong. In that case, it really depends on how you will use the dict to see whether you get

Re: a Python person's experience with Ruby

2007-12-10 Thread Bruno Desthuilliers
MonkeeSage a écrit : On Dec 9, 6:23 pm, MonkeeSage [EMAIL PROTECTED] wrote: Hi Bruno, I think that we've been having a mainly semantic (pun intended) dispute. I think you're right, that we've been using the same words with different meanings. Fine. So we may have a chance to get out there

Re: GUI development with 3D view

2007-12-10 Thread M�ta-MCI (MVP)
Hi! no idea how it works with windows. On XP: fine. On Vista: very difficult... @+ MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: Error when executing the library reference echo server example

2007-12-10 Thread diego . martin . a
On Dec 10, 1:48 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Mon, 10 Dec 2007 04:16:03 -0800 (PST), [EMAIL PROTECTED] wrote: Hi. Python newbie speaking, I've copy/pasted the example of the echo server that comes in the IDLE documentation (Python Library Reference section 17.2.3) to see

Re: GUI development with 3D view

2007-12-10 Thread J. Robertson
Méta-MCI (MVP) wrote: no idea how it works with windows. On XP: fine. On Vista: very difficult... Hello Captain Obvious :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils OS X universal binaries

2007-12-10 Thread Robin Becker
Robin Becker wrote: Ok. Still, I would write it as #if defined(__LITTLE_ENDIAN__) #undef WORDS_BIGENDIAN #elif defined(__BIG_ENDIAN__) #undef WORDS_BIGENDIAN #define WORDS_BIGENDIAN 1 #endif Regards, Martin I'm never sure if undef gives an error if the variable isn't

Re: Best way to protect my new commercial software.

2007-12-10 Thread kyosohma
On Dec 10, 6:17 am, Tim Chase [EMAIL PROTECTED] wrote: So, are there any ways to make it harder to reverse engineer a program? In addition to the standby of -Don't distribute your program (SaaS) I'll add to the list: -Only distribute your program to people too non-technical to

Text file handling in python

2007-12-10 Thread Noorhan Abbas
Hello, I am tring to access a text file in random acess way, that is, using f.tell() and f.seek() to seek a certain position in the text file. f.seek() does not seem to work properly, the file is opened in a read universal 'rU' mode. Thank you very much, Nora.

Re: Are Python deques linked lists?

2007-12-10 Thread Zentrader
Instead of linking records together via some key, I first try out a dictionary of lists. The list for each dictionary key would be the same as a list with a single, forward link. If you have relatively few records per key, it works well. -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI development with 3D view

2007-12-10 Thread Achim Domma
On 10 Dez., 15:24, Méta-MCI \(MVP\) [EMAIL PROTECTED] wrote: Hi! no idea how it works with windows. On XP: fine. On Vista: very difficult... @+ MCI Also with Python 2.5? If PyOpenGL would work with Python 2.5, I could use wx too. But I could not get it to work with 2.5 on windows.

Re: GUI development with 3D view

2007-12-10 Thread Diez B. Roggisch
Achim Domma wrote: On 10 Dez., 15:24, Méta-MCI \(MVP\) [EMAIL PROTECTED] wrote: Hi! no idea how it works with windows. On XP: fine. On Vista: very difficult... @+ MCI Also with Python 2.5? If PyOpenGL would work with Python 2.5, I could use wx too. But I could not get it to work

Re: Newbie edit/compile/run cycle question

2007-12-10 Thread MartinRinehart
Bruno, Please explain why the NOP import is a GoodThing. Use small words please. I'm not as young as I used to be. I didn't know about reload(), but now that I'm informed on that point I'm still using os.remove('foo.pyc') reload(foo) A single command to do that would be nice. Martin Bruno

array.shape() gives TypeError: 'tuple' object is not callable

2007-12-10 Thread Charles Fox
Hi gys -- I am looking at Numpy but getting this error when I try to get array sizes. I'm using Ubuntu Edgy with standard repositories and scipy. Any ideas? Am I doing something wrong or is it my install of scipy? $ python Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02) [GCC 4.1.2 20060928

Re: Newbie edit/compile/run cycle question

2007-12-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: Bruno, Please explain why the NOP import is a GoodThing. Use small words please. I'm not as young as I used to be. Because otherwise every import would result in overhead without any benefit. Think of a module like this: A_GLOBAL_VARIABLE =

Re: array.shape() gives TypeError: 'tuple' object is not callable

2007-12-10 Thread Chris
On Dec 10, 5:22 pm, Charles Fox [EMAIL PROTECTED] wrote: Hi gys -- I am looking at Numpy but getting this error when I try to get array sizes. I'm using Ubuntu Edgy with standard repositories and scipy. Any ideas? Am I doing something wrong or is it my install of scipy? $ python Python

Re: Best way to merge/sort two sorted lists?...

2007-12-10 Thread Aaron Watters
On Dec 6, 2:01 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: On Dec 6, 9:30 am, Aaron Watters [EMAIL PROTECTED] wrote: See recipes: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491285 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305269 I previously noted in that I found

Re: Are Python deques linked lists?

2007-12-10 Thread Duncan Booth
Neil Cerutti [EMAIL PROTECTED] wrote: Python's iterators are unsuitable for mutating the linked list while iterating--the only major application of linked lists. Wrapping in a generator won't allow you to use for loop syntax, unless I'm missing something, which has often happened. It is

Re: Fill In a Form Automatically

2007-12-10 Thread Victor Subervi
Thanks! Mechanize looks really cool :)) Victor On Dec 7, 2007 4:11 PM, Ismail Dönmez [EMAIL PROTECTED] wrote: Friday 07 December 2007 22:06:23 tarihinde Victor Subervi şunları yazmıştı: Hi; I'm trying to fill in a Zope form automatically. I have this script, which works great for

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 8:31 am, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-12-10, MonkeeSage [EMAIL PROTECTED] wrote: If I'm not mistaken, building a reverse dictionary like that will be O(n*m) because dict/list access is O(n) (ammortized). Somebody correct me if I'm wrong. In that case, it really

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 8:31 am, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-12-10, MonkeeSage [EMAIL PROTECTED] wrote: If I'm not mistaken, building a reverse dictionary like that will be O(n*m) because dict/list access is O(n) (ammortized). Somebody correct me if I'm wrong. In that case, it really

Re: Are Python deques linked lists?

2007-12-10 Thread Neil Cerutti
On 2007-12-10, Duncan Booth [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote: Python's iterators are unsuitable for mutating the linked list while iterating--the only major application of linked lists. Wrapping in a generator won't allow you to use for loop syntax, unless I'm

Re: searching a value of a dict (each value is a list)

2007-12-10 Thread MonkeeSage
On Dec 10, 9:45 am, MonkeeSage [EMAIL PROTECTED] wrote: On Dec 10, 8:31 am, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-12-10, MonkeeSage [EMAIL PROTECTED] wrote: If I'm not mistaken, building a reverse dictionary like that will be O(n*m) because dict/list access is O(n)

Re: help with pyparsing

2007-12-10 Thread Prabhu Gurumurthy
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul McGuire wrote: On Dec 9, 11:01 pm, Prabhu Gurumurthy [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 All, I have the following lines that I would like to parse in python using pyparsing, but have some problems

Re: Error when executing the library reference echo server example

2007-12-10 Thread Jean-Paul Calderone
On Mon, 10 Dec 2007 06:38:57 -0800 (PST), [EMAIL PROTECTED] wrote: [snip] I tried it in Linux and it worked fine so I've been trying different things as the code seems to be correct. Finally, I've found that if both server and client are run from IDLE, the thing crashes with the mentioned error.

Re: a Python person's experience with Ruby

2007-12-10 Thread Chris Mellon
On Dec 9, 2007 5:11 AM, Arnaud Delobelle [EMAIL PROTECTED] wrote: On Dec 9, 12:15 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Richard Jones a écrit : Bruno Desthuilliers wrote: class A(object): @apply def a(): def fget(self): return self._a

Re: Are Python deques linked lists?

2007-12-10 Thread Ant
On Dec 9, 10:54 pm, John Machin [EMAIL PROTECTED] wrote: On Dec 10, 9:43 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: I'm looking for a linked list implementation. Something iterable with constant time insertion anywhere in the list. It's on the shelf

Dumb newbie back in shell

2007-12-10 Thread MartinRinehart
OK, it's a scripting language. def g(): ...os.remove('tokeneizer.pyc') ...reload( tokeneizer ) ...tokeneizer.tokenize('sample_decaf.d') ... But that gets me to: ... line 110, in get_toks UnboundLocalError: local variable 'line_ptr' referenced before assignment Here's a bit of the

Re: Is a real C-Python possible?

2007-12-10 Thread Raymond Hettinger
On Dec 9, 1:14 pm, Jack [EMAIL PROTECTED] wrote: I wonder if it's possible to have a Python that's completely (or at least for the most part) implemented in C, just like PHP - I think this is where PHP gets its performance advantage. Or maybe I'm wrong because the core modules that matter are

SOAPpy server shutting down?

2007-12-10 Thread sberry
I have a soap server I am running on an OS X Server using SOAPpy. To start the server I am running server = SOAPpy.SOAPServer(('IPADDRESS, PORT), namespace=NAMESPACE) server.serve_forever() I am starting the server manually in the background by running from the command line as follows:

Re: detecting disc serial number without win32

2007-12-10 Thread Peter Otten
PiErre wrote: I have to run a python script on a Linux machine. This script was developed on a windows workstation and it uses the win32 library to detect the cd (or dvd) serial number (in the - format). How can I change the script to do the same task on linux? I found an old post

Re: I'm missing something here with range vs. xrange

2007-12-10 Thread Chris Mellon
On Dec 7, 2007 8:58 PM, Joe Goldthwaite [EMAIL PROTECTED] wrote: You can't imagine why someone might prefer an iterative solution over a greedy one? Depending on the conditions, the cost of creating the list can be a greater or a lesser part of the total time spent. Actual iteration is

Re: GUI development with 3D view

2007-12-10 Thread Mike C. Fletcher
Diez B. Roggisch wrote: ... I was under the impression that PyOpenGL is ctypes-based in the new versions? It is, but I haven't had the time to do a new release and check it on a Windows box. There are minor fixes in CVS that *should* IIRC make us run better on those Windows machines that

Re: Dumb newbie back in shell

2007-12-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Dec 2007 08:31:01 -0800, MartinRinehart wrote: But that gets me to: ... line 110, in get_toks UnboundLocalError: local variable 'line_ptr' referenced before assignment Here's a bit of the code, with line #s ... 68 global line_ptr 69 global char_ptr ... 75 line_ptr = 0

Re: Dumb newbie back in shell

2007-12-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : OK, it's a scripting language. For which definition of scripting language ?-) def g(): ...os.remove('tokeneizer.pyc') ...reload( tokeneizer ) ...tokeneizer.tokenize('sample_decaf.d') ... But that gets me to: ... line 110, in get_toks

Re: Are Python deques linked lists?

2007-12-10 Thread Peter Otten
Neil Cerutti wrote: On 2007-12-10, Duncan Booth [EMAIL PROTECTED] wrote: def test(): ll = LinkedList([random.randint(1,1000) for i in range(10)]) for el in ll: if el.value%2==0: ll.delete(el) print [el.value for el in ll] if __name__=='__main__':

Re: Dumb newbie back in shell

2007-12-10 Thread MartinRinehart
Thanks, Marc. However, here's the little tester I wrote: # t.py - testing global g g = 'global var, here' def f(): print g f() It prints 'global var, here,' not an error message. Wassup? Marc 'BlackJack' Rintsch wrote: On Mon, 10 Dec 2007 08:31:01 -0800, MartinRinehart wrote: But

Re: Newbie edit/compile/run cycle question

2007-12-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Bruno, Please explain why the NOP import is a GoodThing. Use small words please. I'm not as young as I used to be. Each module that need access to another module must explicitely import it. This means that, in a typical program, your main script will import a

Re: Dumb newbie back in shell

2007-12-10 Thread Peter Otten
MartinRinehart wrote: However, here's the little tester I wrote: # t.py - testing global g g = 'global var, here' def f(): print g f() It prints 'global var, here,' not an error message. Wassup? Try it again with a modified f(): def f(): print g g = 42 In Python

Re: Job Offer: Python Ninja or Pirate!

2007-12-10 Thread Simon Forman
On Dec 10, 6:10 am, Nikos Vergas [EMAIL PROTECTED] wrote: Challenge: A valid response will be either a solution to the problem below, or a link to some code of which you are particularly proud. Problem: In the dynamic language of your choice, write a short program that will: 1.

Re: Equivalent of perl's Pod::Usage?

2007-12-10 Thread Nick Craig-Wood
Adam Funk [EMAIL PROTECTED] wrote: Sorry about that! POD is a mark-up language that Perl's Pod::Usage module can translate into man pages (and other documentation formats). So what I'm really after is an easy way to generate something that looks like a man page. You might want to

Re: Is a real C-Python possible?

2007-12-10 Thread hdante
On Dec 9, 10:07 pm, Jack [EMAIL PROTECTED] wrote: I think most Java-Python benchmarks you can find online will indicate that Java is a 3-10 times faster. A few here: http://mail.python.org/pipermail/python-list/2002-January/125789.html http://blog.snaplogic.org/?p=55 There are lies, damn

Re: Dumb newbie back in shell

2007-12-10 Thread MartinRinehart
Not trying to write C, I'm trying to write Decaf, a language I've designed (see www.MartinRinehart.com for more) but which doesn't exist. Got to code the first bit in something. Later I can write Decaf in Decaf. Chose Python as it looked like a faster write (learning curve included) than C or C++.

Python Exponent Question

2007-12-10 Thread databyss
I have a simple program and the output isn't what I expect. Could somebody please explain why? Here's the code: #simple program print v = 2 v = 2 print v**v = 2**2 =, v**v print v**v**v = 2**2**2 =, v**v**v print v**v**v**v = 2**2**2**2 =, v**v**v**v #end program Here's the output: v = 2

Re: Best way to protect my new commercial software.

2007-12-10 Thread Chris Mellon
On Dec 10, 2007 5:56 AM, Carl Banks [EMAIL PROTECTED] wrote: On Dec 10, 6:26 am, Tim Chase [EMAIL PROTECTED] wrote: So you say there is not any trusted way? You cannot distribute any program with the expectation that it cannot be reverse engineered. [snip] From the OP's post, it

Re: Python Exponent Question

2007-12-10 Thread Carsten Haese
On Mon, 2007-12-10 at 10:15 -0800, databyss wrote: I have a simple program and the output isn't what I expect. Could somebody please explain why? [...] v**v**v**v = 2**2**2**2 = 65536 I would expect 2**2**2**2 to be 256 Exponentiation is right-associative. 2**2**2**2 = 2**(2**(2**2)) =

Re: Dumb newbie back in shell

2007-12-10 Thread MartinRinehart
Peter, question is, why did the first one work? In my real code I've got module-level vars and an error msg trying to use them in a function. In my test example I've got them accessed from within a function w/o error message. I am confused. Martin Peter Otten wrote: MartinRinehart wrote:

Re: Python Exponent Question

2007-12-10 Thread Tim Chase
databyss wrote: I have a simple program and the output isn't what I expect. Could somebody please explain why? Here's the code: #simple program print v = 2 v = 2 print v**v = 2**2 =, v**v print v**v**v = 2**2**2 =, v**v**v print v**v**v**v = 2**2**2**2 =, v**v**v**v #end program

Re: Are Python deques linked lists?

2007-12-10 Thread Duncan Booth
Peter Otten [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2007-12-10, Duncan Booth [EMAIL PROTECTED] wrote: def test(): ll = LinkedList([random.randint(1,1000) for i in range(10)]) for el in ll: if el.value%2==0: ll.delete(el) print [el.value for el

Re: Python Exponent Question

2007-12-10 Thread Zero Piraeus
: v = 2 v**v = 2**2 = 4 v**v**v = 2**2**2 = 16 v**v**v**v = 2**2**2**2 = 65536 I would expect 2**2**2**2 to be 256 ... in an unparenthesized sequence of power and unary operators, the operators are evaluated from right to left ... - http://docs.python.org/ref/power.html So, 2**2**2**2 =

Re: Python Exponent Question

2007-12-10 Thread Christian Heimes
databyss wrote: I would expect 2**2**2**2 to be 256 I stumbled upon it, too. 2**2**2**2 == 2**(2**(2**2)) == 2**16 == 65536 Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python deques linked lists?

2007-12-10 Thread Neil Cerutti
On 2007-12-10, Peter Otten [EMAIL PROTECTED] wrote: Neil Cerutti wrote: def test(): ll = LinkedList([random.randint(1,1000) for i in range(10)]) for el in ll: if el.value%2==0: ll.delete(el) print [el.value for el in ll] if __name__=='__main__':

Re: Are Python deques linked lists?

2007-12-10 Thread Neil Cerutti
On 2007-12-10, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-12-10, Peter Otten [EMAIL PROTECTED] wrote: Neil Cerutti wrote: def test(): ll = LinkedList([random.randint(1,1000) for i in range(10)]) for el in ll: if el.value%2==0: ll.delete(el) print

Re: SimpleXMLRPCServer interruptable?

2007-12-10 Thread Bret
On Dec 6, 7:43 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 06 Dec 2007 13:11:09 -0300, Bret [EMAIL PROTECTED] escribió: For completeness, what I ended up doing is this: server = SimpleXMLRPCServer((host, port)) server.socket.settimeout(0.1) ServerWrapper became:

Re: GUI development with 3D view

2007-12-10 Thread M�ta-MCI (MVP)
Re! On Vista, OpenGL depend of (releases of) video-cards. Some cards don't support OpenGL = problem! Some cards have native openGL support = good (dream?) Some cards need update (drivers) @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Distinguishing attributes and methods

2007-12-10 Thread Bruno Desthuilliers
Jan Claeys a écrit : Op Sun, 09 Dec 2007 12:44:46 -0800, schreef MonkeeSage: The point is that just because the attributes are looked up the same way or whatever, doesn't make them the same *kind* of attribute. To say that all attributes are the same in python muddies the water. They are the

Re: Distinguishing attributes and methods

2007-12-10 Thread Bruno Desthuilliers
Steve Howell a écrit : --- Jan Claeys [EMAIL PROTECTED] wrote: To conclude this discussion: * in Python, methods are attributes * in Ruby, attributes are methods So clearly one of the languages has it all wrong. ;) Nope, quite on the contrary, both got it right !-) --

  1   2   3   >