Re: Question about using python as a scripting language

2006-08-09 Thread Wildemar Wildenburger
Steve Lianoglou wrote: > Delaney, Timothy (Tim) wrote: >> This is just asking for trouble. >> >> my_list = eval('import shutil; shutil.rmtree('/')') > > Hah .. wow. > > And in related news: you still shouldn't be taking candy from > strangers. > > Point well taken. Thanks for flagging that one.

Re: singleton decorator

2006-08-09 Thread Wildemar Wildenburger
Pedro Werneck wrote: class Singleton(object): > ... def __new__(cls, *args, **kwds): > ... try: > ... return cls._it > ... except AttributeError: > ... cls._it = object.__new__(cls, *args, **kwds) > ... ret

Re: How to reverse tuples in a list?

2006-08-10 Thread Wildemar Wildenburger
Noah wrote (among other things ;)): > I have a list of tuples > I want to reverse the order of the elements inside the tuples. > But it seems like there should be a clever way to do this with > a list comprehensions. Problem is I can't see how to apply > reverse() to each tuple in the list becaus

Re: ALLAH

2006-08-10 Thread Wildemar Wildenburger
Sybren Stuvel wrote: > [EMAIL PROTECTED] enlightened us with: >> Kader; >> >> soru:madem,herþey bir kader defterinde yazýlý ve herþey ona göre >> oluyor.o halde insanlar niçin cehenneme gidiyor? >> cevap:evet herþey bir kader defterinde yazýlý ve herþey ona göre >> oluyor.ama,defterde yazýlý olduðu

Re: Question about using python as a scripting language

2006-08-10 Thread Wildemar Wildenburger
Carl Banks wrote: > Wildemar Wildenburger wrote: >> Heck, whenever *is* it OK to use eval() then? > > 2. When you construct Python code within your program using no > untrusted data Ok, I had never even thought of that. Makes me itch to try it right now :). wildemar -- http

Re: A Universe Set

2006-10-04 Thread Wildemar Wildenburger
Jorgen Grahn wrote: > - the wildcard object, which compares equal to everything else > - infinite xrange()s > - the black hole function 'def f(*args): pass' > - the identity function 'def f(x): return x' Any use cases for these? -- http://mail.python.org/mailman/listinfo/python-list

"filtered view" upon lists?

2006-09-12 Thread Wildemar Wildenburger
Hi there :) I don't know how else to call what I'm currently implementing: An object that behaves like a list but doesn't store it's own items but rather pulls them from a larger list (if they match a certain criterion). Changes to the filter are instantly reflected in the underlying list. Clear

Re: "filtered view" upon lists?

2006-09-12 Thread Wildemar Wildenburger
Jorge Godoy wrote: > Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > >> I don't know how else to call what I'm currently implementing: An object that >> behaves like a list but doesn't store it's own items but rather pulls them >> fro

Re: "filtered view" upon lists?

2006-09-12 Thread Wildemar Wildenburger
Steve Holden wrote: >> I think SQL views are the direct analog. >> > I don't think they are. If you add a non-conforming row to a SQL view it doesn't appear int he view. If you modify a row in an updateable view so it no longer confirms with the view's conditions it disappears from the view.

Re: "filtered view" upon lists?

2006-09-12 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > Note that if you just have to scan the "view list", then you can use > the lazy: > > itertool.ifilter(predicate, iterable) Yeah, had found that already; thanks anyway. This function is actually the very reason I'm even asking this: 'If the std libs solve this problem f

Ideas on interconnecting objects? (was: "filtered view" upon lists?)

2006-09-12 Thread Wildemar Wildenburger
> That's all very well, but you might want to Google for "YAGNI". :) > You still haven't given us mcuh of a clue about the real need. There is no "real need". I'm trying things, looking what works out eventually. I don't do that for a living (if I did, I'd be starved by now). Or do you mean the r

Re: Looking for the Perfect Editor

2006-09-13 Thread Wildemar Wildenburger
stu wrote: > jedit > > http://www.jedit.org/ Finally! I usually try to stay out of these discussions; yet I'm always disappointed at how few people seem to be using jEdit and how long it takes them to come out of their holes. So let me enforce that: jEdit www.jedit.org wildemar -- http://ma

Re: Looking for the Perfect Editor

2006-09-14 Thread Wildemar Wildenburger
> Hi Stu und "Willie", > "Willie"? Thats new. ;) > I will be running it under (sigh) Windows. So? Apart from Microsoft being evil and spying on you all the time, I find much satisfaction in the fact that Windows Just Works(tm). Linux on the other hand Just Barely Works(tm). Hello flamewar :).

Re: Looking for the Perfect Editor

2006-09-14 Thread Wildemar Wildenburger
Dick Moores wrote: >> to run a script.. you can 'dock' jython in the sides of the editor or >> bottom, and import from the buffer or load it.. or fire jython up from >> the plugin menu > > Doesn't sound easy. With UliPad (or IDLE, for that matter) just hit F5. Which you can do with jEdit just as

Re: Looking for the Perfect Editor

2006-09-14 Thread Wildemar Wildenburger
Ramon Diaz-Uriarte wrote: >> c) can run programs right from within > > But of course. And, contrary to some others (e.g., JEdit, which I > think forces you to use Jython, so you are stuck with Python 2.1 for > now) you use the current python interpreter you have installed. Wrong. But so terribly

Python for science (was: Re: Looking for the Perfect Editor)

2006-09-15 Thread Wildemar Wildenburger
David J. Braden wrote: > I've come to sense, in the last (many) threads and topics brought up > that I have read in the last 3 weeks, that this NG attracts folks who > are very much into the web-app interface potential and usefulness of > Python, as you yourself seem to be (see following), and o

Re: Looking for the Perfect Editor

2006-09-15 Thread Wildemar Wildenburger
Ramon Diaz-Uriarte wrote: > - I was referring to executing arbitrary sections of a Python file in > a Python interpreter in an "integrated way". When I tried JEdit, I > think that Jython was the way to go. (And I think this was also the > case for a while, at least to judge from D. Metrz's review >

Re: Pythondocs.info : collaborative Python documentation project

2006-09-16 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > I have read many messages of people complaining about the documentation, > it's lack of examples and the use of complicated sentences that you > need to read 10 times before understanding what it means. > Where have you read that? wildemar -- http://mail.python.org/mai

Re: Pythondocs.info : collaborative Python documentation project

2006-09-16 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > Rakotomandimby (R12y) wrote: >> What you should have done first is to suggest to contribute to the >> official Python doc. > > I wrote an email a few months ago to the Python docs support email > address to offer my help but never got any answer. > What did that email s

Re: Pythondocs.info : collaborative Python documentation project

2006-09-16 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > Hi, > > I am a bit disapointed with the current Python online documentation. I > have read many messages of people complaining about the documentation, > it's lack of examples and the use of complicated sentences that you > need to read 10 times before understanding what

Hardlinks on NTFS

2006-09-17 Thread Wildemar Wildenburger
Hi :) I'm thinking of letting my program create hardlinks (or symlinks). I know python allows doing this for ext, reiser and the like, but apparently not for ntfs systems. Is there any package out there that lets me create links in a platform independent way? bye wildemar -- http://mail.pytho

Re: Hardlinks on NTFS

2006-09-17 Thread Wildemar Wildenburger
Calvin Spealman wrote: > On 9/17/06, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: >> Hi :) >> >> I'm thinking of letting my program create hardlinks (or symlinks). I >> know python allows doing this for ext, reiser and the like, but >> apparently n

Re: Hardlinks on NTFS

2006-09-17 Thread Wildemar Wildenburger
Méta-MCI wrote: > Here, a copy of a message send on anither newsgroup (by me). > > Summary on hardlink & junction-point. > [snip] > http://support.microsoft.com/Default.aspx?kbid=205524 Yeah, I know :). Thanks a lot, anyway. There's also fsutils, which I thought about using. Creating the links r

Re: Hardlinks on NTFS

2006-09-17 Thread Wildemar Wildenburger
Dieter Deyke wrote: > This is my solution: > > import os > > def CreateHardLink(src, dst): > import ctypes > if not ctypes.windll.kernel32.CreateHardLinkA(dst, src, 0): raise OSError > > os.link = CreateHardLink Cool, thanks. :) wildemar -- http://mail.python.org/mailman/listinfo/pyt

Re: Help

2006-09-18 Thread Wildemar Wildenburger
Matimus wrote: >> Hi there, I am new in this subject so could you please tell me from >> where I can get help (or good e-book) of python? > http://www.diveintopython.org/ That did the trick for me. It is, however, "a Python book for experienced programmers" (quoted from website). Not too tough, b

Re: Pythonic way to condese my array

2006-09-20 Thread Wildemar Wildenburger
Robert Kern wrote: > Of course, code that I wouldn't get fired for would have a slightly greater > line > count and fewer one-letter variable names. Great :D! That one made me laugh! wildemar -- http://mail.python.org/mailman/listinfo/python-list

Re: Need some help here

2006-09-20 Thread Wildemar Wildenburger
Kareem840 wrote: > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. > And I need to get a bus. I mean literally. It's the b

Re: Upgrading question

2006-09-20 Thread Wildemar Wildenburger
Carl J. Van Arsdall wrote: > [EMAIL PROTECTED] wrote: >> i am working in unix and my Python version is 2.4.1 >> I would like to upgrade my version to 2.5 stable. but i have many >> scripts already running using 2.4.1. ... > > other than that change the link in /usr/bin/python to point to 2.5 > in

Re: naming objects from string

2006-09-20 Thread Wildemar Wildenburger
manstey wrote: > If I have a string, how can I give that string name to a python object, > such as a tuple. > > e.g. > > a = 'hello' > b=(1234) > > and then a function > name(b) = a > > which would mean: > hello=(1234) > > is this possible? > Direct answer: Look up the setattr() functions (D

Re: naming objects from string

2006-09-20 Thread Wildemar Wildenburger
manstey wrote: > Hi, > > But this doesn't work if I do: > > a=object() > x='bob' > locals()[x] = a > > How can I do this? You can. I just copy/pasted your code and it works fine here. (You are aware that there is whitespace before locals() that you have to remove before you feed it to the sn

Re: naming objects from string

2006-09-20 Thread Wildemar Wildenburger
Damjan wrote: > try > sys.modules[__name__].__dict__[x] = a @manstay: You see! Ugly, unreadable trickery! Hands off this stuff, bad mojo! You've been told three very different approaches now, which is a pretty good indicator that there is no obvious way to do it. Which means another angle to yo

Re: naming objects from string

2006-09-20 Thread Wildemar Wildenburger
manstey wrote: > Hi, > > thanks for the suggestions. this is my problem: > > I have a metadata file that another user defines, and I don't know > their structure in advance. They might have 300+ structures. the > metadata defines the name and the tuple-like structure when read by > python. > > m

Re: wxPython - very small frame

2006-09-20 Thread Wildemar Wildenburger
Francach wrote: > Hi, > > I'd like to create a very small Frame without the usual minimise and > maximise icons on the top. Does anyone know how to do this with > wxPython? I've tried creating a Frame with the style wx.DOUBLE_BORDER, > which gives me a nice small window. But I can't move it aroun

Re: Can I inherit member variables?

2006-09-21 Thread Wildemar Wildenburger
Bruno Desthuilliers wrote: > Gabriel Genellina wrote: >> When you construct an object instance, it is of a certain type from that >> precise moment, and you can't change that afterwards. > > Err... Actually, in Python, you can. It's even a no-brainer. Oh yeah, let's confuse the newbie, shall we :

Re: How to close the DOS Shell when starting a python script

2006-09-24 Thread Wildemar Wildenburger
Paddy wrote: > Rename the .py file with extension .pyw. > - Paddy. > To elaborate: This works because, by default, .py files are associated with python.exe and .pyw files are associated with pythonw.exe, the latter not opening a console window. You can actually run a .py file with pythonw.exe wi

Re: Advice for a novice on making ambitious cross-platform GUI app

2006-09-25 Thread Wildemar Wildenburger
Chelonian wrote: > Project: ambitious GUI program for Win/Mac/Linux. Target user: > average person. App to look elegant, and be intuitive, responsive, > exectuable, have its own icon, etc. Needs to store user info in large > database for the long term, run in the background and pop up at > assi

Re: ruby %w equivalent

2006-09-25 Thread Wildemar Wildenburger
MonkeeSage wrote: > hg wrote: >> But today ? what is the cost of replacing %w("blah blah") by >> Hi_I_Want_To_Split_The_String_That_Follows( "blah blah") > > How about r'blah', u'blah', """blah""", and '''blah'''. :) C'mon, the last two really don't count. wildemar -- http://mail.python.org/mai

Re: Howto pass Array/Hash into Function

2006-10-03 Thread Wildemar Wildenburger
MonkeeSage wrote: > Wijaya Edward wrote: >> I wonder how can that be done in Python. > > def myfunc(plain_var, hash_ref, arref): > # Do sth with those variables > return At the risk of being a jerk (sorry, I'm really just curious): Why isn't that obvious? wildemar (sorry) -- http://mail.pyt

Re: What kind of program is this

2006-10-04 Thread Wildemar Wildenburger
Fredrik Lundh wrote: > John Smith wrote: >> what kind of program is this? > > http://en.wikipedia.org/wiki/JAPH You computer guys crack me up! :D wildemar -- http://mail.python.org/mailman/listinfo/python-list

getting the reference count of an object ...

2006-03-03 Thread Wildemar Wildenburger
... how? I'm writing an app that holds a public data dictionary from which other objects obtain part of their __dict__ values so they all work on the same dataset (yes I'm fiendishly clever and a constructor of unreadable sentences (and code) ;)). My problem is that I haven't found an easy way

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-31 Thread Wildemar Wildenburger
Warren Stringer wrote: > i.prefer.dots-- no, seriously > > sure it's slow, but forces you the think about names in a new way. > Are you now suggesting that "addinfourl()" should actually be called "url()", placed in a module named "info", which is part of a package called "add", so as to

Re: call function in console without paranthesis

2007-05-31 Thread Wildemar Wildenburger
Troels Thomsen wrote: > Hello, > > I am wondering if I can write some code, that allows me to call functions in > the console , IDLE, without using the paranthesis notation. Like print. > This will improve "intreractive'ness" > Matlab-like, right? In a nutshell: No, not possible in python *its

Observer-Pattern by (simple) decorator

2007-06-01 Thread Wildemar Wildenburger
Hello folks :) This has got to be an FAQ, but somehow I can't seem to find an answer that I understand ... I thought: I'll just write a decorator that lets me react to method calls easily (the ever so popular observer-pattern). I've looked at some recepies, but I just don't get them (I'm feelin

Re: Observer-Pattern by (simple) decorator

2007-06-01 Thread Wildemar Wildenburger
Steven Bethard wrote: > I think you want to define __get__ on your Observable class so that it > can do the right thing when the method is bound to the instance: > > >>> class Observable(object): > [snip] > ... def __get__(self, obj, cls=None): > ... if obj is None: > ... re

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
David Wahler wrote: > Is this desired behavior? > > a = SomeActor() b = SomeActor() a.meth.observers is b.meth.observers > True > No it's not, but I get >>> a = SomeActor() >>> b = SomeActor() >>> a.meth.observers is b.meth.observers False I don't see how your

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
Peter Otten wrote: > Then you have modified the code posted by Steven Bethard. > > Oops. Indeed I did. I changed this >>> class Observable(object): ... def __init__(self, func, instance=None, observers=None): ... if observers is None: ... observers = [] ... self.

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
David Wahler wrote: > > Here's my attempt at an implementation that works as a decorator. It > stores the observers in a dictionary attribute of the instance, using > the method name as a key. For example: > > > [snip: another nice aproach] > Anyway, these are just my initial thoughts -- I don't

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
Peter Otten wrote: class Descriptor(object): > ... def __get__(*args): return object() > ... > class SomeActor(object): > ... meth = Descriptor() > ... > SomeActor.meth is SomeActor.meth > False > Of course ... Man, this lang

Re: Observer-Pattern by (simple) decorator

2007-06-02 Thread Wildemar Wildenburger
Steven Bethard wrote: > Wildemar Wildenburger wrote: > >>>>> class Observable(object): >>>>> >> ... def __init__(self, func, instance=None, observers=None): >> ... self.func = func >> ... self.instance =

Re: subexpressions (OT: math)

2007-06-03 Thread Wildemar Wildenburger
Gary Herron wrote: > Of course not! Angles have units, commonly either degrees or radians. > > However, sines and cosines, being ratios of two lengths, are unit-less. > >> To understand it: sin() can't have dimensioned argument. It is can't >> to be - sin(meters) >> >> > No it's sin(rad

Re: subexpressions (OT: math)

2007-06-03 Thread Wildemar Wildenburger
Gary Herron wrote: >> The radian is defined as the ratio of an arc of circumfence of a circle >> to the radius of the circle and is therefore *dimensionless*. End of story. >> http://en.wikipedia.org/wiki/Radian and esp. >> http://en.wikipedia.org/wiki/Radian#Dimensional_analysis >> >> >>

Re: subexpressions (OT: math)

2007-06-04 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > if you are discordant read more :P : > sine is a dimensionless value. > if we expand sine in taylor series sin(x) = x - (x^3)/6 + (x^5)/120 > etc. > you can see that sin can be dimensionless only if x is dimensionless > too. > > I am a professional physicist and a know ab

Re: subexpressions (OT: math)

2007-06-04 Thread Wildemar Wildenburger
Erik Max Francis wrote: > Wildemar Wildenburger wrote: > > >> So in each term of the sum you have a derivative of f, which in the >> case of the sine function translates to sine and cosine functions at the >> point 0. It's not like you're rid of the fu

Re: subexpressions (OT: math)

2007-06-04 Thread Wildemar Wildenburger
Peter Otten wrote: > With y = x^2 = 1/3 pi^2 - 4(cos x - cos(2x)/2^2 + cos(3x)/3^2 - ...) > > area is dimensionless, too, I suppose. > Ehr, ... maybe this is obvious, but I don't see it: Please explain the second equality sign. /W -- http://mail.python.org/mailman/listinfo/python-list

Re: subexpressions (OT: math)

2007-06-04 Thread Wildemar Wildenburger
Peter Otten wrote: > [EMAIL PROTECTED] wrote: > > >> sine is a dimensionless value. >> if we expand sine in taylor series sin(x) = x - (x^3)/6 + (x^5)/120 >> etc. >> you can see that sin can be dimensionless only if x is dimensionless >> too. >> > > With y = x^2 = 1/3 pi^2 - 4(cos x - cos(2

Re: Python, Dutch, English, Chinese, Japanese, etc.

2007-06-04 Thread Wildemar Wildenburger
Ross Ridge wrote: > Translating keywords and standard identifiers into Chinese could make > learning Python even more difficult. It would probably make things > easier for new programmers, but I don't know if serious programmers would > actually prefer programming using Chinese keywords. It would

Logic [WAS: Re: Who uses Python?]

2007-06-04 Thread Wildemar Wildenburger
Mark Carter wrote: > A woman from a job agency 'phoned me up the other day, and asked me if I > was any good with "algortihms". I told her that all programs are > algorithms, so the question didn't make that much sense. > > What does your "answer" have to do with the qustion, I wonder? She ask

Re: *Naming Conventions*

2007-06-04 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > On Jun 4, 12:20 am, Ninereeds <[EMAIL PROTECTED]> wrote: > >> First, for small loops with loop variables whose meaning is obvious >> from context, the most readable name is usually something like 'i' or >> 'j'. >> > > 'i' and 'j' are the canonical names for for lo

Re: *Naming Conventions*

2007-06-04 Thread Wildemar Wildenburger
Carsten Haese wrote: > On Mon, 2007-06-04 at 23:20 +0200, Wildemar Wildenburger wrote: > >> I guess it is commonplace to use i, j, k and n >> (maybe others) in constructs like >> >> for i in range(len(data)): >> do_stuff(data[i]) >> >> Or s

Re: *args and **kwargs

2007-06-05 Thread Wildemar Wildenburger
JonathanB wrote: > Ok, this is probably definitely a newbie question, but I have looked > all over the Python library reference material and tutorials which I > can find online and I cannot find a clear definition of what these are > and more importantly how to use them. From what I can tell from t

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: avoid script running twice

2007-06-18 Thread Wildemar Wildenburger
Robin Becker wrote: > I wish to prevent a python script from running twice; it's an hourly job, but > can take too long. > > [snip] > but it occurs to me that I might be killed with prejudice during the long > running work(). Is there a smart way to avoid running simultaneously. > Well I can

Re: jedit - auto code completetion

2007-06-19 Thread Wildemar Wildenburger
Libertarian wrote: > Does it have a plug-in for python code completetion ? > Yes. /W -- http://mail.python.org/mailman/listinfo/python-list

Re: How does py2exe work?

2007-07-01 Thread Wildemar Wildenburger
Thomas Jollans wrote: > On Sunday 01 July 2007, vasudevram wrote: > >> Wondering how it works? Does it actually compile the Python source of >> your script into machine language, or does it do something more like >> bundling the Python interpreter, the Python libraries and the script >> itself,

Re: list.append not working?

2007-07-05 Thread Wildemar Wildenburger
7stud wrote: > Hardy wrote: > >> I experience a problem with append(). This is a part of my code: >> >> for entity in temp: >> md['module']= entity.addr.get('module') >> md['id']=entity.addr.get('id') >> md['type']=entity.addr.get('type') >>

Re: list.append not working?

2007-07-05 Thread Wildemar Wildenburger
Abhishek Jain wrote: > with every iteration your previous values are overwritten ('md' is a > dictionary) so thats why your are observing this ouput.. > > check if the following patch solves your problem > > for entity in temp: > md['module']= entity.addr.get('module') > m

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Wildemar Wildenburger
Nis Jørgensen wrote: > Neil Cerutti skrev: > > >> Mostly you can use the default 'excel' dialect and be quite >> happy, since Excel is the main reason anybody still cares about >> this unecessarily hard to parse (it requires more than one >> character of lookahead for no reason except bad design

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-07-08 Thread Wildemar Wildenburger
David Kastrup wrote: > Twisted <[EMAIL PROTECTED]> writes: > >> Judging by the existence of the newsgroup comp.emacs, emacs is >> indeed considered by some to be a quite valuable antique. Otherwise >> why on earth would it have an apparently fairly active newsgroup a >> full seven years into the

Re: Distributing python apps

2007-07-10 Thread Wildemar Wildenburger
Robert Dailey wrote: > Thanks a ton guys. You both gave me the exact answers I was looking > for. > > Uhm, late entry here, but you might want to consider PyInstaller . Not sure if the project is still alive as I see no mention of Python 2.5 on their sit

Re: Lists in classes

2007-07-12 Thread Wildemar Wildenburger
Bart Ogryczak wrote: > On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > >> Hello, >> >> Learning python from a c++ background. Very confused about this: >> >> >> class jeremy: >> list=[] >> > > You've defined list (very bad choice of a name, BTW), as a class

[Fwd: RE: Lists in classes]

2007-07-12 Thread Wildemar Wildenburger
m Pletcher <[EMAIL PROTECTED]> To: Wildemar Wildenburger <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> I'm curious (and somewhat new to Python)... What's the benefit of inheriting from 'object'? The docs aren't clea

Re: [Fwd: RE: Lists in classes]

2007-07-12 Thread Wildemar Wildenburger
Adam Pletcher wrote: > I'm curious (and somewhat new to Python)... What's the benefit of > inheriting from 'object'? > > The docs aren't clear on that, nor is that used in the class examples > I've seen. > Thanks in advance. > Well, they are, but they are just not well integrated. Which they, t

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wildemar Wildenburger
Chris Carlen wrote: > Let's go back the statement: > > x = [1,2,3] > > Do we then say: "[1,2,3] is x" or is it the other way around: "x is > [1,2,3]" ??? > This will yield 'False', because 'is' checks for *identity* not equality. In your case you assign a list the name 'x' and then check (via

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wildemar Wildenburger
Wildemar Wildenburger wrote: > x = [1, 2, 3] > y = [1, 2, 3] > id(x), id(y) > x == y > x is y > Ooops! Make that: x = [1, 2, 3] y = [1, 2, 3] id(x); id(y) x == y x is y (had to be a semicolon there) -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wildemar Wildenburger
Wayne Brehaut wrote: >> (had to be a semicolon there) >> > > Not "had to be" since a discerning reader will note that the two > values in the list: > > >>> id(x), id(y) > (19105872, 19091664) Wll, as long as we are nitpicking: That's a tuple, not a list. ;) /W -- http://mail

Re: questions about functions inside a function

2007-07-16 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > I want to create a list of function. > > Here is my code: > In [9]: a = [] > > In [10]: for i in range(4): > : b = lambda : i**2 > : a.append(b) > : > : > > In [11]: for f in a: > : f() > : > : > 9 > 9 >

Re: questions about functions inside a function

2007-07-16 Thread Wildemar Wildenburger
Wildemar Wildenburger wrote: >> for f in a: >> print f() >> 0 >> 1 >> 4 >> 9 >> >> How to achieve this? >> >> Thanks a lot! >> >> >> > I fail to see the point, sorry. Why would you want that? If y

Re: a=0100; print a ; 64 how to reverse this?

2007-07-17 Thread Wildemar Wildenburger
Bruno Desthuilliers wrote: > mosi a écrit : > >> Problem: >> how to get binary from integer and vice versa? >> [snip] >> What`s the simplest way to do this? >> > > [EMAIL PROTECTED]:~$ python > Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) > [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2

Re: The Modernization of Emacs: exists already

2007-07-18 Thread Wildemar Wildenburger
Rustom Mody wrote: > But how does posting an emacs related question help on a python mailing list?? > One Word: Ego. Don't reply. /W -- http://mail.python.org/mailman/listinfo/python-list

Re: Charlotte Python Group

2007-07-18 Thread Wildemar Wildenburger
Calvin Spealman wrote: > I am looking to start a meetup in or near Charlotte. I already have a > couple people interested, and I see some folks subscribing to new > python groups on meetup. If I can find a few more people, it could be > worth it. > > Is anyone in the area and interested in a group?

Threading XL [was: Re: The Modernization of Emacs: exists already]

2007-07-18 Thread Wildemar Wildenburger
Rustom Mody wrote: > Eh? Me? you?? Who??? > Did I say something offensive? Sorry if I did... but I dont understand... > > No no, it's cool. Maybe I was a little too terse. Xah Lee likes to crosspost his pseudo-philosophical tech-musings to several discussion groups at regular intervalls. He's

(Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-17 Thread Wildemar Wildenburger
To make it short: Is there something like this already? There seem to loads of python frameworks for Web-Apps, but I have a hard time finding one for desktop-apps. I imagine it wouldn't be too hard (if still time consuming) whipping up something simple myself, but I thought, I'd ask here before

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-17 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: >> There seem to loads of python frameworks for Web-Apps, but I have a hard >> time finding one for desktop-apps. >> I imagine it wouldn't be too hard (if still time consuming) whipping up >> something simple myself, but I thought, I'd ask here before diving into it. >>

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Jarek Zgoda wrote: > There are few GUI frameworks building on various toolkits. I used to use > Kiwi for PyGTK, it's mature and stable, although the approach is not the > same as, for example, Delphi Thanks for the effort, but I think I'm not well understood. I'm not looking for a GUI framework (w

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Jarek Zgoda wrote: >> I've never used Eclipse (beyond proving that it runs on various >> computers). Can you please describe what behaviour you're looking for? >> > > The key is not "Eclipse" itself, but the whole Eclipse Platform. > > See http://wiki.eclipse.org/index.php/Rich_Client_Platform

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
stefaan wrote: >> To make it short: Is there something like this already? > > To make it short again: http://code.enthought.com/ets/ > > Nice, seems very interesting. Bit of a bitch to set up, as it appears from scanning the site, but that might be it. Thanks :) Now for the everlasting circle

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Stef Mientki wrote: > I took a look at Eclipse page you mentioned but after reading the first page > I still don't > understand what you mean (and I never read beyond the first page ;-). > Well, what can I say ... ;) > With a plugin system, I can think of a complete operating system, > or I

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Peter Wang wrote: > Actually, just this week, we completed a major SVN reorganization and > from this point forward, all of the libraries in ETS will be released > as eggs. In fact, eggs have been available for a long time for python > 2.4, and now we have them for python 2.5 as well. > > I'm n

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-19 Thread Wildemar Wildenburger
Ben Finney wrote: > You already have Python, and can embed it in your program. The only > missing piece seems to be the primitive operations at the core, which > surely depend on what exactly it is you have in mind for your program > and can't really be provided in a generic form by some other part

Re: questions about programming styles

2007-05-21 Thread Wildemar Wildenburger
[EMAIL PROTECTED] wrote: > Thanks a lot for all kind replies! > > I think I need a systematic learning of design patterns. I have found > some tutorials > about design pattern about python, but can somebody point me which is > the best to start with ? > When you say "Design Patterns", what do

Re: NEWBIE: Extending a For Statement.

2007-05-21 Thread Wildemar Wildenburger
Dustan wrote: (key, mydict[key] for key in mydict if key in xrange(60, 69) or key == 3] > File "", line 1 > (key, mydict[key] for key in mydict if key in xrange(60, 69) or > key == 3] > ^ > SyntaxError: invalid syntax > > Perhaps you meant that secon

[Fwd: Re: managed lists?]

2007-05-21 Thread Wildemar Wildenburger
I answered off list (because besically I'm an idiot). So if you like, read up the current news. :) Original Message Subject:Re: managed lists? Date: Mon, 21 May 2007 21:30:37 +0200 From: Jorgen Bodde <[EMAIL PROTECTED]> To: Wildemar Wildenbur

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Wildemar Wildenburger
Bruno Desthuilliers wrote: > here's an example using a property: > > class cpu_ports(object): > def __init__(self, value=0): > self._d = value > @apply > def value(): > def fset(self, value): > print 'vv' > self._d = value > def fget(self)

Re: Basic Class/Instance Question

2007-05-23 Thread Wildemar Wildenburger
Antoon Pardon wrote: >> This is a FAQ. Default arguments are only evaled once - when the def >> statement is evaled (which is usually at import time). The solution is >> simple: don't use mutable objects as default arguments: >> > > An immutable object would have given the same behaviour in

Re: Module listing in order.

2007-05-23 Thread Wildemar Wildenburger
Ramashish Baranwal wrote: > I want a way to get the contents in the order of their declaration, > i.e. [B, A, D]. Does anyone know a way to get it? > My suggestion would be to actually parse the text of the module. "Brute force" is what it's called ;). But doing so with, say, pyparsing shouldn

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Wildemar Wildenburger
Diez B. Roggisch wrote: > It is that very apply. > > And apply takes a function as argument + additional arguments, and executes > that function, returning the result of that function-call. It was used > before the > > f(*args, **kwargs) > > notation was introduced. > > Now what we have here is "v

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Wildemar Wildenburger
Diez B. Roggisch wrote: > Deprecated doesn't mean it's not available. Is that so? ;) But it certainly means that some time in the not-too-distant future "apply" will vanish. > And even if it goes away, > you can simply write it yourself: > > def apply(f, *args, **kwargs): > return f(*args,

Re: Module listing in order.

2007-05-25 Thread Wildemar Wildenburger
Peter Otten wrote: > Ramashish Baranwal wrote: > > I want a way to get the contents in the order of their declaration, i.e. [B, A, D]. Does anyone know a way to get it? >>> My suggestion would be to actually parse the text of the module. "Brute >>> force" is what it's cal

Re: ten small Python programs

2007-05-27 Thread Wildemar Wildenburger
Steve Howell wrote: > # def defines a method in Python > def say_hello(name): > print 'hello', name > say_hello('Jack') > say_hello('Jill') > Doesn't def define methods *xor* functions, depending on the context? And in this example, say_hello (*yuck*, underscores ...) is

Re: Rats! vararg assignments don't work

2007-05-30 Thread Wildemar Wildenburger
George Sakkis wrote: > The time machine did it again: http://www.python.org/dev/peps/pep-3132/. > > Uhm, John Swartzwelder, right? :D /W -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >