Re: Factory for Struct-like classes

2008-08-20 Thread Dave Benjamin
Christian Heimes wrote: eliben wrote: Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html) does this. I suppose it can be done with 'exec', but is there a more Pythonic way ? Try named tuple http://code.activestate.com/recipes/500261/ A named tuple implementation is part of

Re: Factory for Struct-like classes

2008-08-20 Thread Dave Benjamin
eliben wrote: Whaaa? Named tuples are being added to Python? Neat! Is there any documentation on this? I can't seem to find anything on the web... It's not easy to find unless you recall where you've seen it: http://docs.python.org/dev/3.0/library/collections.html#collections.namedtuple

Re: [OT] minimalist web server

2007-12-01 Thread Dave Benjamin
Daniel Fetchinson wrote: The reason I need this is that my current best strategy to avoid ads in web pages is putting all ad server names into /etc/hosts and stick my local ip number next to them (127.0.0.1) so every ad request goes to my machine. I run apache which has an empty page for 404

Re: Resize image NO PIL!!

2007-05-28 Thread Dave Benjamin
cbmeeks wrote: I have created an image hosting site and when a user uploads an image, I want a service to run on the server to create a few thumbnails while the user does other things. My stupid host (pair.com) doesn't have PIL installed and I'm too much of a stupid newbie to figure out how

Re: Overloading the tilde operator?

2007-02-07 Thread Dave Benjamin
Neil Cerutti wrote: There's been only one (or two?) languages in history that attempted to provide programmers with the ability to implement new infix operators, including defining precedence level and associativity (I can't think of the name right now). You're probably thinking of SML or

Re: Partial classes

2006-07-19 Thread Dave Benjamin
On Wed, 18 Jul 2006, Sanjay wrote: What is the equivalent in Python? Inheriting is a way, but is not working in all scenerios. Have you tried multiple inheritance? For example: from GeneratedPerson import GeneratedPerson from HandcraftedPerson import HandcraftedPerson class

Re: Time to bundle PythonWin

2006-05-16 Thread Dave Benjamin
Ten wrote: Respectfully, that sounds like a reason for *you* to bundle pythonwin (and python, to be honest :) ), not a reason for everyone else to have to download an extra 40-50% of potentially superfluous cruft with their standard python setup. Certainly, I could bundle Python and

Re: Time to bundle PythonWin

2006-05-16 Thread Dave Benjamin
[EMAIL PROTECTED] wrote: The ctypes.com package is no longer part of ctypes. It has been split by Thomas Heller into a separate package comtypes. See: http://sourceforge.net/projects/comtypes/ Still in its childhood but as easy as com can get, I guess, way easier and better than pythonWin

Re: Time to bundle PythonWin

2006-05-16 Thread Dave Benjamin
Martin v. Löwis wrote: Dave Benjamin wrote: Why is PythonWin (win32all) still a separate download from a third party? Is it legal, technical, or what? I think it's about time it be part of the standard distribution. Both legal and technical. The PythonWin author and maintainer (Mark

Re: Time to bundle PythonWin

2006-05-12 Thread Dave Benjamin
On Thu, 11 May 2006, Alex Martelli wrote: Dave Benjamin [EMAIL PROTECTED] wrote: ... It's time to bundle PythonWin. No: the Python Standard Distribution, in 2.5, includes instead ctypes, which is lower-level than PythonWin but more general (exists for other platforms, lets you call other

Time to bundle PythonWin

2006-05-11 Thread Dave Benjamin
tasks. My users are thankfully benevolent enough to download and install Python on their own. They don't know what PythonWin is, they aren't remembering it, and frankly, I don't think it should be their concern. It's time to bundle PythonWin. -- .:[ dave benjamin -( ramen/sp00 )- http

Re: Time to bundle PythonWin

2006-05-11 Thread Dave Benjamin
On Thu, 11 May 2006, Robert Hicks wrote: No it isn't. It is a Windows only package. It needs to stay a separate download. The Windows installer for Python is an MSI file. It's already Windows only. Dave -- http://mail.python.org/mailman/listinfo/python-list

OT: Mozart (was Re: perspective on ruby)

2006-04-21 Thread Dave Benjamin
. Also worth a mention is Alice ML, which runs on the Mozart system but is statically typed, type-inferred, very similar to SML but with concurrency support (lazies and futures), typesafe marshalling, and packages, which allow for dynamically-typed interfaces between modules. -- .:[ dave

Re: Parsing csh scripts with python

2006-03-28 Thread Dave Benjamin
, but I don't think it will do what I need. What about regular expressions? -- .:[ dave benjamin -( ramen/sp00 )- http://spoomusic.com/ ]:. one man's constant is another man's variable - alan perlis -- http://mail.python.org/mailman/listinfo/python-list

Re: Function params with **? what do these mean?

2006-03-20 Thread Dave Benjamin
On Mon, 20 Mar 2006, Ben Cartwright wrote: Dave Hansen wrote: On 20 Mar 2006 15:45:36 -0800 in comp.lang.python, [EMAIL PROTECTED] (Aahz) wrote: Personally, I think it's a Good Idea to stick with the semi-standard names of *args and **kwargs to make searching easier... Agreed (though

Re: import, from and reload

2006-03-02 Thread Dave Benjamin
import * should be avoided anyway, for reasons that have been discussed many times in the past. The annoyance with reloading is just one more reason. Better to just use import X in the first place. -- .:[ dave benjamin -( ramen/sp00 )- http://spoomusic.com/ ]:. one man's constant

Re: import, from and reload

2006-03-02 Thread Dave Benjamin
On Thu, 2 Mar 2006, John Salerno wrote: Dave Benjamin wrote: In general, from X import * should be avoided anyway, for reasons that have been discussed many times in the past. The annoyance with reloading is just one more reason. Better to just use import X in the first place. Thanks. I

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Dave Benjamin
. -- .:[ dave benjamin -( ramen/sp00 )- http://spoomusic.com/ ]:. one man's constant is another man's variable - alan perlis -- http://mail.python.org/mailman/listinfo/python-list

Re: Ovum quote about Python [OT]

2006-01-26 Thread Dave Benjamin
Python and Zope as it's moderately hardcore open source stuff. Moderately hardcore? Is that like listening to Rage Against the Machine with your seatbelt on? -- .:[ dave benjamin -( ramen/sp00 )- http://spoomusic.com/ ]:. To attain knowledge, add things every day. To attain

Re: Question about isinstance()

2006-01-26 Thread Dave Benjamin
before. Equality in this case is left completely open-ended, and as a result, there is no way that you can guarantee that a == b is the same as b == a if a is a foo and b is of unknown type. This can lead to bizarre and unpredictable behavior. -- .:[ dave benjamin -( ramen/sp00 )- http

Re: Question about isinstance()

2006-01-26 Thread Dave Benjamin
the implementation of b. -- .:[ dave benjamin -( ramen/sp00 )- http://spoomusic.com/ ]:. To attain knowledge, add things every day. To attain wisdom, remove things every day. - Lao Tzu -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about isinstance()

2006-01-26 Thread Dave Benjamin
On Thu, 26 Jan 2006, Dave Benjamin wrote: On Thu, 26 Jan 2006, Rocco Moretti wrote: You were better off with what you had before. Equality in this case is left completely open-ended, and as a result, there is no way that you can guarantee that a == b is the same as b == a if a is a foo

Re: Microsoft IronPython?

2006-01-04 Thread Dave Benjamin
could do a lot worse than Python 2.1, as far as feature set is concerned. (Of course, this is not to discourage the Jython team from coming through with a new stable release. ;) -- .:[ dave benjamin: ramen/[spoomusic.com] ]:. -- http://mail.python.org/mailman/listinfo/python-list

Re: Application architecture (long post - sorry)

2006-01-03 Thread Dave Benjamin
/01/01/turbogears-now-supports-cheetah-and-stan/ Happy New Year! Dave -- .:[ dave benjamin: ramen/[spoomusic.com] ]:. -- http://mail.python.org/mailman/listinfo/python-list

Re: generators in Java?

2006-01-02 Thread Dave Benjamin
that produces values on-demand, you don't have to rewrite your function to save intermediate states (which can be a considerable amount of work). A good explanation of the rationale for generators in Python is in the Motivation section of PEP 255: http://www.python.org/peps/pep-0255.html -- .:[ dave

Re: HTMLGen- Table Align property

2005-12-27 Thread Dave Benjamin
Cappy2112 wrote: Does anyone know if the table align property is available in HTMLgen.Table? The docs don't show it, but I find it hard to believe that it is not available. I want to center the table. Only the cell align propterty is available I've never used HTMLgen, but you might try

Re: HTMLGen- Table Align property

2005-12-27 Thread Dave Benjamin
Cappy2112 wrote: Does anyone know if the table align property is available in HTMLgen.Table? The docs don't show it, but I find it hard to believe that it is not available. I want to center the table. Only the cell align propterty is available print HTMLgen.TableLite(align=center) TABLE

Re: HTMLGen- Table Align property

2005-12-27 Thread Dave Benjamin
Cappy2112 wrote: Table and TableLite are different classes. Tablelite requires a little more work, and I will ave to rewrite some code to use it. I am using Table a tthe moment Well, as far as I know, wrapping a DIV align=center around a TABLE should produce the same effect as giving the

Re: Indentation/whitespace

2005-12-23 Thread Dave Benjamin
Alex Martelli wrote: The main reason I suggest a general-purpose mechanism for the hooking-up of the preprocessor is that such a mechanism might stand a chance to be accepted (via the usual PEP procedure), as long as other interesting use cases can be found; I suspect that if the only use case

Humane programmer interfaces

2005-12-22 Thread Dave Benjamin
by compassion and sympathy, in consideration of humans. In a world of increasing software complexity, this doesn't sound half bad to me. -- .:[ dave benjamin: ramen/[sp00] ]:. \\ who will clean out my Inbox after I'm dead[?] - charles petzold -- http://mail.python.org/mailman/listinfo/python

Re: Which Python web framework is most like Ruby on Rails?

2005-12-19 Thread Dave Benjamin
On Mon, 19 Dec 2005, Paul Rubin wrote: Russell E. Owen [EMAIL PROTECTED] writes: I disagree. Once you've picked a database (not trivial in itself, of course), you typically only have a few options for talking to in in Python. Also, typically either: - One stands out (because others have been

Re: Why and how there is only one way to do something?

2005-12-15 Thread Dave Benjamin
On Thu, 15 Dec 2005, Richie Hindle wrote: [Steve] Since Python is Turing-complete Is there some equivalent of Godwin's Law that we can invoke at this point? 8-) None that I know of, but perhaps there should be. =) Note that in this particular thread, we could have invoked the real

Re: Why and how there is only one way to do something?

2005-12-15 Thread Dave Benjamin
On Thu, 15 Dec 2005, Simon Brunning wrote: On 12/15/05, Steve Holden [EMAIL PROTECTED] wrote: Aahz wrote: python -c 'import this' Faster: python -m this So, there's two ways to do it. ;-) Yes, but which way do you do it if you're Dutch? --

Re: RoR like (was : SPE 0.8.1.b Python IDE...)

2005-12-15 Thread Dave Benjamin
On Thu, 15 Dec 2005, Adrian Holovaty wrote: bruno at modulix wrote: RoR is not an IDE, it's a web framework. The closest things in Python are TurboGears (good Ajax/js support via Mochikit), Subway (never tested), and Django (no Ajax support AFAIK). Note that no Ajax support is misleading.

Re: Rename files with numbers

2005-10-31 Thread Dave Benjamin
. This problem has been solved. Here's a list of apps, including TagRename, that can query freedb: http://www.freedb.org/freedb_aware_apps.php -- .:[ dave benjamin: ramen/[sp00] ]:. \\ who will clean out my Inbox after I'm dead[?] - charles petzold -- http://mail.python.org/mailman/listinfo/python-list

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-17 Thread dave . benjamin
Jorgen Grahn wrote: On Fri, 14 Oct 2005 12:37:25 +0200, Christophe [EMAIL PROTECTED] wrote: Kenneth McDonald a écrit : For unfortunate reasons, I'm considering switching back to Win XP (from OS X) as my main system. Windows has so many annoyances that I can ... Yes, I know that Cygwin

Re: Duplicating Modules

2005-09-30 Thread Dave Benjamin
Misto . wrote: Hi folks! Short: There is a way to dumplicate a module ? Here's one way... it doesn't quite work with modules inside of packages, unfortunately, but it does avoid defeating module caching and tries to keep sys.modules in a predictable state. I don't know what the

Re: [Info] PEP 308 accepted - new conditional expressions

2005-09-30 Thread Dave Benjamin
Reinhold Birkenfeld wrote: after Guido's pronouncement yesterday, in one of the next versions of Python there will be a conditional expression with the following syntax: X if C else Y Hooray! After years of arguing over which syntax to use, and finally giving up since nobody could agree,

Re: Where to find python c-sources

2005-09-29 Thread Dave Benjamin
Tor Erik Sønvisen wrote: I need to browse the socket-module source-code. I believe it's contained in the file socketmodule.c, but I can't locate this file... Where should I look? You can browse the Python CVS tree here: http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/ For

Re: Question about consistency in python language

2005-09-08 Thread Dave Benjamin
[EMAIL PROTECTED] wrote: Let's say I define a list of pairs as follows: l = [('d', 3), ('a', 2), ('b', 1)] Can anyone explain why this does not work? h = {}.update(l) and instead I have to go: h = {} h.update(l) to initialize a dictionary with the given list of pairs? when

Re: epydoc CLI and many files

2005-09-07 Thread Dave Benjamin
Terry Hancock wrote: On Monday 05 September 2005 08:10 am, Laszlo Zsolt Nagy wrote: The problem is that now I have so many modules that the shell (cmd.exe) cannot interpret this as a one command. In POSIX systems, the shell expands wildcards into multiple files on the command line, but

Re: Jython Released

2005-07-19 Thread Dave Benjamin
Ramza Brown wrote: This is an update from Brian Zimmer of the Jython group, new release: Great news! - new installer How do I use it? Thanks, Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Jython Released

2005-07-19 Thread Dave Benjamin
Dave Benjamin wrote: Ramza Brown wrote: This is an update from Brian Zimmer of the Jython group, new release: Great news! - new installer How do I use it? I figured it out. You might want to document this somewhere. ;) java -cp jython_Release_2_2alpha1.jar

Re: Jython Released

2005-07-19 Thread Dave Benjamin
Ramza Brown wrote: I figured it out. You might want to document this somewhere. ;) java -cp jython_Release_2_2alpha1.jar org.python.util.install.Installation Did you try double clicking on the jar. That is what most do or at least the last package supported that. Yeah. It opens in

Re: Creating anonymous functions using eval

2005-07-12 Thread Dave Benjamin
Joseph Garvin wrote: Robert Kern wrote: Not everyone is reading this list in a conveniently threaded form Why not? Just about every modern newsgroup reader and e-mail app has a threaded view option. My newsreader supports threading, but the first message I see in this thread is from

Re: Better console for Windows?

2005-07-01 Thread Dave Benjamin
Brett Hoerner wrote: Is there a different shell I can use (other than cmd.com) to run Python in, where I can full-screen the window (if I pleased), etc? As it is, things that would run far off the right have to be word wrapped after very few characters. I have a pretty exotic setup but I

Re: Inheriting from object

2005-06-29 Thread Dave Benjamin
Steven Bethard wrote: Guido also suggests that the explicit: class C(object): pass is much preferred[2] over: __metaclass__ = type class C: pass Really? I have been toying with the idea of using the __metaclass__ trick, since it results in completely

Re: Thoughts on Guido's ITC audio interview

2005-06-28 Thread Dave Benjamin
Stephen Kellett wrote: In message [EMAIL PROTECTED], Simon Brunning [EMAIL PROTECTED] writes Eclipse's refactorings are a great boon, I find. Refectoring is never *fully* automatic, of course, but the ability to, for example, select a chunk of code and have it extracted into a separate

Re: Thoughts on Guido's ITC audio interview

2005-06-28 Thread Dave Benjamin
Sakesun Roykiattisak wrote: What's being ignored is that type information is useful for other things than compile type checking. The major case in point is the way IDEs such as IntelliJ and Eclipse use type information to do refactoring, code completion and eventually numerous other things.

Re: Which kid's beginners programming - Python or Forth?

2005-06-28 Thread Dave Benjamin
BORT wrote: I am toying with the idea of teaching my ten year old a little about programming. I started my search with something like best FREE programming language for kids. After MUCH clicking and high-level scanning, I am looking at Python and Forth. Both have advocates that say each is

Thoughts on Guido's ITC audio interview

2005-06-25 Thread Dave Benjamin
Guido gave a good, long interview, available at IT Conversations, as was recently announced by Dr. Dobb's Python-URL! The audio clips are available here: http://www.itconversations.com/shows/detail545.html http://www.itconversations.com/shows/detail559.html I'd like to comment on a few parts of

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Dave Benjamin
Jan Danielsson wrote: Sorry, but I Just Don't Get It. I did search the 'net, I did read the FAQ, but I'm too dumb to understand. Say we define a string s as follows: s = 'hello' If we print s, we see its string form (__str__): print s hello However, if we just examine s, we see its

Re: Annoying behaviour of the != operator

2005-06-08 Thread Dave Benjamin
Jordan Rastrick wrote: Surely the != operator should, if no __ne__ method is present for either object, check to see if an __eq__ method is defined, and if so, return its negation? Actually, that brings me to a wider question - why does __ne__ exist at all? Surely its completely

Re: Help! File objects and scoping

2005-06-07 Thread Dave Benjamin
bens wrote: I'm trying to return an 'mmap' object from a function. The return works, but some of the object's methods crash. Here are two examples doesntwork.py --- import mmap import os name=/any/real/file/on/my/hard/drive def getfile(name):

Re: Removing a warnings filter?

2005-06-03 Thread Dave Benjamin
Torsten Bronger wrote: When I add a warning filter with warnings.filterwarnings, how can I get rid of it? I've read about resetwarnings(), but it removes all filters, even those that I didn't install in a certain function. I have never used this module, but judging by a quick glance of the

Re: OO design question / Transform object in place?

2005-05-20 Thread Dave Benjamin
[EMAIL PROTECTED] wrote: Dave Benjamin wrote: I think it's much better for simplify() to return a new object and leave the original object unmodified. You can still write: expression2 = expression2.simplify() A belated thank-you message for your reply to my posting. I took your advice

Re: Simple TCP relay or proxy

2005-05-13 Thread Dave Benjamin
Tomas Christiansen wrote: Im trying to make a simple TCP socket relay or proxy, but my skills in Python are not high (yet). http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/114642 -- http://mail.python.org/mailman/listinfo/python-list

Re: OO design question / Transform object in place?

2005-05-11 Thread Dave Benjamin
[EMAIL PROTECTED] wrote: Now suppose I set expression2 = Sum([a,-a]) and Sum.simplify() recognises that the two terms cancel and the Sum has value 0. Can I make expression2.simplify() transform expression2 from an instance of Sum to an instance of Number(0) **in place**? Is that possibe, or

Re: Reg strip_tags function in Python.

2005-05-07 Thread Dave Benjamin
praba kar wrote: In Php I can use strip_tags() function to strip out all html tags. I want to know that strip_tags() equivalent function in Python. Here's a simple function based on Python's HTMLParser class. If you need to reject only certain tags, you'll probably want to subclass

Re: annonymous functions -- how to

2005-05-06 Thread Dave Benjamin
Fredrik Lundh wrote: Dave Benjamin wrote: In this case, having to name these callback functions is tiring and awkward, and (IMHO) disrupts the flow of my function: so name them all func or next or something, so you don't have to think. once the object is bound, the name is irrlevant. Sure

Re: annonymous functions -- how to

2005-05-06 Thread Dave Benjamin
Fredrik Lundh wrote: Dave Benjamin wrote: so name them all func or next or something, so you don't have to think. once the object is bound, the name is irrlevant. Sure, you could do this, but then you'd have multiple functions at different nesting levels with the same name, which would

Re: win32: structured storage

2005-05-06 Thread Dave Benjamin
Steve Holden wrote: tlviewer wrote: CHM is supposed to be structured storage (ITSF). If a given CHM file is infected it most likely has an embedded EXE file -- mine had one called [Open.exe]. Ironic, really, since Microsoft insist that the browser must be fully-integrated with

Re: win32: structured storage

2005-05-06 Thread Dave Benjamin
Dave Benjamin wrote: Steve Holden wrote: tlviewer wrote: CHM is supposed to be structured storage (ITSF). If a given CHM file is infected it most likely has an embedded EXE file -- mine had one called [Open.exe]. Ironic, really, since Microsoft insist that the browser must

Re: annonymous functions -- how to

2005-05-06 Thread Dave Benjamin
Peter Hansen wrote: Dave Benjamin wrote: def add_thingy(): def func(thingy_id): print 'got thingy id:', thingy_id def funnc(doodad_id): print 'got doodad id:', doodad_id def func(thingy_doodad): print 'thingy doodad created

Re: annonymous functions -- how to

2005-05-05 Thread Dave Benjamin
Peter Hansen wrote: I doubt there's a valid usecase for a anonymous function that has more than a line or two. Personally, I don't think there's a good usecase for an anonymous function longer than one line... The case that I keep running into regards event-driven programming. I need to do

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Michael Hoffman wrote: Paul Miller wrote: I see lambda is going away, so I want to use something that will be around for awhile. All I want to do is provide an inline function as an argument to another function. That's what lambda does. But it's going away, you'll have to use def when

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Paul Miller wrote: Michael Hoffman wrote: Dave Benjamin wrote: I think you meant to write something like this: def attrsetter(obj, name, value): def _return_func(): return setattr(obj, name, value) return _return_func Sure did. Sorry. You guys have been very helpful! While

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Dave Benjamin wrote: You could use a combination of bound methods and the curry function defined in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549 The examples in the discussion do just that. Also, in the CVS version of Python, there's a new module called

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Cameron Laird wrote: In article [EMAIL PROTECTED], Peter Hansen [EMAIL PROTECTED] wrote: This meets your requirements as stated: def temp(): foo.var = 1 bind('a', temp) def temp(): foo.var = 2 bind('b', temp) del temp Ewww! *When* is lambda going bye-bye? I apparently haven't been paying

Re: (PHP or Python) Developing something like www.tribe.net

2005-04-26 Thread Dave Benjamin
seem unreasonably slow to me. (CPUs have of course exploded in speed in the past few years.) -- .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:. talking about music is like dancing about architecture. -- http://mail.python.org/mailman/listinfo/python-list

Re: Making things more functional in Python

2005-03-04 Thread Dave Benjamin
On Fri, 2005-03-04 at 08:36 -0800, gf gf wrote: Is there a better, more FP style, more Pythonic way to write this: def compute_vectors(samples, dset): vectors = {} for d in dset: vectors[d] = [sample.get_val(d) for sample in samples] return vectors You

Re: Making things more functional in Python

2005-03-04 Thread Dave Benjamin
On Sat, 2005-03-05 at 00:00 -0700, Dave Benjamin wrote: On Fri, 2005-03-04 at 08:36 -0800, gf gf wrote: Is there a better, more FP style, more Pythonic way to write this: def compute_vectors(samples, dset): vectors = {} for d in dset: vectors[d

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Dave Benjamin
Jeremy Bowers wrote: I'd point out that the Zen that can be comprehended by checking off items in a list is not the true Zen. The Zen that can be imported is not the eternal Zen. =) -- http://mail.python.org/mailman/listinfo/python-list

Type inference, lessons learned from Vyper

2005-02-03 Thread Dave Benjamin
. -- .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:. talking about music is like dancing about architecture. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested scopes and class variables

2005-02-03 Thread Dave Benjamin
Thanks, Nick and Alex, for the nice, detailed explanations. My understanding of Python bytecode is not deep enough to comment at this time. ;) -- .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:. talking about music is like dancing about architecture. -- http

Nested scopes and class variables

2005-01-30 Thread Dave Benjamin
= 5 class C(object): ... x = x ... C.x 5 Any implementation gurus have some insight into what's going on here? -- .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:. talking about music is like dancing about architecture. -- http://mail.python.org

Re: python without OO

2005-01-27 Thread Dave Benjamin
Davor wrote: Is it possible to write purely procedural code in Python, or the OO constructs in both language and supporting libraries have got so embedded that it's impossible to avoid them? Also, is anyone aware of any scripting language that could be considered as Python minus OO stuff? (As you

Re: One-Shot Property?

2005-01-18 Thread Dave Benjamin
Kevin Smith wrote: I have many cases in my code where I use a property for calculating a value on-demand. Quite a few of these only need to be called once. After that the value is always the same. In these properties, I set a variable in the instance as a cached value and return that value

Re: Why no list heritable type?

2004-12-22 Thread Dave Benjamin
Mike Meyer wrote: Robert Brewer [EMAIL PROTECTED] writes: Why aren't built in lists and dictionaries real heritable types that can save this kind of patchwork? They are since Python 2.2 (IIRC): And before Python 2.2 there was the UserList class in the standard library. Which is still there in

Re: A rational proposal

2004-12-19 Thread Dave Benjamin
. Decimals will be converted to rationals before the operation. [Open question: is this the right thing to do?] Sounds right to me. Cheers, Dave -- .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:. talking about music is like dancing about architecture. -- http

Re: lies about OOP

2004-12-15 Thread Dave Benjamin
something like a Java class containing only static methods and inner classes. Even this would be considered rebellious within the context of ordinary Java programming. -- .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:. talking about music is like dancing about

Re: Audio interviews of Guido or other Python advocates?

2004-12-04 Thread Dave Benjamin
In article [EMAIL PROTECTED], Fredrik Lundh wrote: Dave Benjamin wrote: I looked around for recordings of Guido, but couldn't find any. http://www.python.org/~guido/guido.au I found a few--slightly longer--video interviews here today: http://technetcast.ddj.com/tnc_catalog.html?item_id=90

Re: Audio interviews of Guido or other Python advocates?

2004-12-04 Thread Dave Benjamin
In article [EMAIL PROTECTED], Jimmy Retzlaff wrote: Dave Benjamin wrote: I looked around for recordings of Guido, but couldn't find any. Does anyone know of any streamable audio (or video) interviews or speeches featuring Guido, the bots, or any other interesting people in the Python