Re: What's in a name?

2011-08-09 Thread Ron
On Aug 1, 10:11 am, Andrew Berg wrote: > Hmm > How about Rainbow Video Encoder Wrapper (Rainbow View for short - RView > is taken, possibly multiple times)? > I added an arbitrary word to a generic name, and the result doesn't seem > to be taken by anything software-related. It wraps more than

Re: Segmentation Fault on exit

2011-08-10 Thread ron
On Aug 6, 6:35 am, Vipul Raheja wrote: > Hi, > > I have wrapped a library from C++ to Python using SWIG. But when I > import it in Python, I am able to work fine with it, but it gives a > segmentation fault while exiting. Following is the log: > > vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$ p

learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Ron
Hey everyone. I've written an online interactive Python tutorial atop Google App Engine: http://www.learnpython.org. All you need to do is log in using your Google account and edit the wiki to add your tutorials. Read more on the website. Thanks for your help, and I would appreciate if you he

Re: learnpython.org - an online interactive Python tutorial

2011-04-20 Thread Ron
Thanks! :) -- http://mail.python.org/mailman/listinfo/python-list

Tix BUG? Where to submit?

2005-11-14 Thread Ron
oversight? Anyway, where would I subit this report to have it considered that this be added to Tix? Thanks for your help. Ron Provost -- http://mail.python.org/mailman/listinfo/python-list

Application Plugin Framework

2005-11-21 Thread Ron
Hello, I'm attempting to develop a plugin framework for an application that I'm working on. I wish to develop something in which all plugins exist in a directory tree. The framework need only be given the root of the tree. The framework then uses os.path.walk to search all for all files nam

Getting the process list on win98

2005-03-14 Thread Ron
I've written a screen saver which opens multiple copies on windows 98. I'm trying to check the process list to determine if it is already running. So far all the example win32 routines I've found, through google, only work on newer xp and nt versions of windows. This is the current attempt to g

Re: Beware complexity

2005-03-14 Thread Ron
document_reader # script to read and search all doc files # and run related examples scripts. core tools examples docs Ron -- http://mail.python.org/mailman/listinfo/python-list

__getitem__ method on (meta)classes

2005-03-14 Thread ron
Why doesn't this work? >>> def foo(lst): ... class baz(object): ... def __getitem__(cls, idx): return cls.lst[idx] ... __getitem__=classmethod(__getitem__) ... baz.lst = lst ... return baz ... >>> f = foo([1,2,3]) >>> f[0] Traceback (most recent call last): File "", line 1, in ? T

Re: Getting the process list on win98

2005-03-15 Thread Ron
Thanks for the reply Roger, Since will put this on my web site for general use, I don't want users to have to install additional software. I'll try win32com.client.Dispatch('Wbemscripting.Swbemlocator') see what that does. As a last resort, I use a registry key as a run status varable. Not my

Re: Getting current variable name

2005-03-16 Thread Ron
pl wrote: Hi all, I followed the mails entitled 'How to turn a variable name into a string?' in march 2005 posts as I have a similar problem. Use the locals() function instead of globals(). Thanks by the way, I was wondering how to do this also, your post, and Daniel pointing out 'is', helped me w

Re: Getting current variable name

2005-03-17 Thread Ron
Jeff Shannon wrote: Are you sure that you really need that single-element list? No I'm not sure, I thought I found a concdition where it made a difference while playing with it, but I don't recall just what circumstance it was? Don't forget, in Python, all names are references. You only have to

Re: Simple account program

2005-03-17 Thread Ron
Igorati wrote: Hello all, I am still needing some help on this code, I have gone a bit further on it. Thank you for the help. I am trying to understand how to make the file searchable and how I am to make the deposit and withdrawl interact with the transaction class. I need to just search the file

Re: Simple account program

2005-03-17 Thread Ron
The indentation got messed up a bit, it should look like this. class Transaction: def __init__(self): self.name = '' self.amount = 0.0 self.type = '' class Account: def __init__(self, name=''): self.name = name self.ledger = [] def newtransaction(self

Re: survey of modules to be added to stdlib

2005-03-18 Thread Ron
On 18 Mar 2005 14:16:01 -0800, "Alia Khouri" <[EMAIL PROTECTED]> wrote: >This is an informal survey to gauge the community's interest in adding >popular modules to the python standard library. I would prefer to have a install utility included that retrieves a list of modules we can install, updat

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Ron
values) mydict = NumDict() n = 0 for k in list('abcdefg'): n += 1 mydict[k] = n print mydict # {'a': 1, 'c': 3, 'b': 2, 'e': 5, 'd': 4, 'g': 7, 'f': 6} mydict.count('c') mydict['e'] = [&#x

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Ron
def appendlist(self, key, *values): >try: >self[key].extend(values) >except KeyError: >self[key] = list(values) Why is it better than this? dict[key]+=n dict[key]+=list Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-20 Thread Ron
ries that auto defaults to a mode that doesn't behave that way is inconsistent with the rest of the language. Yet, I'm all for the creation of specialized containers in a standard module! :) Then we can have string dicts, and int dicts, and card dicts, account dicts, etc, as well as specialized lists. Call them 'smart containers'. But they should not be built into the base class. Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: For loop extended syntax

2005-03-21 Thread Ron
On Sun, 20 Mar 2005 13:16:37 -0500, "George Sakkis" <[EMAIL PROTECTED]> wrote: >I'm sure there must have been a past thread about this topic but I don't know >how to find it: How >about extending the "for in" syntax so that X can include default >arguments ? This would be very >useful for list/

Re: missing? dictionary methods

2005-03-21 Thread Ron
On 21 Mar 2005 08:21:40 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >Well at least I find them missing. > >For the moment I frequently come across the following cases. > >1) Two files, each with key-value pairs for the same dictionary. >However it is an error if the second file contains a key th

Re: getting text from WinXP console

2005-03-21 Thread Ron
he screen, convert the graphic image to text and put it on the clipboard. They work fairly well. Most of them aren't free. But a shareware version with a limited trial period might work just fine for this one purpose. Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: For loop extended syntax

2005-03-21 Thread Ron
padlist(xyz,3,0) for xyz in [1,2,3],[3,4],[5,6,7]]: print x,y,z Which isn't too different from what you are suggesting. I think someone may have already suggested using list comprehensions. Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Anonymus functions revisited

2005-03-22 Thread Ron
On 21 Mar 2005 22:37:42 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: >Mappings like that: > > ((x,y),z) -> x+y-z > > ((x,y=0),z) -> None > >should be valid actions too. > >What is the audience thinking about that? I think that there's too much implied, and that in the long run it, if w

Re: Anonymus functions revisited

2005-03-22 Thread Ron
quot; >> fn( ( dfv(filterc='d'), evalstring), (exec estring) ) So we need to use a three item tuple: safe_exec ( (*inputs) , (expressionstring) , ( *outputs) ) >> def dfv( arg = value): return arg >> x, y = 1, 2 >> safeexec( (x, y, dfv(z=0)),

Re: Anonymus functions revisited

2005-03-22 Thread Ron
On Tue, 22 Mar 2005 21:43:48 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Ron a écrit : >(snip) >>>>def dfv( arg = value): >> >> return arg > > > >>> def dfv( arg = value): >... return arg >... >Tracebac

Re: Anonymus functions revisited

2005-03-22 Thread Ron
On Tue, 22 Mar 2005 21:56:57 GMT, Ron <[EMAIL PROTECTED]> wrote: >Why should a function not create a local varable of an argument if the >varable doesn't exist and a default value is given? ok... thought it out better. :) Getting a default into a function isn't the proble

Regular Expressions

2005-03-22 Thread Ron
nerator I have for C++ and it works just fine. Any thoughts on what I'm doing wrong in the Python Reg Ex world? Thanks for the comments & help. Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Anonymus functions revisited

2005-03-22 Thread Ron
On Tue, 22 Mar 2005 18:15:25 -0500, "George Sakkis" <[EMAIL PROTECTED]> wrote: >"Ron" <[EMAIL PROTECTED]> wrote: >> On Tue, 22 Mar 2005 21:56:57 GMT, Ron <[EMAIL PROTECTED]> wrote: >> >> >Why should a function not create a local

Re: Anonymus functions revisited

2005-03-22 Thread Ron
On Tue, 22 Mar 2005 21:45:42 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Ron a écrit : >> On 21 Mar 2005 22:37:42 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> >> wrote: >> >> >>>Mappings like that: >>> >>> ((x,

Re: Anonymus functions revisited

2005-03-23 Thread Ron
On 23 Mar 2005 10:13:16 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Do I really need to mention that the whole concept here is broken. This >only works if you call it from global scope. If you call it from inside a >function it [usually] won't work: That's only becuase it was asked to go up

Re: Anonymus functions revisited

2005-03-23 Thread Ron
On 23 Mar 2005 10:13:16 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Do I really need to mention that the whole concept here is broken. This >only works if you call it from global scope. If you call it from inside a >function it [usually] won't work: Ok... you can get globals this way if you k

Re: Anonymus functions revisited

2005-03-23 Thread Ron
On 23 Mar 2005 14:47:30 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Kay Schluehr wrote: > >> A working makeVars seems not to be different from >> >> def makeVars(**nameVals): >>globals().update(nameVals) > >Not quite. If Ron can come up w

Re: Anonymus functions revisited : tuple actions

2005-03-23 Thread Ron
On Wed, 23 Mar 2005 06:21:30 +0100, Kay Schluehr <[EMAIL PROTECTED]> wrote: >I think my proposal was more in mind of Rons modified exec than >Pythons lambda. > >When George proposed his unpacking behavoir for list-comps as a pack of >suggar: > >1. [x*y-z for (x,y,z=0) in (1,2,3), (4,5), (6,7,8)] >

Re: Changing the value of a for loop index on the fly

2005-03-23 Thread Ron
On Wed, 23 Mar 2005 23:27:54 +0100, "Gabriel F. Alcober" <[EMAIL PROTECTED]> wrote: >Hi! There goes a newbie trouble: > >for i in range(0, len(subject)): >if subject[i] in preps: >psubject.append(noun_syn_parser(subject[0:i])) >subject[0:i] = [] > >Since the last li

Re: Changing the value of a for loop index on the fly

2005-03-23 Thread Ron
On Thu, 24 Mar 2005 03:42:04 GMT, Ron <[EMAIL PROTECTED]> wrote: >On Wed, 23 Mar 2005 23:27:54 +0100, "Gabriel F. Alcober" ><[EMAIL PROTECTED]> wrote: > >>Hi! There goes a newbie trouble: >> >>for i in range(0, len(subject)): >>

Re: Anonymus functions revisited

2005-03-24 Thread Ron
On 24 Mar 2005 09:20:52 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Ron wrote: > >>>> A working makeVars seems not to be different from >>>> >>>> def makeVars(**nameVals): >>>>globals().update(nameVals) >>> >>&g

Re: Anonymus functions revisited : tuple actions

2005-03-24 Thread Ron
On Thu, 24 Mar 2005 12:07:44 -0500, "George Sakkis" <[EMAIL PROTECTED]> wrote: >"Kay Schluehr" <[EMAIL PROTECTED]> wrote: >> [snipped] >> >> Wouldn't it be fun to use in Python? >> >> Only drawback: does not look like executable pseudo-code anymore :( >> >> >> Regards Kay > >I don't know if it wou

serial module NEWBE HELP!

2005-03-29 Thread Ron
Is this built into any of the python versions? Need it! Using 2.3.5 and doesn't seem to have it.Newbe needs help!email[EMAIL PROTECTED] Thanks Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-19 Thread Ron
Kay Schluehr wrote: Steven Bethard wrote: So the object of a "where" is then always an ordered dict? Yes. If so, then I guess I like this proposal best so far. However, it does seem to have the problem that you can't have any additional local variables so, for example, list comprehensions are pr

Re: pre-PEP: Simple Thunks

2005-04-20 Thread Ron
you are correct. :-/ I was trying to not use eval(). This could be made to work, but it will get messy, which is another reason not to do it. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-20 Thread Ron
Steven Bethard wrote: Ron wrote: How about using ***name in the same way as *name, and **name are used? It extends the current argument options in a consistent manner and 'I believe' is easy to explain and visually says something different is happening here. This builds on the alrea

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Ron
[EMAIL PROTECTED] wrote: Many people I know ask why Python does slicing the way it does. Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring[:4] gives me elements 0, 1, 2 and 3 but *NOT* mystring[4] (5th element). Many people don't like idea that 5th elemen

Re: goto statement

2005-04-21 Thread Ron
pple soft basic to remember what I couldn't do. Part of the reason for the spaghetti code was that with line numbers it's easier to tack on something to the end than it is to change all the line numbers if you didn't allow for room. I for one, don't miss goto's or line

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Ron
Ron wrote: [EMAIL PROTECTED] wrote: Many people I know ask why Python does slicing the way it does. Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring[:4] gives me elements 0, 1, 2 and 3 but *NOT* mystring[4] (5th element). > There are ac

Re: Variables

2005-04-23 Thread Ron
or decide for ourself) to give to the name "foo". So what is the meaning of foo? In general computer discussions foo is ever changing and represents an abstract object to be used and reused to describe a multitude of possibilities. I would call that a variable. ;-) Cheers, Ron -- http

Re: Injecting code into a function

2005-04-25 Thread Ron
s as well. :) I think you will have to modify the function func in some way to get locals when it exits. def func(): x = 20 y = 40 func.locals = locals() # inserted line func() print func.locals On a related note, I'd like to know how to import locals into a function. Chee

Re: How to run Python in Windows w/o popping a DOS box?

2005-04-25 Thread Ron
Bengt Richter wrote: I don't know what pythonw.exe does with std i/o that hasn't been intercepted, but I would think it could be handy to have it force a console window, and maybe have a pythonw.exe command line option to dump either or both stdout and stderr silently. That way by default you'd see

Re: Fast plotting?

2005-04-26 Thread Ron
Russell E. Owen wrote: Can anyone recommend a fast cross-platform plotting package for 2-D plots? Our situation: We are driving an instrument that outputs data at 20Hz. Control is via an existing Tkinter application (which is being extended for this new instrument) that runs on unix, mac and wi

Re: How do I automate the removal of all non-ascii characters from my code?

2011-09-13 Thread ron
On Sep 12, 4:49 am, Steven D'Aprano wrote: > On Mon, 12 Sep 2011 06:43 pm Stefan Behnel wrote: > > > I'm not sure what you are trying to say with the above code, but if it's > > the code that fails for you with the exception you posted, I would guess > > that the problem is in the "[more stuff her

Re: Python without a tty

2011-09-29 Thread ron
On Sep 29, 5:21 am, Steven D'Aprano wrote: > I have a Python script which I would like to test without a tty attached > to the process. I could run it as a cron job, but is there an easier way? > > I am running Linux. > > -- > Steven Have you tried GNU Screen? It let's you run processes under vi

Django ported to Python3!

2011-12-02 Thread Ron
It looks like Vinay Sajip has succeeded in porting Django to Python3 (in a shared code base for Python 3.2 and Python 2.7). This is an astoundingly good job, done very fast and is big news. See https://groups.google.com/forum/#!topic/django-developers/XjrX3FIPT-U and the actual code is at Bitbucket

Re: Django ported to Python3!

2011-12-03 Thread Ron
s Python 3. And many Python folks will finally start to take Python 3 seriously only when Django does announce official support. Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: LinuxJournal Readers' Choice Awards 2011 Best {Programming, Scripting} Language

2011-12-05 Thread Ron
Hello Wesley, Thanks for the interesting news from Linux Journal. Now, enquring minds want to know, when will there be a Core Python 3? Ron :-) -- http://mail.python.org/mailman/listinfo/python-list

Sikuli: the coolest Python project I have yet seen...

2010-01-24 Thread Ron
Sikuli is the coolest Python project I have ever seen in my ten year hobbyist career. An MIT oepn source project, Sikuli uses Python to automate GUI tasks (in any GUI or GUI baed app that runs the JVM) by simply drag and dropping GUI elements into Python scripts as function arguments. Download at h

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-25 Thread Ron
non-deterministic. I am in the analog engineering world and simple, deterministic black and white situations are all fine and useful, but I can see this very easy to use and simple technology being useful also ;-)) All of the above apps are but a few lines of code. Ron -- http://mail.python.org

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-25 Thread Ron
OK, here's an idea. I used to do screen scraping scripts and run them as CGI scripts with an HTMl user interface. Why not run Sikuli on Jython on a JVM running on my server, so that I can do my screen scraping with Sikuli? I can take user inputs by using CGI forms from a web client, process the req

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-26 Thread Ron
On Jan 26, 10:59 am, CM wrote: > On Jan 24, 10:18 pm, Ron wrote: > > > Sikuli is the coolest Python project I have ever seen in my ten year > > hobbyist career. An MIT open source project, Sikuli uses Python to > > automate GUI tasks (in any GUI or GUI based app that run

pyOpenGL Error unable to detect undefined names

2010-12-02 Thread Ron
OpenGL_accelerate.numpy_formathandler (src\numpy_formathandler.c:3543) ValueError: numpy.dtype does not appear to be the correct type object The code is very simple all I have is two import statements: from OpenGL.GLU import * from OpenGL.GL import * The code analysis says that it is "unable to dete

Python for MultiTouch!

2010-08-17 Thread Ron
Along with the news of Unbuntu supporting multitouch, I saw this and just had to share, I think its really nice: PyMT http://the-space-station.com/2010/8/16/python-multitouch:-pymt-0-5-released -- http://mail.python.org/mailman/listinfo/python-list

scrapelib for web scraping

2010-08-17 Thread Ron
Shameless plug for a web scraping tool my son is involved in creating, called scrapelib. He is on leave from university and is a consultant for the Sunlight Foundation creating something called the Fifty States Project to monitor lobbyist money to state governments in the USA. http://github.com/mi

Podcast about Python's versions and implementations

2010-08-17 Thread Ron
New podcast up is a look at the various versions and implementations of Python, including Python 3, Python 2, PyPy, IronPython, Jython, Stackless, Psycho, Shedskin, Cython, Unladen Swallow, Berp, etc. http://www.awaretek.com/python/ Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: logger doesn't roll over

2012-11-21 Thread Ron Eggler
Hooops sh*t! I outsmarted myself I guess... :o However, Thanks for the kick GC! Ron Eggler 1804 - 1122 Gilford St. Vancouver, BC V6G 2P5 (778) 230-9442 On 12-11-21 11:41 AM, Gary Chambers wrote: Ron, LOGFILE, maxBytes=(1048576*10), backupCount=5 What am I doing wrong here, I don't g

serial module

2012-05-18 Thread Ron Eggler
onnections (the parameters differs on the device # you are connecting to) ser = serial.Serial( port='/dev/ttyUSB0', baudrate=19200, parity=serial.PARITY_ODD, stopbits=serial.STOPBITS_TWO, bytesize=serial.SEVENBITS ) ser.open() Why do I get this error? Thank

Re: serial module

2012-05-22 Thread Ron Eggler
Grant Edwards wrote: > On 2012-05-19, Paul Simon wrote: >> "Ron Eggler" wrote: > >>> [...] my code looks like this: > >>> #!/usr/bin/python > [...] >>>port='/dev/ttyUSB0', > >> Sounds like you may be using t

Modify Python code as newbie

2020-01-17 Thread ron . eggler
Hi, I'm semi new to Python but need to modify a program that calls the mqtt_client.publish() function from aws iot. Now, if the publish function fails, it raises an exception. I need to change the code so that when an exception is raised, instead of giving up, it should retry. Here's some sem

modify python code as newbie

2020-01-17 Thread ron . eggler
Hi, I'm semi new to Python but need to modify a program that calls the mqtt_client.publish() function from aws iot. Now, when the publish function fails, it raises an exception. I need to change the code so that when an exception is raised, instead of giving up, it should retry (indefinitely)

Re: Question About Logic In Python

2005-09-22 Thread Ron Adam
Terry Hancock wrote: > On Thursday 22 September 2005 12:26 pm, Ron Adam wrote: > >>Steve Holden wrote: >> >>>Ron Adam wrote: >>> >>>> >>> True * True >>>>1 # Why not return True here as well? >>>>

Re: Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread Ron Adam
For complete domain details go to: http://whois.godaddy.com You can find out more by following the godaddy link or just go here and enter the numbers displayed to access it. https://www.godaddy.com/gdshop/whois.asp?se=%2B&domain=LIAGE%2Enet&ci=1718 Maybe an email to the

Re: What is "self"?

2005-09-22 Thread Ron Adam
t;self" becomes a reference to the class instance it is in. self.name = name is the same as ... leader.name = name But we didn't know it was going to be called "leader" when we wrote the class. So self is a convienent place holder. I hope this helped. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread Ron Adam
/www.godaddy.com) Domain Name: LIAGE.NET Created on: 18-Mar-05 Expires on: 18-Mar-06 Last Updated on: 20-Jun-05 Administrative Contact: Linden, James [EMAIL PROTECTED] <--- lindensys.net not found --- The web site at tictek give the same exact under construction notice as LIAGE.NET. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: What is "self"?

2005-09-23 Thread Ron Adam
Erik Max Francis wrote: > Ron Adam wrote: > >> When you call a method of an instance, Python translates it to... >> >> leader.set_name(leader, "John") > > > It actually translates it to > > Person.set_name(leader, "John")

Re: Finding where to store application data portably

2005-09-23 Thread Ron Adam
g. Every user account would be a complete unit which can be backed up and restored independently of the OS. If something went wrong you could always find out which user (or application developer) was responsible. Anyway... just wishful thinking. I'm sure there are a lot of problems that would need to be worked out. ;-) Cheers, Ron Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically adding and removing methods

2005-09-25 Thread Ron Adam
) beacon + 3 >>> del beacon >>> dir(A) ['__doc__', '__module__', 'beacon', 'ham', 'spam'] >>> A.beacon(3) beacon + 3 >>> dir(C) ['__doc__', '__module__', 'beacon', 'ham', 'spam'] Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: What is "self"?

2005-09-25 Thread Ron Adam
_["set_name"].__get__(leader, "John") # which results in... #Person.set_name(leader, "John") except: raise( AttributeError, "%s object has no attribute %s" \ % (leader, "set_name&

Re: What is "self"?

2005-09-27 Thread Ron Adam
e" for more information. >>> class a(object): ... def b(self, value): ... print value ... >>> aa = a() >>> def foo(value): ...print "%r" % value ... >>> aa.b('hello') hello >>> aa.b = foo >>> aa.b('hello') 'hello' >>> del aa.b >>> aa.b('hi there') hi there >>> So the underlying mechanism for calling methods doesn't kick in until *after* an attempt to get an attribute of the same name in the instance. >>> a.boo = boo >>> def boo(self, value): ...print list(value) ... >>> a.boo = boo >>> aa.boo('hello') ['h', 'e', 'l', 'l', 'o'] The attribute aa.boo is not there, so call boo.__get__() in class a. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically adding and removing methods

2005-09-27 Thread Ron Adam
Steven D'Aprano wrote: > On Sun, 25 Sep 2005 14:52:56 +0000, Ron Adam wrote: > > >>Steven D'Aprano wrote: >> >> >> >>>Or you could put the method in the class and have all instances recognise >>>it: >>> >>>py> C.eg

Re: PEP 350: Codetags

2005-09-28 Thread Ron Adam
:## ## INFO: # # Existing comments # wrapped in a labeled # block comment. # :## The markup form might make it easy to read labeled comments into a dictionary where the labels become the keys. Then special "" definitions wouldn't be neede

Re: Dynamically adding and removing methods

2005-09-28 Thread Ron Adam
Steven D'Aprano wrote: > On Tue, 27 Sep 2005 16:42:21 +0000, Ron Adam wrote: > > >>>>>>>def beacon(self, x): >>>> >>>>...print "beacon + %s" % x >>>>... >>> >>> >>>Did you me

Re: Dynamically adding and removing methods

2005-09-29 Thread Ron Adam
Terry Reedy wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Actually I think I'm getting more confused. At some point the function >>is wrapped. Is it when it's assigned, referenced, or called? > > &g

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

2005-09-30 Thread Ron Adam
pr, then each succeeding 'if' divides the sub expressions, etc... ? So ... A if B else C + X * Y Would evaluate as... ? A if B else (C + X * Y) and... value = X * Y + A if B else C would be ? value = (X * Y + A) if B else C or ? value = X * Y + (A if B else C) I think I'm going to make it a habit to put parentheses around these things just as if they were required. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

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

2005-10-01 Thread Ron Adam
Reinhold Birkenfeld wrote: > Ron Adam >>I think I'm going to make it a habit to put parentheses around these >>things just as if they were required. > Yes, that's the best way to make it readable and understandable. > > Reinhold Now that the syntax is settl

Re: Class Help

2005-10-01 Thread Ron Adam
, it is lost. To keep it around you want to assign it to self.y. class Xyz(object): # create an class to create an object instance. def y(self) self.q = 2 xyz = Xyz() xyz.y() print xyz.q # prints 2 Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Class Help

2005-10-01 Thread Ron Adam
Ron Adam wrote: > Also, > > In your example 'q' is assigned the value 2, but as soon as the method > 'y' exits, it is lost. To keep it around you want to assign it to self.y. Ooops, That should say ... "To keep it around you want to assign it

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Ron Adam
ost cases where critical code is used you really want value testing not type checking. This is where self validating objects are useful and there is nothing preventing anyone from using them in Python. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Ron Adam
r to other name spaces, so it could slow everything down. And there would probably be ways to unlock objects. But maybe that's not a problem as I think what you want to prevent is erroneous results due to unintentional name changes or object changes. I think both of these would have unexpected side effects in many cases, so their use would be limited. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Ron Adam
Antoon Pardon wrote: > Op 2005-10-04, Ron Adam schreef <[EMAIL PROTECTED]>: > >>Antoon Pardon wrote: >> >>>Op 2005-10-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>: >>> >>>>And lo, one multi-billion dollar Mars lander starts braki

Re: "no variable or argument declarations are necessary."

2005-10-06 Thread Ron Adam
Bengt Richter wrote: > On Wed, 05 Oct 2005 11:10:58 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: >>Looking at it from a different direction, how about adding a keyword to >>say, "from this point on, in this local name space, disallow new >>names". Then you can

Re: "no variable or argument declarations are necessary."

2005-10-06 Thread Ron Adam
Fredrik Lundh wrote: > Ron Adam wrote: > > >>Is there a way to conditionally decorate? For example if __debug__ is >>True, but not if it's False? I think I've asked this question before. (?) > > > the decorator is a callable, so you can simpl

Re: Why do I get an import error on this?

2005-10-07 Thread Ron Adam
mething similar with using py2exe. I think it occurs when there are more than one file with the same name in different locations in the search path. Try renaming cx_Oracle to _cx_Oracle then import as... import _cx_Oracle as cx_Oracle Of course your problem might be entirely different. But this might help. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

dis.dis question

2005-10-08 Thread Ron Adam
bly list table. """ return [x[4] for x in dislist if type(x[4]) is str] Another benefit, is to be able to get the results without having to redirect, capture, and then reset sys.stdout. But I still need to rewrite disassemble_string() and need to test it with tracebacks. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Weighted "random" selection from list of lists

2005-10-08 Thread Ron Adam
to handle when a list has too few items in it. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: dis.dis question

2005-10-09 Thread Ron Adam
Ron Adam wrote: > > Can anyone show me an example of of using dis() with a traceback? > > Examples of using disassemble_string() and distb() separately if > possible would be nice also. [cliped] > But I still need to rewrite disassemble_string() and need to test it

Re: Function decorator that caches function results

2005-10-09 Thread Ron Adam
rgs) ... the function 'fn' does here. So they remain local bindings to objects in the scope they were first referenced from even after the function is returned. In effect, 'cache' and 'fn' are replaced by the objects they reference before the cached_result function is returned. Is this correct? Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Function decorator that caches function results

2005-10-09 Thread Ron Adam
Fredrik Lundh wrote: > Ron Adam wrote: > > >>In effect, 'cache' and 'fn' are replaced by the objects they reference >>before the cached_result function is returned. > > > not really; accesses to "free variables" always go via specia

Re: non descriptive error

2005-10-09 Thread Ron Adam
our indicator pair till you find the try-except that is giving you the errror. Once you find the try-except pair that has intercepted the error, you can insert a bare raise right after the except and see the actual python error is. That should give you a better idea of what's going on. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-09 Thread Ron Adam
rence material just to figure out where to start. If I was forced to go back to MS C++ again, I think I would take up painting instead of programing as my main hobby. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: non descriptive error

2005-10-12 Thread Ron Adam
n about the actual error in this case. [(, 'gen.py', 17, '?', ["a = 15+'c'\n"], 0)] try: suspect code block a = 15+'c' print 'hello' for x in range(10): Traceback (most recent call last): File "gen.py", line 26, in ? raise "your error" Error: your error Hope this helps, Ron -- http://mail.python.org/mailman/listinfo/python-list

Setdefault bypasses __setitem__

2005-10-12 Thread Ron Garret
Is this a bug or a feature? class mydict(dict): def __setitem__(self, key, val): print 'foo' dict.__setitem__(self, key, val) >>> d=mydict() >>> d[1]=2 foo >>> d.setdefault(2,3) 3 rg -- http://mail.python.org/mailman/listinfo/python-list

NYLUG meeting: The Python Object Model with Alex Martelli & Google (open bar and food!)

2005-10-14 Thread Ron Guerin
r and food. Additionally, if you're looking for a job as a Python developer, bring your resume. Please RSVP at http://rsvp.nylug.org to attend, as seating is limited. - Ron (announcement follows) The New York Linux User's Group Presents

Re: NYLUG meeting: The Python Object Model with Alex Martelli & Google(open bar and food!)

2005-10-14 Thread Ron Guerin
George Sakkis wrote: > > > What date is it ? It isn't mentioned at the web site either. > Sorry about that, actually it is on the web site, right at the top in the blue band. October 26, 2005 6:00pm - 10:00pm Hope to see you there. - Ron -- http://mail.python.org/mailma

  1   2   3   4   5   6   7   8   >