Re: type, object hierarchy?

2008-02-04 Thread Eduardo O. Padoan
On Feb 4, 2008 1:36 AM, 7stud [EMAIL PROTECTED] wrote: print dir(type) #__mro__ attribute is in here print dir(object) #no __mro__ attribute class Mammals(object): pass class Dog(Mammals): pass print issubclass(Dog, type) #False print Dog.__mro__ --output:-- (class

Re: Does anyone else use this little idiom?

2008-02-05 Thread Eduardo O. Padoan
On Feb 5, 2008 1:30 PM, Nick Craig-Wood [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ruby has a neat little convenience when writing loops where you don't care about the loop index: you just do n.times do { ... some code ... } where n is an integer representing how

Re: Why must implementing Python be hard unlike Scheme?

2008-02-20 Thread Eduardo O. Padoan
On Feb 19, 2008 3:15 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does this have to be true? Beneath the more complex syntax are there a few core design principles/objects/relationships to help in grokking the whole thing? Got any related links? Take a look at a simpler implementation, like

Re: Is this a good time to start learning python?

2008-04-01 Thread Eduardo O. Padoan
On Tue, Apr 1, 2008 at 3:57 PM, [EMAIL PROTECTED] wrote: On Apr 1, 12:47 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 01 Apr 2008 13:57:55 -0300, [EMAIL PROTECTED] escribió: On Mar 31, 1:36 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: Don't be scared by the

Re: Is this a good time to start learning python?

2008-04-01 Thread Eduardo O. Padoan
On Tue, Apr 1, 2008 at 4:20 PM, [EMAIL PROTECTED] wrote: Please explain how the existence of Python 3.0 would break your production code. The existence of battery acid won't hurt me either, unless I come into contact with it. If one eventually upgrades to 3.0 -- which

Re: Newbie to python --- why should i learn !

2008-05-08 Thread Eduardo O. Padoan
On Thu, May 8, 2008 at 7:25 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, i was reading/learning some hello world program in python. I think its very simillar to Java/C++/C#. What's different (except syntax) ? what can i do easily with python which is not easy in c++/java !?

Re: HASH TABLES IN PYTHON

2008-05-14 Thread Eduardo O. Padoan
On Wed, May 14, 2008 at 12:20 PM, Blubaugh, David A. [EMAIL PROTECTED] wrote: To Whom It May Concern, I was wondering if anyone has ever worked with hash tables within the Python Programming language? I will need to utilize this ability for quick numerical calculations.

Re: can't delete from a dictionary in a loop

2008-05-16 Thread Eduardo O. Padoan
On Fri, May 16, 2008 at 6:40 PM, Gary Herron [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On 16 mai, 23:28, Hans Nowak [EMAIL PROTECTED] wrote: Dan Upton wrote: for pid in procs_dict: if procs_dict[pid].poll() != None # do the counter updates del procs_dict[pid] The

Re: any(), all() and empty iterable

2009-04-12 Thread Eduardo O. Padoan
On Sun, Apr 12, 2009 at 8:53 AM, Tim Chase python.l...@tim.thechases.com wrote: From the docs: all(iterable)                Return True if all elements of the iterable are true. Equivalent        to:                def all(iterable):            for element in iterable:                if

Re: Not fully OO ?

2008-09-20 Thread Eduardo O. Padoan
On Sat, Sep 20, 2008 at 11:26 AM, Kay Schluehr [EMAIL PROTECTED] wrote: On 20 Sep., 12:14, Fredrik Lundh [EMAIL PROTECTED] wrote: Kay Schluehr wrote: Answer: if you want to define an entity it has to be defined inside a class. If you want to access an entity you have to use the dot

Re: What is wrong with my Python threading?

2008-05-20 Thread Eduardo O. Padoan
On Tue, May 20, 2008 at 8:24 PM, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 20 May 2008 10:28:51 -0300, castironpi [EMAIL PROTECTED] escribió: You meant 'thd1.start( )' and 'thd2.start( )'. Wow! A message with a high S/N ratio coming from you! And it's not the first I've seen -

Re: should I put old or new style classes in my book?

2008-05-30 Thread Eduardo O. Padoan
On Thu, May 29, 2008 at 3:06 PM, Jason [EMAIL PROTECTED] wrote: I've got Python 3.0 alpha 2. In this version, it looks like you can define classes in either the old style or new style. (I snipped the top line a bit in the following example): Wrong. Py3k Classes are always new-style. They

Re: Python and Harry Potter?

2008-06-05 Thread Eduardo O. Padoan
On Thu, Jun 5, 2008 at 10:29 AM, Hans Nowak [EMAIL PROTECTED] wrote: Helmut Jarausch wrote: Hi, just to let you know ... Today I've got an email from Amazon recommending me Harry Potter and the Deathly Hallows and they told me why they recommended this book, because I've bought Core

Re: Does the python library of Google Data API is truly free?

2008-06-11 Thread Eduardo O. Padoan
On Wed, Jun 11, 2008 at 10:28 AM, Kless [EMAIL PROTECTED] wrote: I understand very well that a service is a software which is accessed through a network. And the description given on Wikipedia [1] is A 'Web service' (also Web Service) is defined by the W3C as a software system designed to

Re: Bug in __init__?

2008-01-18 Thread Eduardo O. Padoan
On Jan 18, 2008 3:09 PM, Zbigniew Braniecki [EMAIL PROTECTED] wrote: I found a bug in my code today, and spent an hour trying to locate it and then minimize the testcase. Once I did it, I'm still confused about the behavior and I could not find any reference to this behavior in docs.

Re: Removing objects

2008-01-23 Thread Eduardo O. Padoan
On Jan 23, 2008 9:55 AM, Steven D'Aprano [EMAIL PROTECTED] wrote: For that to work, you need to give your class an __eq__ method, and have it match by name: # put this in MyClass def __eq__(self, other): return self.name == self.other Do you mean: # put this in MyClass

Re: PLEASE ACCEPT MY SINCERE APOLOGIES

2008-02-01 Thread Eduardo O. Padoan
On Feb 1, 2008 5:19 AM, Arnaud Delobelle [EMAIL PROTECTED] wrote: On Feb 1, 5:08 am, Paddy [EMAIL PROTECTED] wrote: On Feb 1, 1:26 am, Blubaugh, David A. [EMAIL PROTECTED] wrote: To Everyone on the planet Earth, Please accept my apologies for Why the Hell has nobody answered

Re: Python Standardization: Wikipedia entry

2008-02-02 Thread Eduardo O. Padoan
On Jan 29, 2008 2:43 PM, John Nagle [EMAIL PROTECTED] wrote: Submitting Python 2.5 to ISO/ANSI might be a good idea. From GvR himself: - Does a specification (ISO, ECMA, ..) is planned for Python and when ? No, never. I don't see the point.

Re: Multiple variable control in for loops. Doable in Python?

2008-07-18 Thread Eduardo O. Padoan
On Fri, Jul 18, 2008 at 4:21 PM, mark floyd [EMAIL PROTECTED] wrote: I'm new to Python and have been doing work converting a few apps from Perl to Python. I can not figure out the comparable Python structures for multi-variable for loop control. Examples: # In Perl for($i = 0, j = 0; $i

Re: Duck Typing and **kwds

2007-10-11 Thread Eduardo O. Padoan
On 10/11/07, Luis Zarrabeitia [EMAIL PROTECTED] wrote: Hi there. I just tried this test: def f(**kwds): print kwds import UserDict d = UserDict.UserDict(hello=world) f(**d) And it fails with a TypeError exception (f() argument after ** must be a dictionary). I find

Re: Script to Download Ubuntu Gutsy ASAP

2007-10-18 Thread Eduardo O. Padoan
On 10/18/07, danfolkes [EMAIL PROTECTED] wrote: I thought I would post the source to a program that I made that will download the http://ubuntu.media.mit.edu/ubuntu-releases/gutsy/ as soon as its posted. It checks the site every 10 min time.sleep(600) This is mostly untested so I would

Re: A Python 3000 Question

2007-10-30 Thread Eduardo O. Padoan
On 10/29/07, brad [EMAIL PROTECTED] wrote: Will len(a_string) become a_string.len()? I was just reading http://docs.python.org/dev/3.0/whatsnew/3.0.html One of the criticisms of Python compared to other OO languages is that it isn't OO enough or as OO as others or that it is inconsistent.

Re: Oh no, my code is being published ... help!

2007-11-30 Thread Eduardo O. Padoan
On Nov 30, 2007 11:36 AM, Hrvoje Niksic [EMAIL PROTECTED] wrote: Eduardo O. Padoan [EMAIL PROTECTED] writes: No, writing this way will confound the 2to3 tool. Why? print(foo) is a perfectly valid Python 2 statement. Maybe it's simply a matter of fixing the tool. print(foo) - print((foo

Re: Oh no, my code is being published ... help!

2007-11-30 Thread Eduardo O. Padoan
On Nov 30, 2007 11:18 AM, Peter Decker [EMAIL PROTECTED] wrote: On Nov 30, 2007 1:19 AM, Tim Roberts [EMAIL PROTECTED] wrote: You also have a couple of instances of: print(Error Squeezing %s...) The parentheses serve no purpose here, and are unidiomatic. I thought that with the

Re: List Comprehension Question: One to Many Mapping?

2007-08-24 Thread Eduardo O. Padoan
For example, if I have x=[ [1,2], [3,4] ] What I want is a new list of list that has four sub-lists: [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] [[a, [f(b) for b in a]] for a in x] -- http://mail.python.org/mailman/listinfo/python-list

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Eduardo O. Padoan
On 9/2/07, llothar [EMAIL PROTECTED] wrote: I'm afraid that the GIL is killing the usefullness of python for some types of applications now where 4,8 oder 64 threads on a chip are here or comming soon. What is the status about that for the future of python? I know that at the moment allmost

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Eduardo O. Padoan
No. http://www.artima.com/weblogs/viewpost.jsp?thread=211430 Ops, I meant: http://www.artima.com/forums/threaded.jsp?forum=106thread=211200 -- http://www.advogato.org/person/eopadoan/ Bookmarks: http://del.icio.us/edcrypt -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: self.member syntax seems /really/ annoying

2007-09-13 Thread Eduardo O. Padoan
On 9/13/07, Wildemar Wildenburger [EMAIL PROTECTED] wrote: because I'm trained to interpret the underscore as a synonym for one space. It's not particularly beautiful, but that is probably a matter of habituation. And that exact word is probably the reason why I'd still use self or s

Re: How to avoid overflow errors

2007-09-14 Thread Eduardo O. Padoan
On 9/14/07, Steven D'Aprano [EMAIL PROTECTED] wrote: I thought that overflow errors would be a thing of the past now that Python automatically converts ints to longs as needed. Unfortunately, that is not the case. class MyInt(int): ... pass ... MyInt(sys.maxint) 2147483647

Re: How to avoid overflow errors

2007-09-14 Thread Eduardo O. Padoan
On 14 Sep 2007 18:08:00 -0700, Paul Rubin http://phr.cx@nospam.invalid wrote: Eduardo O. Padoan [EMAIL PROTECTED] writes: Not totally unrelated, but in Py3k, as it seems, overflows are really things of the past: Python 3.0a1 (py3k:58061, Sep 9 2007, 13:18:37) [GCC 4.1.3 20070831

Re: How to avoid overflow errors

2007-09-15 Thread Eduardo O. Padoan
On 9/15/07, Carl Banks [EMAIL PROTECTED] wrote: On Fri, 14 Sep 2007 22:59:13 -0300, Eduardo O. Padoan wrote: On 14 Sep 2007 18:08:00 -0700, Paul Rubin http://phr.cx@nospam.invalid wrote: Eduardo O. Padoan [EMAIL PROTECTED] writes: Not totally unrelated, but in Py3k, as it seems

Re: how to join array of integers?

2007-09-15 Thread Eduardo O. Padoan
It's nice people have invented so many ways to spell the builting map ;) ,.join(map(str,[1,2,3])) '1,2,3' IIRC, map's status as a builtin is going away. Actually, py3k built-in map == itertools.imap map(str, []) itertools.imap object at 0xb7c7c9ec --

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Eduardo O. Padoan
On 9/15/07, J. Cliff Dyer [EMAIL PROTECTED] wrote: And I'd hate to have to remember all of the rules for what can go together and what can't, especially when it comes time to debug. No. I don't think it should be forced, but maybe put it in PEP8 or PEP3008. It is: see Whitespace in

Re: Python 3.0 migration plans?

2007-09-27 Thread Eduardo O. Padoan
On 9/27/07, TheFlyingDutchman [EMAIL PROTECTED] wrote: It seems that Python 3 is more significant for what it removes than what it adds. What are the additions that people find the most compelling? - dict.items(), .values() and .keys() returns dict views, and the .iter*() removal

Re: unit testing

2007-10-05 Thread Eduardo O. Padoan
What's the equivalent of unittest's assertRaises? In certain situations it is also useful to test wether an exception (along its type) is raised or not. Does py.test support such thing? import py.test py.test.raises(NameError, blablabla) -- http://www.advogato.org/person/eopadoan/

Re: Python3 - it's awesome

2008-11-17 Thread Eduardo O. Padoan
On Mon, Nov 17, 2008 at 7:30 AM, Johannes Bauer [EMAIL PROTECTED] wrote: Hello list, since I've read so much about Python 3 and ran into some trouble which was supposed to be fixed with 3k, I yesterday came around to compile it and try it out. To sum it up: It's awesome. All the promised

Re: What about a decorator module version 3.0?

2008-12-01 Thread Eduardo O. Padoan
On Mon, Dec 1, 2008 at 9:16 AM, Michele Simionato [EMAIL PROTECTED] wrote: I am thinking about releasing a new version of the decorator module, [...] Just FYI, the module being discussed here is http://www.phyast.pitt.edu/~micheles/python/documentation.html I dont use it myself, but given how

Re: as keyword woes

2008-12-04 Thread Eduardo O. Padoan
On Thu, Dec 4, 2008 at 7:44 AM, James Stroud [EMAIL PROTECTED] wrote: alex23 wrote: On Dec 4, 3:42 pm, Warren DeLano [EMAIL PROTECTED] wrote: So you prefer broken code to broken rules, eh? Your customers must love that! This is exactly the kind of ivory-tower thinking I feared might be

Re: A different kind of interface

2009-01-22 Thread Eduardo O. Padoan
On Thu, Jan 22, 2009 at 7:10 AM, bearophileh...@lycos.com wrote: I use the Python shell daily, plus of course normal editors to edit python scripts. They both are very useful for different purposes. But the default interactive shell isn't much handy if you want to modify the past code to run

Re: A different kind of interface

2009-01-23 Thread Eduardo O. Padoan
On Thu, Jan 22, 2009 at 5:01 PM, bearophileh...@lycos.com wrote: Eduardo O. Padoan: You are almost *describing* reinteract: - Thank you for the link and the software, I have not tried it yet, but from the screencast it looks quite nice. - I am glad that there are people that don't think