Fredericksburg, VA ZPUG July 12: Jim Fulton's buildout package, Python + Fortran, roundtable

2006-07-12 Thread Gary Poster
(Apologies for the especially late notice; for some reason these announcements did not go out when I sent them Monday to python- announce-list and zope-announce) Please join us Wed., July 12, 7:30-9:00 PM, for another meeting of the Fredericksburg, VA Zope and Python User Group (ZPUG). We

Dr. Dobb's Python-URL! - weekly Python news and links (Jul 12)

2006-07-12 Thread Cameron Laird
QOTW: Write code, not usenet posts. - Fredrik Lundh If an embedded return isn't clear, the method probably needs to be refactored with 'extract method' a few times until it is clear. - John Roth The comp.lang.python collective has become quite expert at answering Which book should I

Chicago Python User Group: Thurs. July 13, 2006 7pm.

2006-07-12 Thread bray
This will be our best meeting yet. When Thurs. July 13, 2006. 7pm. Location Performics, downtown Chicago 180 N LaSalle St, Suite 1100, Please RSVP http://www.chipy.org/RSVP ** There will probably be a pre-meeting at a nearby cafe for early arrivals. Check the mailing list

Re: Restricted Access

2006-07-12 Thread iapain
Do you have an IBM s/370 running VM/CMS? VM was sort of an OS for running multiple OSs, so it would be the restricted environment G I'm having currently working on OS/2 and Linux platform, I've designed a web based ide for python and i wish to restrict some commands and user can only

Re: uTidylib question..

2006-07-12 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], bruce wrote: import tidy s = tidy.parseString(foo) which runs the information in foo through tidy, for cleaning. this results in s being a document object print s will display the contents of the object. If this means it prints out what you want as a string… my

Re: Python-2.5beta1 crash

2006-07-12 Thread Martin v. Löwis
Robin Becker wrote: First off there may be a bunch of other C extensions involved including PIL, but I built them all against this beta. What should I do to refine the error? Do I start with trying to establish which of the tests is guilty or build from source in debug mode and attempt to find

Re: Restricted Access

2006-07-12 Thread Maric Michaud
Le mercredi 12 juillet 2006 08:17, iapain a écrit : I'm having currently working on OS/2 and Linux platform, I've designed a web based ide for python and i wish to restrict some commands There is a restricted environment in Zope for TTW python scripts and ZPT/DTML . These scripts are run in

Re: hash() yields different results for different platforms

2006-07-12 Thread Qiangning Hong
Grant Edwards wrote: On 2006-07-11, Qiangning Hong [EMAIL PROTECTED] wrote: However, when I come to Python's builtin hash() function, I found it produces different values in my two computers! In a pentium4, hash('a') - -468864544; in a amd64, hash('a') - 12416037344. Does hash function

Re: hash() yields different results for different platforms

2006-07-12 Thread Tim Peters
[Grant Edwards] ... The low 32 bits match, so perhaps you should just use that portion of the returned hash? hex(12416037344) '0x2E40DB1E0L' hex(-468864544 0x) '0xE40DB1E0L' hex(12416037344 0x) '0xE40DB1E0L' hex(-468864544 0x)

Re: Is there a limit to os.popen()?

2006-07-12 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Well, running the make on the command line seems to work just fine, no errors at all. What about

Re: file.readlines() and IOError exceptions

2006-07-12 Thread Fredrik Lundh
Astan Chee wrote: now the file Im trying to read has recently had alot of read/writes from other users/threads/etc, so every now and again I get a IOError: [Errno 9] Bad file descriptor I know this has something to do with not being able to read while some filehandles are open (or is

Re: Restricted Access

2006-07-12 Thread iapain
You'll need to make your own AccessControl/ZopeGuards.py-like module, and probably subclass the RestrictionMutator to enable/disable certain functionnality (interdiction of names beginning by '_' for example is hard coded). Your reply is pretty hopeful, I saw that one, its the only

Re: Sets and Membership Tests

2006-07-12 Thread Nick Vatamaniuc
JK, You are correct to implement __hash__ and __eq__. The problem is how you implemented them. Usually your __eq__ method should compare the necessary attributes of the objects for equality. The __hash__ should return a 32-bit integer. Your best bet is probably to return a hash of hashes of your

Re: Is there a limit to os.popen()?

2006-07-12 Thread Steve Holden
Carl J. Van Arsdall wrote: I'm not sure the proper way to phrase the question, but let me try. Basically, I'm working with a script where someone wrote: kr = string.strip(os.popen('make kernelrelease').read()) And then searches kr to match a regular expression. This seems to have

Re: Object Persistence Using a File System

2006-07-12 Thread Bruno Desthuilliers
Chris Spencer wrote: Before I get too carried away with something that's probably unnecessary, please allow me to throw around some ideas. I've been looking for a method of transparent, scalable, and human-readable object persistence, and I've tried the standard lib's Shelve, Zope's ZODB,

Re: hash() yields different results for different platforms

2006-07-12 Thread Fredrik Lundh
Qiangning Hong wrote: /.../ add a hash column in the table, make it a unique key at this point, you should have slapped yourself on the forehead, and gone back to the drawing board. /F -- http://mail.python.org/mailman/listinfo/python-list

Re: import and global namespace

2006-07-12 Thread Bruno Desthuilliers
Dennis Lee Bieber wrote: On Wed, 12 Jul 2006 02:48:44 +0200, Bruno Desthuilliers [EMAIL PROTECTED] declaimed the following in comp.lang.python: nate a écrit : I'd like a module than I'm importing to be able to use objects in the global namespace into which it's been imported. is there a

Re: Relying on the behaviour of empty container in conditional statements

2006-07-12 Thread Roel Schroeven
Steven D'Aprano schreef: If seq can be None as well as a sequence, doing a test if len(seq) 0 won't save you because len(None) will fail. You need an explicit test for seq being None: if seq is not None and len(seq) 0 Or even better: if seq which Just Works regardless of the type

Re: How to use images at the bachground?

2006-07-12 Thread sreekant
pipehappy wrote: hi all, how to get out of the python shell which is executing a command? how to use images in the background of a page in Tkinter? on Unix, ctrl-c or ctrl-d may do the job. on Windows, ctrl-z will do Hi I presume you meant putting a image as a background for a Tkinter

Re: help a newbie with a IDE/book combination

2006-07-12 Thread Ron Rogers Jr.
On 9 Jul 2006 16:42:27 -0700 [EMAIL PROTECTED] wrote: Hi, I already have a couple of newbie books on Python itself, but would rather get started with a nice to use IDE and I am therefore looking for a good IDE to learn Python. Is there a good IDE which would be well documented out

Re: first book about python

2006-07-12 Thread Ron Rogers Jr.
On Sun, 09 Jul 2006 03:41:52 +0300 IOANNIS MANOLOUDIS [EMAIL PROTECTED] wrote: I want to learn python. I am looking for a book which will help me get started and should contain the foundations. I am not looking for the Python bible. Any recommendations? Ioannis Hmm, no one has mentioned

Re: Augument assignment versus regular assignment

2006-07-12 Thread Antoon Pardon
On 2006-07-11, Piet van Oostrum [EMAIL PROTECTED] wrote: Antoon Pardon [EMAIL PROTECTED] (AP) wrote: AP As I read the language reference the x stands for a target expression. AP Now what does it mean to evaluate a target expression like col[key]. AP IMO it means finding the location of the item

Re: Object Persistence Using a File System

2006-07-12 Thread Nick Vatamaniuc
Chris, Interesting concept. But why is there a need for a human readable object persistence that is x10 slower than pickle? In other words present a good use case with a rationale (i.e. your criteria that you mentioned). The only one I can think of so far is debugging. Also some objects are

Re: Accessors in Python (getters and setters)

2006-07-12 Thread mystilleef
Lousy Attribute Name: self.tmp Accessors: set_temporary_buffer get_temporary_buffer The attribute name I chose, tmp sucks. I have used that name in dozens of places spanning over 27000 LOC. There's a chance that other develops might misinterpret exactly what tmp does.

Re: hash() yields different results for different platforms

2006-07-12 Thread Nick Vatamaniuc
Using Python's hash as column in the table might not be a good idea. You just found out why. So you could instead just use the base url and create an index based on that so next time just quickly get all urls from same base address then do a linear search for a specific one, or even easier,

Re: Object Persistence Using a File System

2006-07-12 Thread Nick Vatamaniuc
Good point about isinstance. Here is a good explanation why: http://www.canonical.org/~kragen/isinstance/ Also the frozenset should be added the list of immutable types. Nick Vatamaniuc Bruno Desthuilliers wrote: Chris Spencer wrote: Before I get too carried away with something that's

Re: What is a type error?

2006-07-12 Thread Andreas Rossberg
David Hopwood wrote: George Neuner wrote: All of this presupposes that you have a high level of confidence in the compiler. I've been in software development for going in 20 years now and worked 10 years on high performance, high availability systems. In all that time I have yet to meet a

Re: Accessors in Python (getters and setters)

2006-07-12 Thread Maric Michaud
Le mercredi 12 juillet 2006 11:17, mystilleef a écrit : Yes, it is possible to name crappy accessors too (e.g set_tmp/get_tmp). But developers tend to pay more attention to given methods/functions less crappy names, at least when compared to data attributes. Not python developers. This

Re: array of array of float

2006-07-12 Thread Fredrik Lundh
Schüle Daniel wrote: a = [[] for in range(200)] correction :) a = [[] for i in range(200)] the *500 part still seems to be missing... /F -- http://mail.python.org/mailman/listinfo/python-list

Re: hash() yields different results for different platforms

2006-07-12 Thread Piet van Oostrum
Grant Edwards [EMAIL PROTECTED] (GE) wrote: GE The low 32 bits match, so perhaps you should just use that GE portion of the returned hash? If the hashed should be unique, 32 bits is much too low if you have millions of entries. -- Piet van Oostrum [EMAIL PROTECTED] URL:

RE: hash() yields different results for different platforms

2006-07-12 Thread Kerry, Richard
The hash is not expected to be unique, it just provides a starting point for another search (usually linear ?). See http://en.wikipedia.org/wiki/Hash_function Helpfully, Maybe, Richard. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Piet van

Progress Bars in python

2006-07-12 Thread Hari Sekhon
Hi, I've written a script which backs up a huge bunch of files, but I don't want the script to output the file names as it does this as it clutters the screen, I only output errors. So in order to see that the script is working and not stuck, I'd like to implement some kind of progress bar

Re: hash() yields different results for different platforms

2006-07-12 Thread Paul Rubin
Kerry, Richard [EMAIL PROTECTED] writes: The hash is not expected to be unique, it just provides a starting point for another search (usually linear ?). The database is good at organizing indexes and searching in them. Why not let the database do what it's good at. --

Re: Progress Bars in python

2006-07-12 Thread Fredrik Lundh
Hari Sekhon wrote: I've written a script which backs up a huge bunch of files, but I don't want the script to output the file names as it does this as it clutters the screen, I only output errors. So in order to see that the script is working and not stuck, I'd like to implement some kind

Re: timeit module for comparing the performance of two scripts

2006-07-12 Thread Fredrik Lundh
3c273 wrote: Doh! Me thinks Windows at work python /? (No good!) that was supposed to be fixed in 2.5, but it doesn't seem to have made it into beta 2. hmm. /F -- http://mail.python.org/mailman/listinfo/python-list

Re: I need some help

2006-07-12 Thread Jonathan Harris
Tim Heaney wrote: Several different people have written modules to help you read (and write) ID3 tags. On a related topic, I have a Perl module that reads MP4/AAC tags - http://search.cpan.org/~jhar/MP4-Info/ - that I'm considering porting to Python. But before I start, is anyone aware of an

Re: How to terminate a main script?

2006-07-12 Thread Tal Einat
Helmut Jarausch wrote: Hi, I'm still looking for an elegant and clear means to terminate the main script in Python. Unfortunately, Python doesn't allow a 'return' instruction in the main script. It is quite a common practice for Python scripts to define a main() function which contains the

Strange behaviour of Numeric Float32 array?

2006-07-12 Thread Rolf Wester
Hi, the code: from Numeric import * def my_minimum(a): n=shape(a)[0] x = 1.0e20 for i in range(n): if a[i] x: x = a[i] return x def strange(a): a[3] = -6303.0 h = my_minimum(a) for i in

Re: Accessors in Python (getters and setters)

2006-07-12 Thread Bruno Desthuilliers
mystilleef wrote: Lousy Attribute Name: self.tmp Accessors: set_temporary_buffer get_temporary_buffer The attribute name I chose, tmp sucks. Well, it's surely not as descriptive as 'temporary_buffer' I have used that name in dozens of places spanning over 27000 LOC.

Re: Generating all ordered substrings of a string

2006-07-12 Thread Tal Einat
[EMAIL PROTECTED] wrote: Hi, I want to generate all non-empty substrings of a string of length =2. Also, each substring is to be paired with 'string - substring' part and vice versa. Thus, ['abc'] gives me [['a', 'bc'], ['bc', 'a'], ['ab', 'c'], ['c', 'ab'], ['b', 'ac'], ['ac', 'b']]

Last used directory?

2006-07-12 Thread Michael Yanowitz
Hello: Is there a global or some trick I can use to have Python remember the last directory visited? What I mean is suppose I have this function: def get_filename(): Returns a filename selected from a Tkinter File Selection Dialog strFilename =

Re: threading troubles

2006-07-12 Thread Antoon Pardon
On 2006-07-10, sreekant [EMAIL PROTECTED] wrote: Hi folks What am I doing wrong in the following? I just want to run fluidsynth in the background. # class MyThread(threading.Thread): def __init__(self, cmd, callback): self.__cmd = cmd

Re: Last used directory?

2006-07-12 Thread Steven D'Aprano
On Wed, 12 Jul 2006 07:29:18 -0400, Michael Yanowitz wrote: but instead of having initialdir='.' (current directory), I would like it set to the last visited directory, which can be from a previous run or even a previous day. Is that possible? If so how? Every time you open a file, save

Delivery failure notification

2006-07-12 Thread SMTP_Mail_Security
Your message with Subject: Important could not be delivered to the following recipients: [EMAIL PROTECTED] Please do not resend your original message. Delivery attempts will continue to be made for 4 day(s). -- http://mail.python.org/mailman/listinfo/python-list

Problems with Unicode Plane 1 characters on Windows

2006-07-12 Thread Edin Salković
Hi all, Why doesn't the following code work on Windows XP, although it works on Linux (Ubuntu 6.06). Both versions are of Python are 2.4, and both OSs are on the same PC. import unicodedata unicodedata.name(U'\U0001d400') Traceback (most recent call last): File stdin, line 1, in ? TypeError:

Re: Progress Bars in python

2006-07-12 Thread skip
Hari So in order to see that the script is working and not stuck, I'd Hari like to implement some kind of progress bar or something, ... Here's mine: http://orca.mojam.com/~skip/python/progress.py There are both Progress and Counter classes. Same idea, different output. Skip --

wxHtmlHelpController

2006-07-12 Thread Bryan
is it possible to get the list of search results from the search box from wxPython's wxHtmlHelpControl without it displaying GUI? i don't see an obvious way to do this. thanks, bryan -- http://mail.python.org/mailman/listinfo/python-list

Re: wxHtmlHelpController

2006-07-12 Thread Bryan
Bryan wrote: is it possible to get the list of search results from the search box from wxPython's wxHtmlHelpControl without it displaying GUI? i don't see an obvious way to do this. thanks, bryan i meant wxPython's wxHtmlHelpController --

Compiling Python using the Portland Group compiler

2006-07-12 Thread Konrad Hinsen
I am trying to install Python 2.4.3 on an AMD Opteron system using the Portland Group's compiler (pgcc). Using CC=pgcc -DNCURSES_ENABLE_STDBOOL_H=0 OPT=-O0 LINKFORSHARED=-Wl,- export-dynamic ./configure --without-cxx I finally managed to obtain an executable that would start and work, but

How to display name of elements in list?

2006-07-12 Thread cz
Hi there, I'm sure there is a very simple solution for my question, I just didn't find it up to now. I'm using a badly documented module and therefore need to find out about how to access the elements in a list. (I need to do this in Python 1.5.3) Any help appreciated very much. Thanks! cz --

Re: How to display name of elements in list?

2006-07-12 Thread Ant
I'm using a badly documented module and therefore need to find out about how to access the elements in a list. (I need to do this in Python 1.5.3) I presume this is the same in 1.5 use dir(): import os dir(os) ['F_OK', 'O_APPEND', 'O_BINARY', 'O_CREAT', 'O_EXCL', 'O_NOINHERIT', 'O_RANDOM',

Re: Accessors in Python (getters and setters)

2006-07-12 Thread Ant
Yes, it is possible to name crappy accessors too (e.g set_tmp/get_tmp). But developers tend to pay more attention to given methods/functions less crappy names, at least when compared to data attributes. This In my experience of getters and setters in Java, most developers choose attribute

Re: How to display name of elements in list?

2006-07-12 Thread Steven D'Aprano
On Wed, 12 Jul 2006 05:17:30 -0700, cz wrote: Hi there, I'm sure there is a very simple solution for my question, I just didn't find it up to now. I'm using a badly documented module and therefore need to find out about how to access the elements in a list. Er, the same way you would

Re: first book about python

2006-07-12 Thread Steve
I recommend The Quick Python Book by Harms and McDonald. Its strength is its brevity and *readability* -- you can actually just sit down and read it and enjoy it. It doesn't cover the newest features of Python or the most advanced, but that is not necessary in a beginner's book. Once you're up

pygtk crashing when using gtkmozembed

2006-07-12 Thread moumita
hi all, I am trying to execute one simple program using pygtk-2.8.6 and gnome-python-extra-2.12.It's crashing at the time of executing the follwing instruction. - self.moz = gtkmozembed.MozEmbed()

Re: How to display name of elements in list?

2006-07-12 Thread cz
Perhaps you need to rephrase your question. -- Steven. Thanks for your reply. OK, I'll try to make this more clear: My list called elten looks like that: [Tensor: id = 1, intensity = 2976.52 xx = -1447.32, xy = 52.458, xz = -594.186 yy = -1090.54, yz = -0.0158068, zz = -4043. , Tensor: id

Re: How to display name of elements in list?

2006-07-12 Thread Stefan Behnel
Hi Claudio, cz wrote: Perhaps you need to rephrase your question. -- Steven. Thanks for your reply. OK, I'll try to make this more clear: My list called elten looks like that: [Tensor: id = 1, intensity = 2976.52 xx = -1447.32, xy = 52.458, xz = -594.186 yy = -1090.54, yz =

Re: Multi-threaded FTP Question

2006-07-12 Thread Jeremy Jones
Dennis Lee Bieber wrote: On 11 Jul 2006 06:45:42 -0700, [EMAIL PROTECTED] declaimed the following in comp.lang.python: Could it be that the SERVER is limiting things to 5 concurrent/parallel connections from any single IP? I know I've encountered sites that only allowed two FTP

Re: How to display name of elements in list?

2006-07-12 Thread cz
The list above is not a valid Python list. What is it that you store in that list? Or is it maybe a dictionary? Stefan Thanks for your help. How can I find out about what this is? As I said it's generated by a insufficiently documented module. So if this is a user defined datatype, is

Re: Multi-threaded FTP Question

2006-07-12 Thread olsongt
[EMAIL PROTECTED] wrote: I'm trying to use ftp in python in a multi-threaded way on a windows box - python version 2.4.3. Problem is that it appears that it's only possible to have five instances/threads at one point in time. Errors look like: File C:\Python24\lib\ftplib.py, line 107,

Editing File

2006-07-12 Thread D
Hi, I currently have a Python app with a Tkinter GUI frontend that I use for system administration. Everytime it launches, it reads a text file which contains info about each host I wish to monitor - each field (such as IP, hostname, etc.) is delimited by !!. Now, I want to be able to edit host

Re: What is a type error?

2006-07-12 Thread Joachim Durchholz
Marshall schrieb: Joachim Durchholz wrote: Marshall schrieb: Now, I'm not fully up to speed on DBC. The contract specifications, these are specified statically, but checked dynamically, is that right? That's how it's done in Eiffel, yes. In other words, we can consider contracts in light

Re: Editing File

2006-07-12 Thread Jeremy Jones
D wrote: Hi, I currently have a Python app with a Tkinter GUI frontend that I use for system administration. Everytime it launches, it reads a text file which contains info about each host I wish to monitor - each field (such as IP, hostname, etc.) is delimited by !!. Now, I want to be

Re: How to display name of elements in list?

2006-07-12 Thread Diez B. Roggisch
cz wrote: The list above is not a valid Python list. What is it that you store in that list? Or is it maybe a dictionary? Stefan Thanks for your help. How can I find out about what this is? As I said it's generated by a insufficiently documented module. So if this is a user defined

Re: How to display name of elements in list?

2006-07-12 Thread Magnus Lycka
My list called elten looks like that: [Tensor: id = 1, intensity = 2976.52 xx = -1447.32, xy = 52.458, xz = -594.186 yy = -1090.54, yz = -0.0158068, zz = -4043. , Tensor: id = 26, intensity = 2896.9 ... , Tensor: id = 5, intensity = 2920.5 xx = -1534.53, xy = 23.4858, xz = -623.967

Re: How to display name of elements in list?

2006-07-12 Thread Stefan Behnel
cz schrieb: The list above is not a valid Python list. What is it that you store in that list? Or is it maybe a dictionary? Stefan Thanks for your help. How can I find out about what this is? As I said it's generated by a insufficiently documented module. So if this is a user defined

Re: hash() yields different results for different platforms

2006-07-12 Thread Grant Edwards
On 2006-07-12, Carl Banks [EMAIL PROTECTED] wrote: Grant Edwards wrote: On 2006-07-11, Qiangning Hong [EMAIL PROTECTED] wrote: I'm writing a spider. I have millions of urls in a table (mysql) to check if a url has already been fetched. To check fast, I am considering to add a hash column

Re: hash() yields different results for different platforms

2006-07-12 Thread Grant Edwards
On 2006-07-12, Qiangning Hong [EMAIL PROTECTED] wrote: Grant Edwards wrote: On 2006-07-11, Qiangning Hong [EMAIL PROTECTED] wrote: However, when I come to Python's builtin hash() function, I found it produces different values in my two computers! In a pentium4, hash('a') - -468864544; in

Re: What is a type error?

2006-07-12 Thread Joachim Durchholz
Darren New schrieb: As far as I understand it, Eiffel compilers don't even make use of postconditions to optimize code or eliminate run-time checks (like null pointer testing). That's correct. I think a large part of the reasons why this isn't done is that Eiffel's semantics is (a) too

Re: Sets and Membership Tests

2006-07-12 Thread JKPeck
Thanks for the advice. Once assured that __hash__ etc was the right route, I found that using hash() instead of object.__hash__() gave me stable hash valules. (I am hashing strings that I know to be unique.) The no luck situation was that a set would accept the same object multiple times, not

Data access from multiple code modules

2006-07-12 Thread simon . hibbs
Lets say that I have an application consisting of 3 files. A main.py file, gui.py and a data.py which handles persistent data storage. Suppose data.py defines a class 'MyDB' which reads in data from a database, and main.py creates an instance of this object. How does code in gui.py access this

Re: Data access from multiple code modules

2006-07-12 Thread Jeremy Jones
[EMAIL PROTECTED] wrote: Lets say that I have an application consisting of 3 files. A main.py file, gui.py and a data.py which handles persistent data storage. Suppose data.py defines a class 'MyDB' which reads in data from a database, and main.py creates an instance of this object. How does

Re: Sets and Membership Tests

2006-07-12 Thread Alex Martelli
JKPeck [EMAIL PROTECTED] wrote: Thanks for the advice. Once assured that __hash__ etc was the right route, I found that using hash() instead of object.__hash__() gave me stable hash valules. (I am hashing strings that I know to be unique.) The no luck situation was that a set would accept

Re: Progress Bars in python

2006-07-12 Thread Hari Sekhon
On 12/07/06, Fredrik Lundh [EMAIL PROTECTED] wrote: If the output of the script is sent to a logfile, this tends to puke all over the logfile... creating one additional entry per iteration, but it's a good start and I'll look at that link which looks very promising. there's no way to do this

Re: Editing File

2006-07-12 Thread [EMAIL PROTECTED]
D wrote: Hi, I currently have a Python app with a Tkinter GUI frontend that I use for system administration. Everytime it launches, it reads a text file which contains info about each host I wish to monitor - each field (such as IP, hostname, etc.) is delimited by !!. Now, I want to be

Re: Data access from multiple code modules

2006-07-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: Lets say that I have an application consisting of 3 files. A main.py file, gui.py and a data.py which handles persistent data storage. Suppose data.py defines a class 'MyDB' which reads in data from a database, and main.py creates an instance of this object. How does

Persistant dictionary with lockable elements

2006-07-12 Thread Will McGugan
Hi, I'd like to have a persistant dictionary in a server so that incoming requests acquire a specific Python object, do something with it then return. There wont be that many objects but it is the persistance that is important here, I want the information to survive server re-starts / crashes.

Re: Progress Bars in python

2006-07-12 Thread Larry Bates
Hari Sekhon wrote: Hi, I've written a script which backs up a huge bunch of files, but I don't want the script to output the file names as it does this as it clutters the screen, I only output errors. So in order to see that the script is working and not stuck, I'd like to implement some

Re: How to display name of elements in list?

2006-07-12 Thread Fredrik Lundh
Stefan Behnel wrote: The list above is not a valid Python list. there's no Python 1.5.3 either. maybe he's posting from a parallel, slightly different universe ? /F -- http://mail.python.org/mailman/listinfo/python-list

Re: Persistant dictionary with lockable elements

2006-07-12 Thread Bruno Desthuilliers
Will McGugan wrote: Hi, I'd like to have a persistant dictionary in a server so that incoming requests acquire a specific Python object, do something with it then return. There wont be that many objects but it is the persistance that is important here, I want the information to survive

Re: Data access from multiple code modules

2006-07-12 Thread simon . hibbs
Jeremy Jones wrote: What does main.py do? Are you creating an instance of the gui thingy? If so, you could just pass DataObject into your gui thingy either into the constructor or to a setter once you create an instance of it. It's a wxPython app. I created the GUI initialy using wxGlade

Re: Problems with Unicode Plane 1 characters on Windows

2006-07-12 Thread Fredrik Lundh
Edin Salković wrote: Why doesn't the following code work on Windows XP, although it works on Linux (Ubuntu 6.06). Both versions are of Python are 2.4, and both OSs are on the same PC. import unicodedata unicodedata.name(U'\U0001d400') Traceback (most recent call last): File stdin, line

Re: Editing File

2006-07-12 Thread D
Thanks, guys. So overall, would it just be easier (and not too rigged) if any changes were made by just editing the text file? I want to do this project the right way, but if it's going to be a big pain to implement the edit function, just modifying the text file directly isn't that big of a

Re: Editing File

2006-07-12 Thread [EMAIL PROTECTED]
D wrote: Thanks, guys. So overall, would it just be easier (and not too rigged) if any changes were made by just editing the text file? I want to do this project the right way, but if it's going to be a big pain to implement the edit function, just modifying the text file directly isn't

check type when assignment

2006-07-12 Thread pipehappy
Hello everyone: Is there a way to check the type when do assignment? if I write: ab = bc and want to make sure the return value of isinstance(bc, klass) is True or I will raise a exception. Any suggestion? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to display name of elements in list?

2006-07-12 Thread Tal Einat
Diez B. Roggisch deets at nospam.web.de writes: What you should do is to install rlcompleter2... [snip] Another option is to look into the source of that module and identify the objects created. Documentation is overrated - use the source, Luke! rlcompleter is overrated, and only works on

Re: Editing File

2006-07-12 Thread Jeremy Jones
D wrote: Thanks, guys. So overall, would it just be easier (and not too rigged) if any changes were made by just editing the text file? I want to do snip [EMAIL PROTECTED] wrote: snip Might be overkill - but pickle the data memeber that contains the information. If you use text

Re: Data access from multiple code modules

2006-07-12 Thread Jeremy Jones
[EMAIL PROTECTED] wrote: snip Doh! How simple. Why didn't I think of that? I'm too used to procedural scripts where you'd just put everything in a global data structure. I know this is bad, but it's hard to get out of that mentality. Sounds like you got it. Just pass it on down as needed.

Re: timeit module for comparing the performance of two scripts

2006-07-12 Thread Georg Brandl
3c273 wrote: John Machin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You appear to know what a switch is. I'm therefore surprised that you appear not to know that the convention is that any program that uses command-line switches should do something informative when run with a

Re: check type when assignment

2006-07-12 Thread Tal Einat
pipehappy pipehappy at gmail.com writes: Hello everyone: Is there a way to check the type when do assignment? if I write: ab = bc and want to make sure the return value of isinstance(bc, klass) is True or I will raise a exception. Any suggestion? 1. Check your condition before

don't need dictionary's keys - hash table?

2006-07-12 Thread kdotsky
Hello, I am using some very large dictionaries with keys that are long strings (urls). For a large dictionary these keys start to take up a significant amount of memory. I do not need access to these keys -- I only need to be able to retrieve the value associated with a certain key, so I do not

Re: check type when assignment

2006-07-12 Thread Diez B. Roggisch
pipehappy wrote: Hello everyone: Is there a way to check the type when do assignment? if I write: ab = bc and want to make sure the return value of isinstance(bc, klass) is True or I will raise a exception. In general, not doable. The assignment operator is not overloadable. Only if

Re: How to display name of elements in list?

2006-07-12 Thread Diez B. Roggisch
rlcompleter is overrated, and only works on Unix/Linux/etc. IDLE's interpreter has an auto-completion extension, which is bundled in Python2.5. I don't use idle, and don't want to. So for me rlcomlpeter2 is a good thing. And under windows, it at least works under cygwin. Diez --

Re: Editing File

2006-07-12 Thread Tal Einat
akameswaran at gmail.com akameswaran at gmail.com writes: D wrote: Thanks, guys. So overall, would it just be easier (and not too rigged) if any changes were made by just editing the text file? [snip] have you used pickle? if the data is as simple as you say it is, you will be able

Re: Editing File

2006-07-12 Thread Maric Michaud
Le mercredi 12 juillet 2006 17:00, D a écrit : Thanks, guys. So overall, would it just be easier (and not too rigged) if any changes were made by just editing the text file? I want to do this project the right way, but if it's going to be a big pain to implement the edit function, just

Re: Multi-threaded FTP Question

2006-07-12 Thread dbandler
Thanks so much for your help on this. The server that I'm connecting to is the culprit. They only allow five connections at a time. I assumed that it was a code issue. I think that we're conditioned to expect that the problem is on the software side of things. -Derek [EMAIL PROTECTED]

Re: don't need dictionary's keys - hash table?

2006-07-12 Thread kdotsky
[EMAIL PROTECTED] wrote: Hello, I am using some very large dictionaries with keys that are long strings (urls). For a large dictionary these keys start to take up a significant amount of memory. I do not need access to these keys -- I only need to be able to retrieve the value associated

Re: Data access from multiple code modules

2006-07-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: Jeremy Jones wrote: What does main.py do? Are you creating an instance of the gui thingy? If so, you could just pass DataObject into your gui thingy either into the constructor or to a setter once you create an instance of it. It's a wxPython app. I created the

Re: check type when assignment

2006-07-12 Thread Bruno Desthuilliers
Diez B. Roggisch wrote: pipehappy wrote: Hello everyone: Is there a way to check the type when do assignment? if I write: ab = bc and want to make sure the return value of isinstance(bc, klass) is True or I will raise a exception. In general, not doable. The assignment operator is not

Re: Sets and Membership Tests

2006-07-12 Thread Nick Vatamaniuc
JK, As a general rule, let Python call the magic __method__ methods behind the scenes. So don't call obj.__hash()__ or obj.__len__ or obj.__le__ just use hash(obj), len(obj) or =. Of course there are exceptions, for example when calling the __init__() method of a supercalass inside the __init__

  1   2   >