Re: Is there a way to hook into module destruction?

2007-06-16 Thread Gerald Kaszuba
> I doubt python calls __del__ when unloading module... and plus, I > don't really think python does module unloading though. del module Ah! Apologies... I mis-read the question. Unloading or at least destroying the reference to a loaded module, you could go for "del module_name"? -- Gerald Kasz

Re: Is there a way to hook into module destruction?

2007-06-16 Thread i3dmaster
On Jun 16, 11:03 pm, Gerald Kaszuba <[EMAIL PROTECTED]> wrote: > On Jun 17, 6:16 am, Neal Becker <[EMAIL PROTECTED]> wrote: > > > Code at global scope in a module is run at module construction (init). Is > > it possible to hook into module destruction (unloading)? > > Try the __del__ method. > > S

Re: Is there a way to hook into module destruction?

2007-06-16 Thread Gerald Kaszuba
On Jun 17, 6:16 am, Neal Becker <[EMAIL PROTECTED]> wrote: > Code at global scope in a module is run at module construction (init). Is > it possible to hook into module destruction (unloading)? Try the __del__ method. See http://docs.python.org/ref/customization.html for the docs. -- Gerald Kas

Re: Want to learn Python

2007-06-16 Thread Aahz
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >Dennis Lee Bieber <[EMAIL PROTECTED]> writes: >> >> The first edition "Wicca for Dummies" had a few laughs too... >> Biggest one is that someone inserted a photo of the "Venus de Milo" >> where the text called for t

Re: Is there a way to hook into module destruction?

2007-06-16 Thread Gabriel Genellina
En Sat, 16 Jun 2007 17:16:10 -0300, Neal Becker <[EMAIL PROTECTED]> escribió: > Code at global scope in a module is run at module construction (init). > Is > it possible to hook into module destruction (unloading)? No exactly, but you could try the atexit module. -- Gabriel Genellina --

Re: Newbie question: how to get started?

2007-06-16 Thread Basilisk96
On Jun 16, 11:10 pm, walterbyrd <[EMAIL PROTECTED]> wrote: > Here are two very well regarded online books - both free: > > http://www.diveintopython.org/ > > http://www.ibiblio.org/obp/thinkCSpy/ I second that advice, especially the latter text. It's an excellent resource for any beginner in Pytho

Re: Newbie question: how to get started?

2007-06-16 Thread google
On Jun 17, 12:48 pm, ed <[EMAIL PROTECTED]> wrote: > Hi, > > I'm interested in starting to learn python. I'm looking for any > reccomendations or advice that I can use to get started. Looking > forward to any help you can give! > > Thanks! > > -e There are some great tutorials online. Try this o

Re: Newbie question: how to get started?

2007-06-16 Thread walterbyrd
On Jun 16, 8:48 pm, ed <[EMAIL PROTECTED]> wrote: > Hi, > > I'm interested in starting to learn python. I'm looking for any > reccomendations or advice that I can use to get started. Looking > forward to any help you can give! > > Thanks! > > -e Here are two very well regarded online books - bot

Re: Inserting breakpoints ...

2007-06-16 Thread Gabriel Genellina
En Sat, 16 Jun 2007 10:22:34 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: > for the simulation of some micro language (JAL), > the original language is (with a minimal effort) translated into Python, > after which the code is run in Python. > > I want to add a call to a debug routine, > cal

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Paul Rubin
Neil Cerutti <[EMAIL PROTECTED]> writes: > I don't know that much about ML. I know is does a really nice job > of generic containers, as does C++. But can it 'foo' any type as > easily as C++? > > template T foo(T); I don't know enough C++ to understand what the above means exactly, but I think

Re: Want to learn Python

2007-06-16 Thread Paul Rubin
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > > Aahz's book is really good, in my opinion. So are many others in the > > "for Dummies" series that I've had occasion to try (including the one > > with the delightfully unintended pun in its title, "Bridge for Dummies": > > despite the title it app

Re: Newbie question: how to get started?

2007-06-16 Thread ed
I should also mention that I know C/C++, Perl, Javascript, the basics of mySQL, and HTML/CSS. If anyone has tried to enter python from these angles, I'd be grateful to hear from you. On 2007-06-16 22:48:32 -0400, ed <[EMAIL PROTECTED]> said: > Hi, > > I'm interested in starting to learn pytho

Newbie question: how to get started?

2007-06-16 Thread ed
Hi, I'm interested in starting to learn python. I'm looking for any reccomendations or advice that I can use to get started. Looking forward to any help you can give! Thanks! -e -- http://mail.python.org/mailman/listinfo/python-list

What's with "orange" ??

2007-06-16 Thread walterbyrd
The maker of the skeletonz python based CMS, amonge other things: http://orangoo.com/skeletonz/ One of the few hosts that really provides good support for django: http://asmallorange.com/ The python component-based data mining software: http://www.ailab.si/orange -- http://mail.python.org/ma

Re: How do I write to a CD?

2007-06-16 Thread Grant Edwards
On 2007-06-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am looking for Python code to open, read, write, close, and > make bootable the following: CD DVD USB Drive > > Can I just use open(), read(), write(), and close() for these? CD,DVD: No. You're going to have to use os.popen/os.syste

Re: Function that returns a tuple

2007-06-16 Thread Dan Hipschman
On Sat, Jun 16, 2007 at 06:30:26PM -0700, Marcpp wrote: > Hi, I need to returns a tuple from a function (reads a database) > Any idea?. Like this? def foo(): return 1, 2, 3, 4 -- http://mail.python.org/mailman/listinfo/python-list

Re: Function that returns a tuple

2007-06-16 Thread Carsten Haese
On Sat, 2007-06-16 at 18:30 -0700, Marcpp wrote: > Hi, I need to returns a tuple from a function (reads a database) > Any idea?. def f(): return (1,2) Somehow I have the feeling that there's more to your question than you're letting on... -- Carsten Haese http://informixdb.sourceforge.net -

Re: Function that returns a tuple

2007-06-16 Thread Steven D'Aprano
On Sat, 16 Jun 2007 18:30:26 -0700, Marcpp wrote: > Hi, I need to returns a tuple from a function (reads a database) > Any idea?. I don't understand the question. Just return the tuple the same as you would return an int or a float or a str or any other data type. def return_a_tuple(): retur

Re: Looking for a wxPython GUI builder

2007-06-16 Thread Steve Holden
hg wrote: > Dick Moores wrote: > >> How about SPE? >> >> Any others? >> >> And which ones do people >> actually use? Commercial or Freeware. >> >> Thanks, >> >> Dick Moores > > > I use wxDesigner: http://www.roebling.de/ > > hg > I've used both BoaConstructor and wxDesigner - this latter produ

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > PL/1 is basically gone, but its legacy of "take what you need and leave > the rest" is unfortunately alive in other languages that are blind to > the enormous advantages of simplicity and uniformity. Intercal? -- http://mail.python.org/mailman/listinfo/

Function that returns a tuple

2007-06-16 Thread Marcpp
Hi, I need to returns a tuple from a function (reads a database) Any idea?. -- http://mail.python.org/mailman/listinfo/python-list

Re: IndentationError: unexpected indent

2007-06-16 Thread Dave Borne
> It would be very helpful when Python would warn you when there are tabs in > your source. invoke python with the -t option for warnings about tabs or -tt for errors. -Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: a_list.count(a_callable) ?

2007-06-16 Thread Steven D'Aprano
On Sat, 16 Jun 2007 20:37:01 +, Dustan wrote: > On Jun 16, 12:04 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> > wrote: >> class SmartCountingList(list): >> def count(self, item, func=lambda x: x): >> return len([item for item in self if func(item) is True]) > > A less bug-prone a

Re: a_list.count(a_callable) ?

2007-06-16 Thread Evan Klitzke
On 6/16/07, Dustan <[EMAIL PROTECTED]> wrote: > On Jun 16, 3:37 pm, Dustan <[EMAIL PROTECTED]> wrote: > > class SmartCountingList(list): > > def count(self, item, func=lambda x: x): > > return sum(1 for i in self if func(item)==item) > > > > Then, you would call it as follows: > > a_lis

Re: a_list.count(a_callable) ?

2007-06-16 Thread Dustan
On Jun 16, 3:37 pm, Dustan <[EMAIL PROTECTED]> wrote: > class SmartCountingList(list): > def count(self, item, func=lambda x: x): > return sum(1 for i in self if func(item)==item) > > Then, you would call it as follows: > a_list.count(True, a_function) I need to learn to think things t

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Alex Martelli
Cousin Stanley <[EMAIL PROTECTED]> wrote: ... > > I think the Original Sin in that regard was PL/I: it tried to have all ... > > tended to have two or more ways to perform any given task, typically > > inspired by some of the existing languages, often with the addition of > > new ones made ou

Re: Want to learn Python

2007-06-16 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > > I'm curious, have you tried _Python for Dummies_? > > No, I haven't. Unfortunately, I don't ever consider Dummies books. > That type of marketing appeals to certain people and not others. I'm > one of the others. I'll definitely take a look at it the next t

Writing books (was Re: Want to learn Python)

2007-06-16 Thread Aahz
In article <[EMAIL PROTECTED]>, 7stud <[EMAIL PROTECTED]> wrote: > >It's nice to hear about an author who cares enough about the end >product that bears their name to insist on quality. I'm so tired of >hearing authors whine that the publisher screwed up the book. In all fairness, my co-author a

Re: How do I write to a CD?

2007-06-16 Thread Michael Torrie
On Sat, 2007-06-16 at 11:50 -0400, [EMAIL PROTECTED] wrote: > Hello: > >I am looking for Python code to open, read, write, close, > and make bootable the following: > CD > DVD > USB Drive There will be no cross-platform way to do this. Certainly no python libraries. The closest thing

Re: Should: "for k,v in **dictionary_instance" work?

2007-06-16 Thread Eduardo \"EdCrypt\" O. Padoan
> Actually since you asked, I had to try this out > > x = range(10) > a, *b = x PEP 3132: Extended Iterable Unpacking http://www.python.org/dev/peps/pep-3132/ -- EduardoOPadoan (eopadoan->altavix::com) Bookmarks: http://del.icio.us/edcrypt -- http://mail.python.org/mailman/listinfo/python-lis

Re: a_list.count(a_callable) ?

2007-06-16 Thread Dustan
On Jun 16, 12:04 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > class SmartCountingList(list): > def count(self, item, func=lambda x: x): > return len([item for item in self if func(item) is True]) A less bug-prone and (I would think) speedier example, although still untested:

Is there a way to hook into module destruction?

2007-06-16 Thread Neal Becker
Code at global scope in a module is run at module construction (init). Is it possible to hook into module destruction (unloading)? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Neil Cerutti
On 2007-06-16, Paul Rubin wrote: > Neil Cerutti <[EMAIL PROTECTED]> writes: >> I vote for C++ as being astoundingly complex. But it provides >> complex features, e.g.,the machanisms it provides to deal with >> multiple inheritance, or generic, type-safe code. > > It gets off-topic but I'm not sure

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Douglas Alan
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > Macros? Unfortunately to my world, macros are those things > found in C, high-powered assemblers, and pre-VBA Office. As such, > they do anything but keep a language small, and one encounters > multiple implementations of similar functionality

Re: a_list.count(a_callable) ?

2007-06-16 Thread Wildemar Wildenburger
Ping wrote: > On 6 16 , 2 06 , "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: > >> Maybe you could extend count() analogous to how sort() works: >> > > Wow! This jumps out of my screen! I like it very much. > How to get the extension into the language? > Well, you subclass list and exte

Re: How do I write to a CD?

2007-06-16 Thread Evan Klitzke
On 6/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >Can I just use open(), read(), write(), and close() for > these? And how do I make something bootable? I don't know enough about your query to answer all of your questions, but to make any device bootable, including a CD, you need to pu

Re: Priority Queue with Mutable Elements

2007-06-16 Thread Scott David Daniels
Chris Lasher wrote: > On Jun 15, 5:52 pm, Josiah Carlson <[EMAIL PROTECTED]> > wrote: >> See this implementation of a "pair heap": >>http://mail.python.org/pipermail/python-dev/2006-November/069845.html >> ...which offers the ability to update the 'priority' of an entry in the >> heap. It requ

Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

2007-06-16 Thread Peter J. Holzer
["Followup-To:" header set to comp.lang.perl.misc.] On 2007-06-12 08:15, Thomas F. Burdick <[EMAIL PROTECTED]> wrote: > On Jun 11, 11:36 pm, Tim Bradshaw <[EMAIL PROTECTED]> wrote: >> On Jun 11, 8:02 am, Twisted <[EMAIL PROTECTED]> wrote: >> >> > On Jun 11, 2:42 am, Joachim Durchholz <[EMAIL PROTEC

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Paul Rubin
Neil Cerutti <[EMAIL PROTECTED]> writes: > I vote for C++ as being astoundingly complex. But it provides > complex features, e.g.,the machanisms it provides to deal with > multiple inheritance, or generic, type-safe code. It gets off-topic but I'm not sure what advantage templates are supposed to

Re: retrieve / find out an image's dimensions

2007-06-16 Thread jigloo
On 6 16 , 6 27 , Adam Teale <[EMAIL PROTECTED]> wrote: > hey guys > > Is there a builtin/standard install method in python for retrieving or > finding out an image's dimensions? Sorry, after i review these code in http://www.pycode.com/modules/?id=32, i found some(not just a few) *BUGS* in it. I

Re: Want to learn Python

2007-06-16 Thread 7stud
> I'm curious, have you tried _Python for Dummies_? No, I haven't. Unfortunately, I don't ever consider Dummies books. That type of marketing appeals to certain people and not others. I'm one of the others. I'll definitely take a look at it the next time I'm in the bookstore. >We didn't wait f

Re: PIL cutting off letters

2007-06-16 Thread Pierre Hanser
Matt Haggard a écrit : > I'm using PIL (Python Imaging Library) to generate button images. > They consist of a left end image, a middle, repeating image and a > right side image anyway, that's not important > > I'm using a TTF font for the text of the button (Verdana.TTF) and it > keeps cuttin

Re: Want to learn Python

2007-06-16 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: >7stud <[EMAIL PROTECTED]> wrote: >> >> The reference book "Python in a Nutshell" is excellent, however its >> index is so bad I hesitate to recommend it. A reference book should >> have a thorough index--you shouldn't have t

Re: retrieve / find out an image's dimensions

2007-06-16 Thread jigloo
http://www.pycode.com/modules/?id=32 On 6 16 , 6 27 , Adam Teale <[EMAIL PROTECTED]> wrote: > hey guys > > Is there a builtin/standard install method in python for retrieving or > finding out an image's dimensions? > > A quick google found me > this:http://www.pythonware.com/library/pil/handboo

Re: Want to learn Python

2007-06-16 Thread Aahz
In article <[EMAIL PROTECTED]>, 7stud <[EMAIL PROTECTED]> wrote: > >I am of the opposite opinion: I recommend that people get any book but >"Beginning Python: Novice to Professional". In my opinion, that book >is horribly written, the examples are terrible, some subjects are only >covered in pass

How do I write to a CD?

2007-06-16 Thread k47867
Hello: I am looking for Python code to open, read, write, close, and make bootable the following: CD DVD USB Drive Can I just use open(), read(), write(), and close() for these? And how do I make something bootable? Is there a portable way to do this that works for both windows XP/Vis

Re: Looking for a wxPython GUI builder

2007-06-16 Thread hg
Dick Moores wrote: > How about SPE? > > Any others? > > And which ones do people > actually use? Commercial or Freeware. > > Thanks, > > Dick Moores I use wxDesigner: http://www.roebling.de/ hg -- http://mail.python.org/mailman/listinfo/python-list

Re: Database Access using pyodbc. I've a problem

2007-06-16 Thread fumanchu
On Jun 16, 5:35 am, Rajendran <[EMAIL PROTECTED]> wrote: > Hi all, > > I've installed pyodbc module to access my database (MS Access). I've > setup a User level DSN to the database.mdb file. When I run my python > code in the command prompt it is retrieving the database contents and > displaying it

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Cousin Stanley
> Steven D'Aprano <[EMAIL PROTECTED]> wrote: >... >> > perception that, at their roots, Scheme, C and Python share one >> > philosophical underpinning (one that's extremely rare among programming >> > languages as a whole) -- an appreciation of SIMPLICITY AND UNIFORMITY as >> > language chara

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Neil Cerutti
On 2007-06-16, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 15 Jun 2007 22:25:38 -0700, Alex Martelli wrote: >> The "Spirit of C" section in the preface of the ISO Standard >> for C phrases this principle as "Provide only one way to do an >> operation". > > Taken seriously, that rapidly goe

Re: Priority Queue with Mutable Elements

2007-06-16 Thread Chris Lasher
On Jun 15, 5:52 pm, Josiah Carlson <[EMAIL PROTECTED]> wrote: > See this implementation of a "pair heap": >http://mail.python.org/pipermail/python-dev/2006-November/069845.html > ...which offers the ability to update the 'priority' of an entry in the > heap. It requires that the 'value' in (pr

Re: Do U have anything to share with this students

2007-06-16 Thread Josh Hill
On Sat, 16 Jun 2007 13:06:23 -, Milt <[EMAIL PROTECTED]> wrote: >On Jun 15, 1:00?pm, [EMAIL PROTECTED] wrote: >> This is a network of students. Find the people of your kind there >> >> http://tinyurl.com/33uvla >> >> Click and register to access millions of students. > >Your link doesn't work.

Inserting breakpoints ...

2007-06-16 Thread Stef Mientki
hello, for the simulation of some micro language (JAL), the original language is (with a minimal effort) translated into Python, after which the code is run in Python. I want to add a call to a debug routine, called JSM(linenr), which performs task like wait, update user feedback, etc. Now I can

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... > > perception that, at their roots, Scheme, C and Python share one > > philosophical underpinning (one that's extremely rare among programming > > languages as a whole) -- an appreciation of SIMPLICITY AND UNIFORMITY as > > language characteristics

Re: Do U have anything to share with this students

2007-06-16 Thread Milt
On Jun 15, 1:00?pm, [EMAIL PROTECTED] wrote: > This is a network of students. Find the people of your kind there > > http://tinyurl.com/33uvla > > Click and register to access millions of students. Your link doesn't work. -- http://mail.python.org/mailman/listinfo/python-list

Database Access using pyodbc. I've a problem

2007-06-16 Thread Rajendran
Hi all, I've installed pyodbc module to access my database (MS Access). I've setup a User level DSN to the database.mdb file. When I run my python code in the command prompt it is retrieving the database contents and displaying it (HTML output). But when I run that python from webserver (http://lo

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-16 Thread Steven D'Aprano
On Fri, 15 Jun 2007 22:25:38 -0700, Alex Martelli wrote: > The "Spirit of C" section in the preface of the ISO Standard for C > phrases this principle as "Provide only one way to do an operation". Taken seriously, that rapidly goes to absurdity -- it would mean, for example, replacing all for loo

Re: Installing manpage in setup.py

2007-06-16 Thread Thomas Jollans
Papalagi Pakeha wrote: > Hi all, > > how can I tell setup() in distutils' setup.py to install manual pages > of my program? I.e. prgclient.1 to /.../man/man1 and prgdaemon.8 to > /.../man/man8? The problem is that those /.../ directories may be > different on every system, for instance /usr/share/

Installing manpage in setup.py

2007-06-16 Thread Papalagi Pakeha
Hi all, how can I tell setup() in distutils' setup.py to install manual pages of my program? I.e. prgclient.1 to /.../man/man1 and prgdaemon.8 to /.../man/man8? The problem is that those /.../ directories may be different on every system, for instance /usr/share/man on OpenSUSE and /usr/man on Sol

retrieve / find out an image's dimensions

2007-06-16 Thread Adam Teale
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this: http://www.pythonware.com/library/pil/handbook/introduction.htm but it looks like it is something I will need to install - I'd like to be able to pass

Re: Subprocess Not Working on Solaris

2007-06-16 Thread Martin v. Löwis
> Python 2.5.1 (r251:54863, Jun 13 2007, 13:40:52) > [GCC 3.2.3] on sunos5 > Type "help", "copyright", "credits" or "license" for more information. import subprocess > Traceback (most recent call last): > File "", line 1, in > File "/usr/local/lib/python2.5/subprocess.py", line 401, in >

Re: Looking for a wxPython GUI builder

2007-06-16 Thread Uwe Grauer
Jens Thiede wrote: > On Jun 16, 3:18 am, Dick Moores <[EMAIL PROTECTED]> wrote: >> How about SPE? >> >> Any others? >> >> And which ones do people >> actually use? Commercial or Freeware. >> >> Thanks, >> >> Dick Moores > > There's Boa Constructor... (http://boa-constructor.sourceforge.net/ > Scre

Re: a_list.count(a_callable) ?

2007-06-16 Thread Ping
On 6 16 , 2 06 , "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: > > Maybe you could extend count() analogous to how sort() works: > > # L is a list of Person objects, each Person has a name attribute > L.sort(key = attrgetter("name")) > > # How many olle are there? > print L.count("olle", key = att

Output of html parsing

2007-06-16 Thread Jackie Wang
Hi, all, I want to get the information of the professors (name,title) from the following link: "http://www.economics.utoronto.ca/index.php/index/person/faculty/"; Ideally, I'd like to have a output file where each line is one Prof, including his name and title. In practice, I us

Re: Should: "for k,v in **dictionary_instance" work?

2007-06-16 Thread irstas
On Jun 16, 5:27 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Currently, *t and **d are syntax errors outside of function calls and > definitions. (Any other places?) But if they were allowed, what would they > mean? Actually since you asked, I had to try this out x = range(10) a, *b = x I wo

Re: IndentationError: unexpected indent

2007-06-16 Thread Wim Vogelaar
> How is he supposed to run MS notepad on X11? :) > I am saying MS notepad, but any software (running on Linux) showing you clearly the tabs will help. It would also be very convenient when python would deal with tabs in a human friendly way. Wim Vogelaar, http://home.wanadoo.nl/w.h.vogelaar/

Re: IndentationError: unexpected indent

2007-06-16 Thread Wim Vogelaar
> Note: for your indentation problem, try to use an editor allowing to > display tab and spaces and then identify the problem location, or replace > all tabs by 4 spaces and configure the editor to only use spaces. It would be very helpful when Python would warn you when there are tabs in your