[Germany / München] Munich Python User Grou p Meeting this thursday!

2010-06-22 Thread Stefan Behnel
Hi, sorry for choosing this forum for a regional announcement - just hoping to attract some local users who don't read the local mailing list. After a while of silence, there will be a meeting of the µPy (Münchner Python User Group) this thursday (June 24th). See here for further informatio

Re: "isinstance" question

2010-06-22 Thread Satish Eerpini
> >I want to test whether an object is an instance of any user-defined >> class. "isinstance" is less helpful than one would expect. >> >> >>> import types >> >>> class foo() : # define dummy class >> ... pass >> ... >> >>> x = foo() >> >>> >> >>> type(x) >> >> >>> >> >>> isinstanc

Re: Using Unicode file names with ftplib and encodings.idna as a workaround?

2010-06-22 Thread Gabriel Genellina
En Tue, 22 Jun 2010 11:43:34 -0300, escribió: Python 2.6.5 (Win32): Is there a work around for ftplib's (and ftputil's) apparent inability to support Unicode file names? I'm thinking that I might be able to use the encodings.idna as a work around for this? According to RFC 2640, you should u

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Stephen Hansen
On 6/22/10 10:39 PM, Dennis Lee Bieber wrote: > On Tue, 22 Jun 2010 15:55:51 -0700, Stephen Hansen > declaimed the following in > gmane.comp.python.general: > >> I second Forth. Learning and using that was -- slightly painful, but > > Just pick up any advanced HP programmable calculator...

Re: Strange factory pattern

2010-06-22 Thread Gabriel Genellina
En Tue, 22 Jun 2010 23:33:55 -0300, Zac Burns escribió: In the threading module there are several code bits following this convention: ### def Class(*args, **kwargs): return _Class(*args, **kwargs) class _Class(... ### This is true for Event, RLock, and others. Why do this? It seems to

Re: Book review / advise

2010-06-22 Thread Stephen Hansen
On 6/22/10 9:48 PM, John Bokma wrote: > alex23 writes: >> Given the current propensity for people to scrape web sites like >> Wikipedia and publish them on Amazon without the rights holders' >> consent, > > Can you explain were exactly it states that you can't print a book out > of wikipedia arti

Re: "isinstance" question

2010-06-22 Thread Gabriel Genellina
En Tue, 22 Jun 2010 23:45:07 -0300, John Nagle escribió: I want to test whether an object is an instance of any user-defined class. "isinstance" is less helpful than one would expect. >>> import types >>> class foo() : # define dummy class ... pass ... >>> x = foo() >>> >>> type

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread David Cournapeau
On Tue, Jun 22, 2010 at 5:58 PM, Josef Tupag wrote: > I've been programming (when I do program) mainly in Perl for the last 10 > years or so. But I've been itching to learn a new language for a while now, > and the two near the top of the list are Ruby and Python. > > I figure that Ruby would be e

Re: Book review / advise

2010-06-22 Thread John Bokma
alex23 writes: > John Bokma wrote: >> Now let's hope that your asshat behaviour doesn't stop companies like >> this to continue to print those books. I have considered to buy the >> complete set a few times. And I hope you're not calling me naive... > > Given the current propensity for people to

Re: Book review / advise

2010-06-22 Thread John Bokma
Stephen Hansen writes: > I *have* seen people burned by confusion over situations *extremely* > similar to this; But is it? You didn't even ask yourself that question. > If being concerned about fellow Python-folks possibly getting ripped off > makes me an asshat, so be it. Go y'know-what yours

P= /V:P == 2P*V because fist '/V' is actually '/' divided by 'V'comp.language.python.brood of vipers! Look! I got it, Gus! I got it! Look: P= /V:P == 2P*V because fist '/V' is actually '/' div

2010-06-22 Thread sci.math
I got it, Gus! I got it! Look: P= /V:P == 2P*V because fist '/V' is actually '/' divided by 'V' P= /V:P == 2P*V because fist '/V' is actually '/' divided by 'V' P= /V:P == 2P*V because fist '/V' is actually '/' divided by 'V' P= /V:P == 2P*V because fist '/V' is actually '/' divided by

Re: "isinstance" question

2010-06-22 Thread John Nagle
On 6/22/2010 8:13 PM, Ben Finney wrote: John Nagle writes: I want to test whether an object is an instance of any user-defined class. "isinstance" is less helpful than one would expect. Right. The type hierarchy is now unified; there's essentially no difference in later Python versions b

Jew JUDGE shows off JEW POWER by BULLYING and BLACKMAILING a BLACK PRESIDENT OBAMA

2010-06-22 Thread small Pox
Jew Judges NEVER came out against the CRIMES of BUSH and CHENEY and LARRYS I L V E RS T E I N - The main player in 911 Jews are coming out from the directions of Corporations, Mafias, Legislators, and now Judge to SUBVERT the UNITED STATES. Please listen to the Speech of Mr Benjamin H

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread rantingrick
On Jun 22, 9:31 pm, MRAB wrote: > [snip] > Napoleon once said "Never interrupt your enemy when he is making a > mistake."! :-) And how exactly does your example express itself in a more "syntactically-correct" "linear-flow" than the two code snippets i provided earlier, hmmm? PS: Oh yes i do kn

Re: Strange factory pattern

2010-06-22 Thread Gerry Reno
This looks like a public class exposing an implementation private class.Jun 22, 2010 10:39:05 PM, zac...@gmail.com wrote:In the threading module there are several code bits following this convention:###def Class(*args, **kwargs):    return _Class(*args, **kwargs)class _Class(...###This is true for

Re: "isinstance" question

2010-06-22 Thread Ben Finney
John Nagle writes: > I want to test whether an object is an instance of any user-defined > class. "isinstance" is less helpful than one would expect. Right. The type hierarchy is now unified; there's essentially no difference in later Python versions between user-defined types and built-in ty

"isinstance" question

2010-06-22 Thread John Nagle
I want to test whether an object is an instance of any user-defined class. "isinstance" is less helpful than one would expect. >>> import types >>> class foo() : # define dummy class ... pass ... >>> x = foo() >>> >>> type(x) >>> >>> isinstance(x, types.ClassType) False >>> isinstance(x,

Strange factory pattern

2010-06-22 Thread Zac Burns
In the threading module there are several code bits following this convention: ### def Class(*args, **kwargs): return _Class(*args, **kwargs) class _Class(... ### This is true for Event, RLock, and others. Why do this? It seems to violate the rule of least astonishment (isinstance(Event(),

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread MRAB
rantingrick wrote: On Jun 22, 7:56 pm, Gregory Ewing wrote: Thomas Jollans wrote: "Everything is an object" in both languages, or so they say. That's really a meaningless statement, because it depends on what you count as a "thing". But there is at least one thing that is an object in Python

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread rantingrick
On Jun 22, 7:56 pm, Gregory Ewing wrote: > Thomas Jollans wrote: > > "Everything is an object" in both languages, or so they say. > > That's really a meaningless statement, because it depends on > what you count as a "thing". But there is at least one thing > that is an object in Python but not in

Re: Changing the Emacs engine to Guile

2010-06-22 Thread nanothermite911fbibustards
Very EDUCATIONAL VIDEO http://www.youtube.com/watch?v=wzr_hRsSuGM&feature=related On Jun 22, 1:40 pm, Cecil Westerhof wrote: > Op dinsdag 22 jun 2010 19:28 CEST schreef Pascal J. Bourguignon: > > > > >>> this (while (re-search-forward ...)) loop modifies the line for each > >>> occurence of the r

Re: Book review / advise

2010-06-22 Thread Stephen Hansen
On 6/22/10 1:09 PM, John Bokma wrote: > Now let's hope that your asshat behaviour doesn't stop companies like > this to continue to print those books. I have considered to buy the > complete set a few times. And I hope you're not calling me naive... Excuse me? I *have* seen people burned by confu

Re: Why 'open' is not a function according to inspect module?

2010-06-22 Thread Mel
Peng Yu wrote: > Hi, > > 'open' is not a function according to inspect module. But according to > help(open), it is a function. Is there something wrong with inspect > module? > > $ cat main.py > #!/usr/bin/env python > > import inspect > > def hello(): > print "Hello World!" > return > >

Re: TkInter bind() event is not firing event trigger

2010-06-22 Thread rantingrick
On Jun 22, 7:39 pm, MRAB wrote: > http://www.pythonware.com/library/tkinter/introduction/events-and-bin... > > it's ''. Yes and i vehemently hate these names! Just hideous if you ask me. @ Anthony Also be sure to use an "event name" for an event function/method and use the docstring to describe

Re: Book review / advise

2010-06-22 Thread alex23
John Bokma wrote: > Now let's hope that your asshat behaviour doesn't stop companies like > this to continue to print those books. I have considered to buy the > complete set a few times. And I hope you're not calling me naive... Given the current propensity for people to scrape web sites like Wi

Re: TkInter bind() event is not firing event trigger

2010-06-22 Thread rantingrick
On Jun 22, 7:21 pm, Anthony Papillion wrote: > I've also removed the (event) parameter just in case and tried it and > it makes no difference. What am I doing wrong here? Well don't remove the event parameter because Tkinter will pass it every time since this is an EVENT! Here is some code to pl

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Gregory Ewing
Thomas Jollans wrote: "Everything is an object" in both languages, or so they say. That's really a meaningless statement, because it depends on what you count as a "thing". But there is at least one thing that is an object in Python but not in Ruby. There are no stand-alone functions in Ruby,

Re: TkInter bind() event is not firing event trigger

2010-06-22 Thread MRAB
Anthony Papillion wrote: So I want to execute some code when the user double clicks an item in a ListBox. The documentation says I should use the listbox.bind() method, specifying the Double-l event to detect the double left mouse button click. My code is this: gsItems = Listbox(root, width=76,

TkInter bind() event is not firing event trigger

2010-06-22 Thread Anthony Papillion
So I want to execute some code when the user double clicks an item in a ListBox. The documentation says I should use the listbox.bind() method, specifying the Double-l event to detect the double left mouse button click. My code is this: gsItems = Listbox(root, width=76, height=30, selectmode="brow

Re: Uses of a deprecated module 'string'

2010-06-22 Thread Stephen Hansen
On 6/22/10 4:53 PM, rantingrick wrote: > On Jun 22, 4:37 pm, Thomas Jollans wrote: >> Looks like `letters' has been renamed to `ascii_letters'. > > > ASCII rubutted: > Really it's more like "asc-bye-bye_letters". They keep shoving me > more and more under the carpet! And that big fat glory hog

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Emile van Sebille
On 6/22/2010 4:09 PM rantingrick said... ...After reading these comments i reminisce back to a time when a good friend of this community "r" said basically the same things but was lynched for them.Hmm? Has the community changed? Or is it that these comments came from someone other than "r" that

Re: Uses of a deprecated module 'string'

2010-06-22 Thread rantingrick
On Jun 22, 4:37 pm, Thomas Jollans wrote: > Looks like `letters' has been renamed to `ascii_letters'. ASCII rubutted: Really it's more like "asc-bye-bye_letters". They keep shoving me more and more under the carpet! And that big fat glory hog Unicode is really stating to get on my nerves!" Just

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Thomas Jollans
On 06/23/2010 01:30 AM, Stephen Hansen wrote: > On 6/22/10 4:09 PM, rantingrick wrote: >> ...After reading these comments i reminisce back to a time when a good >> friend of this community "r" said basically the same things but was >> lynched for them. Hmm? Has the community changed? Or is it that

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Stephen Hansen
On 6/22/10 4:09 PM, rantingrick wrote: > ...After reading these comments i reminisce back to a time when a good > friend of this community "r" said basically the same things but was > lynched for them. Hmm? Has the community changed? Or is it that these > comments came from someone other than "r" t

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Rhodri James
On Wed, 23 Jun 2010 00:09:15 +0100, rantingrick wrote: ...After reading these comments i reminisce back to a time when a good friend of this community "r" said basically the same things but was lynched for them. Hmm? Has the community changed? Or is it that these comments came from someone ot

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread rantingrick
Quotes for this thread... On Jun 22, 4:20 am, James Mills wrote: > I find Ruby (compared to Python) to be a syntactical rip-off and > a bad one at that. Some things in Ruby aren't nearly as simple or > as concise as you would find in Python. --- On Jun 22, 4:29 am, Jean-Michel Pichavant wrote

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread John Bokma
geremy condra writes: > On Tue, Jun 22, 2010 at 1:58 AM, Josef Tupag wrote: >> I've been programming (when I do program) mainly in Perl for the last 10 >> years or so. But I've been itching to learn a new language for a while now, >> and the two near the top of the list are Ruby and Python. > >

Re: Where is the help function defined?

2010-06-22 Thread Trent Mick
On 10-06-21 10:57 AM, Emile van Sebille wrote: On 6/21/2010 10:17 AM Peng Yu said... help(help) gives me the following explanation. I then looked at pydoc site. But I don't see an entry on help(). How to figure out where help() (or a function in general) is defined? ActivePython 2.4.1 Bui

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Stephen Hansen
On 6/22/10 3:35 PM, geremy condra wrote: > On Tue, Jun 22, 2010 at 1:58 AM, Josef Tupag wrote: >> I've been programming (when I do program) mainly in Perl for the last 10 >> years or so. But I've been itching to learn a new language for a while now, >> and the two near the top of the list are Ruby

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread geremy condra
On Tue, Jun 22, 2010 at 1:58 AM, Josef Tupag wrote: > I've been programming (when I do program) mainly in Perl for the last 10 > years or so. But I've been itching to learn a new language for a while now, > and the two near the top of the list are Ruby and Python. My advice is to learn something

Re: From Dict to Classes yes or no and how

2010-06-22 Thread Andreas Waldenburger
On Tue, 22 Jun 2010 13:56:43 +0200 (CEST) "Jerry Rocteur" wrote: > As part of learning Python, I'm also learning OOP! That is why I want > to know if this is doable using classes. Everything[1] is doable using classes. The question is: Do you *need* to do it with classes? If your problem is best

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Andreas Waldenburger
On Tue, 22 Jun 2010 10:49:49 -0400 "D'Arcy J.M. Cain" wrote: > Python is executible pseudocode. > I don't know about you, but if I didn't know this to be praise, it'd sound like an insult to me. As in "Timecube is expendable pseudoscience". Phrases like "Your mother [has property x]" have the

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Andreas Waldenburger
On Tue, 22 Jun 2010 19:38:43 +1000 James Mills wrote: > When I came across Rub* I found it to be just a rip-off of Python (in > some respects) and couldn't understand how it became popular so > quickly :) You answered your own question: It's a rip-off of Python. On a more serious note, though,

Re: Uses of a deprecated module 'string'

2010-06-22 Thread Thomas Jollans
On 06/22/2010 11:11 PM, Steven Howe wrote: > Hi, I'm trying to import 'letters' from the string module. > I get the following message: > > Uses of a deprecated module 'string' > > I realize the functionality of 'string' is now in the _builtin_. But are > the > constants. If so, what are they

Re: mysql query results to web page

2010-06-22 Thread Aaron Watters
On Jun 22, 4:50 pm, Greg wrote: > I'd like to query my local MySQL db and send the results to a locally > served web page.  I've poked around and found complex examples using > web2py and pylons What's best for beginners?  Can somebody lay out > the basic steps for me? > > thanks, > > Greg Yo

Re: Uses of a deprecated module 'string'

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 7:11 AM, Steven Howe wrote: > Hi, I'm trying to import 'letters' from the string module. > I get the following message: > >    Uses of a deprecated module 'string' > > I realize the functionality of 'string' is now in the _builtin_. But are the > constants. If so, what are

Uses of a deprecated module 'string'

2010-06-22 Thread Steven Howe
Hi, I'm trying to import 'letters' from the string module. I get the following message: Uses of a deprecated module 'string' I realize the functionality of 'string' is now in the _builtin_. But are the constants. If so, what are they called. I tried 'letters', but got: NameError: name '

mysql query results to web page

2010-06-22 Thread Greg
I'd like to query my local MySQL db and send the results to a locally served web page. I've poked around and found complex examples using web2py and pylons What's best for beginners? Can somebody lay out the basic steps for me? thanks, Greg -- http://mail.python.org/mailman/listinfo/python

Re: Information about PHP + MySQL E-book

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 6:10 AM, John Bokma wrote: > My guess is that this is just spam for a blog. Please don't copy > spamvertized URLs. My bad :/ -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Information about PHP + MySQL E-book

2010-06-22 Thread John Bokma
James Mills writes: > On Wed, Jun 23, 2010 at 2:15 AM, J3p wrote: >> Hi, I need some Information from you. Someone told me to buy E-book >> about PHP + MySQL in >> http:// >> Does anyone have experience about this? > > This has nothing whatsoever to do with Python > except that Python has MySQL

Re: Book review / advise

2010-06-22 Thread John Bokma
Stephen Hansen writes: > On 6/22/10 6:48 AM, lallous wrote: >> Hello, >> >> I wonder if anyone read this: >> http://www.amazon.com/PYTHON-2-6-Extending-Embedding-documentation/dp/1441419608/ref=sr_1_7?ie=UTF8&s=books&qid=1277214352&sr=1-7 >> or this: >> http://www.amazon.com/Python-Extending-Emb

conceptual model diagram builder

2010-06-22 Thread Aaron Watters
Hi folks. I design a lot of conceptual models and I usually do it on paper or on a white board. I sometimes need to send an image of a conceptual model (not a photo) and I really don't know of a good tool which works the way I'd like to make images of conceptual models. Particularly I'd like the

Python-URL! - weekly Python news and links (Jun 22)

2010-06-22 Thread Cameron Laird
QOTW: "It's hard to overestimate the variance you'll see when you start asking your users for information." - Cody Powell http://www.codypowell.com/taods/2010/01/production-aint-pretty-a-case-for-excessive-application-logging.html The second Release Candidate of Python 2.7 is available fo

Re: print line number and source filename

2010-06-22 Thread Stephen Hansen
On 6/22/10 10:26 AM, Shashwat Anand wrote: > begin - > import logging > logging.basicConfig(level=logging.DEBUG,format="%(asctime)s" > "%(levelname)-5.5s [%(name)s %(module)s:%(funcName)s:%(lineno)d]" > "%(message)s") > > def run(): >x = 5 >logging.debug("X = %d" % x) > > run() >

Re: Why 'open' is not a function according to inspect module?

2010-06-22 Thread Terry Reedy
On 6/22/2010 11:42 AM, Peng Yu wrote: 'open' is not a function according to inspect module. If you want to *learn* Python, perhaps you should ignore the inspect module. It is for advanced purposes. I only used it a couple of times in 13 years. If you want to know what something literally i

*** Proof - JEWS - the Enslavers of the Blacks ***

2010-06-22 Thread nanothermite911fbibustards
http://www.youtube.com/watch?v=kTn-w3xjprg&feature=related watch this Israel's deadly attack on USS Liberty emerges from the past http://www.youtube.com/watch?v=f98jxoUUrzg&feature=fvsr http://www.youtube.com/watch?v=52fm6zAHa-w http://www.youtube.com/watch?v=qL9hGmfGTXc The Secret Relationshi

Re: Book review / advise

2010-06-22 Thread Stephen Hansen
On 6/22/10 11:01 AM, Terry Reedy wrote: > On 6/22/2010 11:49 AM, Stephen Hansen wrote: >> Uhh, that looks like a scam. Someone scraped the Python docs and bundled >> it up as a "book" to sell to naive people for outrageous prices; > > Various people have asked on this list for printed versions of

Re: Book review / advise

2010-06-22 Thread Terry Reedy
On 6/22/2010 11:49 AM, Stephen Hansen wrote: On 6/22/10 6:48 AM, lallous wrote: Hello, I wonder if anyone read this: http://www.amazon.com/PYTHON-2-6-Extending-Embedding-documentation/dp/1441419608/ref=sr_1_7?ie=UTF8&s=books&qid=1277214352&sr=1-7 or this: http://www.amazon.com/Python-Extending-

Re: print line number and source filename

2010-06-22 Thread Shashwat Anand
begin - import logging logging.basicConfig(level=logging.DEBUG,format="%(asctime)s" "%(levelname)-5.5s [%(name)s %(module)s:%(funcName)s:%(lineno)d]" "%(message)s") def run(): x = 5 logging.debug("X = %d" % x) run() - end - You can probably use string default concatenation

Re: print line number and source filename

2010-06-22 Thread Shashwat Anand
you can use __file__ On Tue, Jun 22, 2010 at 10:14 PM, Peng Yu wrote: > I want to print filename and line number for debugging purpose. So far > I only find how to print the line number but not how to print > filename. > > import inspect > print inspect.currentframe().f_lineno > > I found inspec

Re: adding new function

2010-06-22 Thread Terry Reedy
On 6/22/2010 5:44 AM, Daniel Fetchinson wrote: how can i simply add new functions to module after its initialization (Py_InitModule())? I'm missing something like PyModule_AddCFunction(). in Python, for modules written in python import mymod mymod.fname = somefunc #or setattr(mymod, namestrin

Re: print line number and source filename

2010-06-22 Thread Stephen Hansen
On 6/22/10 9:44 AM, Peng Yu wrote: > Also, always importing the inspect module and getting the frame and > accessing the lineno from the frame is not very convenient to type. Is > there a shorter way to access the line number (for example, in C++ and > perl, __LINE__ can be used to access line numb

Re: print line number and source filename

2010-06-22 Thread Shashwat Anand
22:26:51 l0nwlf-MBP:~/Desktop$ cat test.py print __file__ 22:26:55 l0nwlf-MBP:~/Desktop$ python test.py test.py On Tue, Jun 22, 2010 at 10:26 PM, Shashwat Anand wrote: > you can use __file__ > > > On Tue, Jun 22, 2010 at 10:14 PM, Peng Yu wrote: > >> I want to print filename and line number fo

print line number and source filename

2010-06-22 Thread Peng Yu
I want to print filename and line number for debugging purpose. So far I only find how to print the line number but not how to print filename. import inspect print inspect.currentframe().f_lineno I found inspect.getsourcefile(), but I have to supply a class name to it. I have searched online, but

Re: Information about PHP + MySQL E-book

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 2:15 AM, J3p wrote: > Hi, I need some Information from you. Someone told me to buy E-book > about PHP + MySQL in > http://php-mysql-ebook.blogspot.com > Does anyone have experience about this? This has nothing whatsoever to do with Python except that Python has MySQL drive

Information about PHP + MySQL E-book

2010-06-22 Thread J3p
Hi, I need some Information from you. Someone told me to buy E-book about PHP + MySQL in http://php-mysql-ebook.blogspot.com Does anyone have experience about this? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why inspect.getsource() can not getsource for a class?

2010-06-22 Thread Ian Kelly
On Tue, Jun 22, 2010 at 9:53 AM, Peng Yu wrote: > Hi, > > It seems I don't completely understand how getsource works, as I > expect that I should get the source code of class A. But I don't. > Would you please let me know what I am wrong? > > $ cat main.py > #!/usr/bin/env python > > import inspec

Re: Why inspect.getsource() can not getsource for a class?

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 1:53 AM, Peng Yu wrote: > It seems I don't completely understand how getsource works, as I > expect that I should get the source code of class A. But I don't. > Would you please let me know what I am wrong? If you "read" the documentation carefully: """ getsource(objec

Re: Why 'open' is not a function according to inspect module?

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 1:42 AM, Peng Yu wrote: > 'open' is not a function according to inspect module. But according to > help(open), it is a function. Is there something wrong with inspect > module? $ python Python 2.6.5 (r265:79063, Jun 13 2010, 14:03:16) [GCC 4.4.4 (CRUX)] on linux2 Type "hel

Re: Why 'open' is not a function according to inspect module?

2010-06-22 Thread Ian Kelly
On Tue, Jun 22, 2010 at 9:42 AM, Peng Yu wrote: > Hi, > > 'open' is not a function according to inspect module. But according to > help(open), it is a function. Is there something wrong with inspect > module? > > $ cat main.py > #!/usr/bin/env python > > import inspect > > def hello(): >  print "H

Why inspect.getsource() can not getsource for a class?

2010-06-22 Thread Peng Yu
Hi, It seems I don't completely understand how getsource works, as I expect that I should get the source code of class A. But I don't. Would you please let me know what I am wrong? $ cat main.py #!/usr/bin/env python import inspect class A: pass a=A() print inspect.getsource(a) $ ./main.py

Re: Book review / advise

2010-06-22 Thread Stephen Hansen
On 6/22/10 6:48 AM, lallous wrote: > Hello, > > I wonder if anyone read this: > http://www.amazon.com/PYTHON-2-6-Extending-Embedding-documentation/dp/1441419608/ref=sr_1_7?ie=UTF8&s=books&qid=1277214352&sr=1-7 > or this: > http://www.amazon.com/Python-Extending-Embedding-Documentation-Manual/dp/14

Why 'open' is not a function according to inspect module?

2010-06-22 Thread Peng Yu
Hi, 'open' is not a function according to inspect module. But according to help(open), it is a function. Is there something wrong with inspect module? $ cat main.py #!/usr/bin/env python import inspect def hello(): print "Hello World!" return print inspect.isfunction(str) print inspect.isf

Re: Simple list problem that's defeating me!

2010-06-22 Thread Bruno Desthuilliers
Neil Webster a écrit : Hi all, I've got a simple problem but it's defeated me and I was wondering if somebody could point out where I'm going wrong 1/ not posting working code (got a NameError) 2/ not posting the expected output 3/ not posting the actual output or offer an alternative soluti

Re: Book review / advise

2010-06-22 Thread lallous
On Jun 22, 4:49 pm, James Mills wrote: > On Wed, Jun 23, 2010 at 12:27 AM, lallous wrote: > > For me it is not a matter of competency to seek a book: organized, > > structured and uniform way of presenting information. > > > Nonetheless, I always refer to the sources to get my questions > > answe

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread D'Arcy J.M. Cain
On Tue, 22 Jun 2010 03:02:15 -0700 (PDT) lkcl wrote: > so whilst ruby may be dynamic and compact, it's not beautiful, > readable or obvious as to what's going on. i look at a python > program, and it uses actual... like... y'know... words that make Python is executible pseudocode. -- D'Arcy J

Re: Book review / advise

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:27 AM, lallous wrote: > For me it is not a matter of competency to seek a book: organized, > structured and uniform way of presenting information. > > Nonetheless, I always refer to the sources to get my questions > answered...but a book (with the qualities I mentioned a

Using Unicode file names with ftplib and encodings.idna as a workaround?

2010-06-22 Thread python
Python 2.6.5 (Win32): Is there a work around for ftplib's (and ftputil's) apparent inability to support Unicode file names? I'm thinking that I might be able to use the encodings.idna as a work around for this? In other words, regardless of whether I'm getting or putting a file to the server, I w

Re: Book review / advise

2010-06-22 Thread Tim Golden
On 22/06/2010 15:27, lallous wrote: Hi James, For me it is not a matter of competency to seek a book: organized, structured and uniform way of presenting information. Nonetheless, I always refer to the sources to get my questions answered...but a book (with the qualities I mentioned above) woul

Re: Simple list problem that's defeating me!

2010-06-22 Thread Mark Lawrence
On 22/06/2010 15:06, Neil Webster wrote: Hi all, I've got a simple problem but it's defeated me and I was wondering if somebody could point out where I'm going wrong or offer an alternative solution to the problem? I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]. I need to c

Google Adsense Account Approval With In 4 Hours

2010-06-22 Thread tapaas
Google adsense account with in 4 hours. Send your name,address and phone number to "earnmoney9...@gmail.com". I will give ur account with in 4hrs. secure and Safe Account Approval , approved directly by adsense team. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple list problem that's defeating me!

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:06 AM, Neil Webster wrote: > I've got a simple problem but it's defeated me and I was wondering if > somebody could point out where I'm going wrong or offer an alternative > solution to the problem? Is this a hypothetical/mathematical problem of sorts ? If so, do you ha

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Stephen Hansen
On 6/22/10 4:51 AM, James Mills wrote: > On Tue, Jun 22, 2010 at 9:37 PM, Nathan Rice > wrote: >> As far as community support, Python has 4342 packages listed in sourceforge, >> Ruby has 705. Python is listed in ~0.4% of jobs at indeed.com's trend > > You are forgetting the 10278 (last count) or

Re: Book review / advise

2010-06-22 Thread lallous
Hi James, For me it is not a matter of competency to seek a book: organized, structured and uniform way of presenting information. Nonetheless, I always refer to the sources to get my questions answered...but a book (with the qualities I mentioned above) would make everyone's life easier. :) On

Re: Simple list problem that's defeating me!

2010-06-22 Thread Xavier Ho
On 23 June 2010 00:06, Neil Webster wrote: > Hi all, > > I've got a simple problem but it's defeated me and I was wondering if > somebody could point out where I'm going wrong or offer an alternative > solution to the problem? > > I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]

Re: Book review / advise

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:14 AM, lallous wrote: > Well, it seems the printed version of the manual. Can anyone suggest a > nice book to learn more about the Python C Api? It's not really a book, but how about the source ? If you're a competent C programmer you're not really going to even need a

Re: Book review / advise

2010-06-22 Thread lallous
Hi again, Well, it seems the printed version of the manual. Can anyone suggest a nice book to learn more about the Python C Api? Thanks, Elias -- http://mail.python.org/mailman/listinfo/python-list

Simple list problem that's defeating me!

2010-06-22 Thread Neil Webster
Hi all, I've got a simple problem but it's defeated me and I was wondering if somebody could point out where I'm going wrong or offer an alternative solution to the problem? I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]. I need to combine the two lists that have the same fir

encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna' )

2010-06-22 Thread python
Python 2.6.4 (Win32): Anyone have any explanation for the following encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna' ) Given that other processes may have to use the output of these methods, what is the recommended technique? Demonstration: >>> import encodings.idna >>> name =

Book review / advise

2010-06-22 Thread lallous
Hello, I wonder if anyone read this: http://www.amazon.com/PYTHON-2-6-Extending-Embedding-documentation/dp/1441419608/ref=sr_1_7?ie=UTF8&s=books&qid=1277214352&sr=1-7 or this: http://www.amazon.com/Python-Extending-Embedding-Documentation-Manual/dp/1441412743/ref=pd_sim_b_3 Are these books just a

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread Dave Angel
Jerry Rocteur wrote: On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: If you were able to ask us perhaps a more specific question and describe your problem a little more concisely perhaps I (and we) might have a bit more to offer you. I have a dictionary: users[key] = {'user'

xmlrpclib and errcode -1

2010-06-22 Thread Pasi Oja-Nisula
I have a xmlrpc server and client running on same Windows computer. The server is part of a bigger program and client is a Cherrypy application that provides a http interface to this program. Problem is that sometimes (1 out of 100) I get xmlrpc ProtocolError without no apparent reason. The server

Re: From Dict to Classes yes or no and how

2010-06-22 Thread Jean-Michel Pichavant
Jerry Rocteur wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/22/2010 01:32 PM, Jerry Rocteur wrote: My input is NOT CSV, I used this format to try and make the question shorter. Although I could create a CSV file, I'd like to learn how to code a class to work the way I describ

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread Andre Alexander Bell
On 06/22/2010 02:03 PM, Jerry Rocteur wrote: >> On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: >> If you were able to ask us perhaps a more specific question >> and describe your problem a little more concisely perhaps >> I (and we) might have a bit more to offer you. > > I have a dictiona

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 10:03 PM, Jerry Rocteur wrote: >> On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: >> If you were able to ask us perhaps a more specific question >> and describe your problem a little more concisely perhaps >> I (and we) might have a bit more to offer you. > > I have

Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread Jerry Rocteur
> On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: > If you were able to ask us perhaps a more specific question > and describe your problem a little more concisely perhaps > I (and we) might have a bit more to offer you. I have a dictionary: users[key] = {'user': key,

Re: From Dict to Classes yes or no and how

2010-06-22 Thread Bruno Desthuilliers
Jerry Rocteur a écrit : (snip) As part of learning Python, I'm also learning OOP! That is why I want to know if this is doable using classes. > The input is not important, I end up with the dictionary as described in the question and as I asked in the question, I'd like to access the dictiona

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 10:03 PM, Jerry Rocteur wrote: > How do I iterate through and access an individual user record! A much better question! :) You are in fact already demonstrating that you know full well how to access a specific user record - by accessing a parent dictionary holding a mappi

Re: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 9:56 PM, Jerry Rocteur wrote: > As part of learning Python, I'm also learning OOP! That is why I want to know > if this is doable using classes. > > The input is not important, I end up with the dictionary as described in the > question and as I asked in the question, > I

Re: Serialization, save type information in file and restore them

2010-06-22 Thread Gabriel Genellina
En Fri, 18 Jun 2010 08:24:01 -0300, Timothy Wu <2hug...@gmail.com> escribió: I created a class that's able to manipulate tabulated data. I want to be able to dump the bulk of the data and other attributes as a tab-delimited text. I have trouble saving/restoring type information in the file. Fo

  1   2   >