Re: object inheritance and default values

2005-10-14 Thread Ron Adam
George Sakkis wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote: > > >>I'm trying to implement simple svg style colored complex objects in >>tkinter and want to be able to inherit default values from other >>previously defined objects. >> >&

object inheritance and default values

2005-10-14 Thread Ron Adam
t I want to be able to have all the objects access alike? Hmmm.. I think maybe if if don't ever access shape (or Shape) directly in my data structure, then __new__ would work? So my first default object should be an instance of shape with a __new__ method to create more? Ok, off to try

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

2005-10-14 Thread Ron Guerin
Gregory Piñero wrote: > A reasonable question ... Sure is. ;) October 26, 2005 6:00pm - 10:00pm - Ron -- http://mail.python.org/mailman/listinfo/python-list

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

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

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

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

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-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: 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: 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: 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: 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

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: 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

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: "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-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-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-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: 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: 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: [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: [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: 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: 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: 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-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: 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: 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: 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: 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: 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: 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-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
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: 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: Finding where to store application data portably

2005-09-22 Thread Ron Adam
e would be as you suggested, but maybe doing it this way would be better. import os user = os.path.join( os.environ["USERPROFILE"], 'Application Data', 'Bombz' ) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding where to store application data portably

2005-09-22 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: > >> Tony Houghton wrote: >> >>> I'm using pygame to write a game called Bombz which needs to save some >>> data in a directory associated with it. In Unix/Linux I'd probably use >>> "~/.bomb

Re: Question About Logic In Python

2005-09-22 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: >> >> 2. Expressions that will be used in a calculation or another >> expression. >> > By which you appear to mean "expressions in which Boolean values are > used as numbers". Or compared to other types, wh

Re: Finding where to store application data portably

2005-09-21 Thread Ron Adam
ke RISC OS (it may not have pygame but > it definitely has python). Surely this is something that's crying out > for an official function in os or sys. This works on Win XP. Not sure if it will work on Linux. import os parent = os.path.split(os.path.abspath(os.sys.argv[0]))[0] file =

Re: Finding where to store application data portably

2005-09-21 Thread Ron Adam
extensions) is definitely not the answer. Personally I think hidden files do more harm than good. It's not a substitute for good file management, and it not an acceptable alternative to good security either. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Question About Logic In Python

2005-09-21 Thread Ron Adam
ra, the simplest one. Strictly > speaking, Booleans aren't limited to two values. See > http://en.wikipedia.org/wiki/Boolean_algebra for more detail. I look at those earlier and was surprised at how complex some Boolean algebra concepts were. Interesting though, and I'll probably go back and study it a bit more. > Python's bools aren't Booleans. They are merely aliases for 0 and 1. Yes, and according to the PEP they were introduced to help reduce errors. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Question About Logic In Python

2005-09-21 Thread Ron Adam
on bools to bools first. But it would be easier IMO if bool operations gave bool results so I wouldn't need to do: bool_result = a and bool(b) or bool_result = bool(a and b) On one hand these seem like little things, but little things is sometimes what will bite you the hardest as they are more likely to get by your guard. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Organising a python project

2005-09-20 Thread Ron Adam
projectname2 <- next version... ... # copy the previous version to start. ... Below is my basic py2exe script. You'll need to change it to suite your own needs of course. The rmtree is my own module to remove directories and contents. The newest version of

Re: Question About Logic In Python

2005-09-19 Thread Ron Adam
rue, but not equal. bool(1 and 2) == bool(2 and 1) (1 and 2) * value != (2 and 1) * value # except if value is False. bool(1 and 2) * value == bool(2 and 1) * value So.. bool(a and b) * value Would return value or zero, which is usually what I want when I do this type of expression. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: inspect getsource() minor fix?

2005-09-19 Thread Ron Adam
Delaney, Timothy (Tim) wrote: > Ron Adam wrote: > > >>While playing around with the inspect module I found that the >>Blockfinder doesn't recognize single line function definitions. >> >>Adding the following two lines to it fixes it, but I'm not sur

inspect getsource() minor fix?

2005-09-19 Thread Ron Adam
EndOfBlock, self.last Cheers, Ron C:\Python24\Lib>diff.py inspect.py inspect_.py *** inspect.py Tue Mar 15 13:22:02 2005 --- inspect_.py Mon Sep 19 14:26:26 2005 *** *** 531,536 --- 531,538 raise EndOfBlock, self.last elif type == tokenize.NAME

Synchronous/Asynchrnous Audio play with pymedia

2005-09-18 Thread Ron Provost
Hello, I'm developing a piece of software to assist illiteraate adults to learn to read. I'm trying to figure out how, if possible, to make audio playback asynchrnous but still controllable. I'm using python 2.4 with pymedia on XP. I started out with the example in the tutorials section of t

Re: Software bugs aren't inevitable

2005-09-16 Thread Ron Adam
reused on successive calls, but then I realized that it's nearly identical to a loop in that context, so why not just write it as a loop to start with. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Software bugs aren't inevitable

2005-09-16 Thread Ron Adam
ferent versions of a program on several different platforms simultaneously and use only the results that have a majority agreement. Or to put it another way; risk management by ... "keep it simple", "don't have too many cooks", "get second opinions", and "don't put all your eggs in one basket". Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: encryption with python

2005-09-11 Thread Ron Adam
Kirk Job Sluder wrote: > Ron Adam <[EMAIL PROTECTED]> writes: >>I would think that any n digit random number not already in the data >>base would work for an id along with a randomly generated password >>that the student can change if they want. The service provid

Re: encryption with python

2005-09-10 Thread Ron Adam
James Stroud wrote: > On Saturday 10 September 2005 15:02, Ron Adam wrote: > >>Kirk Job Sluder wrote: >>I would think that any n digit random number not already in the data >>base would work for an id along with a randomly generated password that >>the student

Re: encryption with python

2005-09-10 Thread Ron Adam
and get another randomly generated password. Or am I missing something? Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-09 Thread Ron Adam
Michael Hudson wrote: > Ron Adam <[EMAIL PROTECTED]> writes: >>With current slicing and a negative step... >> >>[ 1 2 3 4 5 6 7 8 9 ] >> -9 -8 -7 -6 -5 -4 -3 -2 -1 -0 >> >>r[-3:] -> [7, 8, 9]# as expected >&

Re: Possible improvement to slice opperations.

2005-09-07 Thread Ron Adam
x27;ll deal with the subsetting another time ... No hurry, this isn't a hack it out because "the boss wants it on his desk Monday" situation. ;-) > Regards, > Bengt Richter Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-06 Thread Ron Adam
Magnus Lycka wrote: > Ron Adam wrote: > >> Ok, lets see... This shows the problem with using the gap indexing >> model. >> >> L = range(10) >> >> [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] # elements >> 0 1 2 3 4 5 6 7 8 9

Re: Possible improvement to slice opperations.

2005-09-06 Thread Ron Adam
Patrick Maupin wrote: > Ron Adam wrote: > > >>>This should never fail with an assertion error. You will note that it >>>shows that, for non-negative start and end values, slicing behavior is >>>_exactly_ like extended range behavior. > > >>Yes,

Re: Possible improvement to slice opperations.

2005-09-06 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: > >> Steve Holden wrote: >> >> What misconception do you think I have? >> > This was not an ad hominem attack but a commentary on many attempts to > "improve" the language. Ok, No problem. ;-) >> No o

Re: Possible improvement to slice opperations.

2005-09-06 Thread Ron Adam
Patrick Maupin wrote: > I previously wrote (in response to a query from Ron Adam): > > >>In any case, you asked for a rationale. I'll give you mine: >> >> >>>>>L = range(10) >>>>>L[3:len(L):-1] == [L[i] for i in range(3,len(L),-1)]

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
Terry Reedy wrote: >>Ron Adam wrote: >> >> >>>However, I would like the inverse selection of negative strides to be >>>fixed if possible. If you could explain the current reason why it does >>>not return the reverse order of the selected ra

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
slice of a slice object r.range_sub(d,3) # subtract 3 from items in range d Or more flexible ... r.range_modify(d, add(), 5) Using your suggestion that would be... r = range(100) d = [10:10] r.range_add(d,5) d = d[5:] -> [15:5] # interesting symmetry. r.range_sub(d,3) Of course adding and subtracting slice objects could also be possible. d = [10:20] e = [15:25] f = d + e-> [10:25] or ... d = [10:10] e = [15:10] f = d + e-> [10:15] Cheers, Ron > Regards, > Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
) however would require a lot of small changes in index's. Mostly changing.. L[:-1] to L[:~1] or to L[:-2]. So no, I don't expect one's based indexing to be added any time soon. It could be useful as a function or object in it's own. > "Professor Einstein, could you tell our readers how general relativity > works?" Actually I can, but it would be off topic for this news group. Cheers, Ron > regards > Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
selection of negative strides to be fixed if possible. If you could explain the current reason why it does not return the reverse order of the selected range. I would appreciated it. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
Magnus Lycka wrote: > Ron Adam wrote: > >> Slicing is one of the best features of Python in my opinion, but >> when you try to use negative index's and or negative step increments >> it can be tricky and lead to unexpected results. > > > Hm... Just as w

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
m right The symmetry is easier to see when using the '~' values. LL=list(range(10)) Lx=nxlist(range(10)) LL[ 1: 2]==[LL[ 1]]==[1] Lx[~2:~1]==[Lx[~1]]==[8] Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
Scott David Daniels wrote: > Magnus Lycka wrote: > >> Ron Adam wrote: >> >>> ONES BASED NEGATIVE INDEXING > > > I think Ron's idea is taking off from my observation that if one's > complement, rather than negation, was used to specify measure

Re: Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
fear you might need a similar helper function for > similar issues with your change. I just don't know what those are > without more thought. > > Regards, > Pat Thanks for the feedback, it was helpful. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
Terry Reedy wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Slicing is one of the best features of Python in my opinion, but >>when you try to use negative index's and or negative step increments >>it can be

Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
y, it would be nice to get a few opinions at this point. So blast away... or hopefully tell me what you like about it instead. ;-) (Any suggestions or contributions to make it better would be appreciated.) Cheers, Ron Adam """ IMPROVED SLICING Slicing is one

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-09-03 Thread Ron Adam
Bengt Richter wrote: > IMO the problem is that the index sign is doing two jobs, which for zero-based > reverse indexing have to be separate: i.e., to show direction _and_ a _signed_ > offset which needs to be realtive to the direction and base position. Yes, that's definitely part of it. > A l

Re: Bug in string.find

2005-09-03 Thread Ron Adam
Terry Reedy wrote: >>b[-1:] = ['Z']# replaces last item >>b[-1:-0] = ['Z'] # this doesn't work >> >>If you are using negative index slices, you need to check for end >>conditions because you can't address the end of the slice in a >>sequential/numerical way. > > OK, now I understand

Re: Bug in string.find

2005-09-02 Thread Ron Adam
Terry Reedy wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Fredrik Lundh wrote: >> >>>Ron Adam wrote: >>> >>>>The problem with negative index's are that positive index'

Re: Bug in string.find

2005-09-01 Thread Ron Adam
Fredrik Lundh wrote: > Ron Adam wrote: > > >>The problem with negative index's are that positive index's are zero >>based, but negative index's are 1 based. Which leads to a non >>symmetrical situations. > > > indices point to the "gap&q

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-31 Thread Ron Adam
t; -1, but about an easy way to get the last value. > > But I like your idea. I just think there should be two differnt ways > to index. maybe use braces in one case. > > seq{i} would be pure indexing, that throws exceptions if you > are out of bound > > seq[i

Re: py to exe: suggestions?

2005-08-28 Thread Ron Adam
m a single exe file that's very professional. Most users won't need to know or care what language you developed your application with as long as it works. Hope that helps, Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: variable hell

2005-08-25 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > rafi wrote: > > Reinhold Birkenfeld wrote: > > > > > exec(eval("'a%s=%s' % (count, value)")) > >>> > >>>why using the eval? > >>> > >>>exec ('a%s=%s' % (count, value)) > >>> > >>>should be fine > >> > >>And this demo

Re: variable hell

2005-08-25 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]> wrote: > In the > bowels of my modules, I may not know what the contents are at code-time, Then how do you write your code? rg -- http://mail.python.org/mailman/listinfo/python-list

Re: variable hell

2005-08-25 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Benji York <[EMAIL PROTECTED]> wrote: > Peter Maas wrote: > > >>> suffix = 'var' > > >>> vars()['a%s' % suffix] = 45 > > >>> avar > > 45 > > Quoting from http://docs.python.org/lib/built-in-funcs.html#l2h-76 about > the "vars" built in: > > The returned dicti

Re: pythonXX.dll size: please split CJK codecs out

2005-08-21 Thread Ron Adam
Martin v. Löwis wrote: > Ron Adam wrote: > >>I would put the starting minimum boundary as: >> >> 1. "The minimum required to start the python interpreter with no >>additional required files." >> >>Currently python 2.4 (on windows) does not

Re: pythonXX.dll size: please split CJK codecs out

2005-08-21 Thread Ron Adam
there may be a lot of differing opinions on just what those minimum Python programs should be. But that is where the PEP process comes in. Regards, Ron > Regards, > Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] implementation of copy standard lib

2005-08-17 Thread Ron Adam
he alternative would be to use a flag and shallow copies in all the methods that altered the object. copy.deepcopy() was a lot easier as it's only needed in the method that initiates the result calculation. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacement for keyword 'global' good idea? (e.g. 'modulescope' or 'module' better?)

2005-08-16 Thread Ron Adam
in a module you wouldn't be able to access any builtin functions or class's without declaring them as global (or importing them) in every function or class that uses them. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] implementation of copy standard lib

2005-08-16 Thread Ron Adam
r is it just me? I use copy.deepcopy() sometimes, and more often [:] with lists. Dictionary objects have a copy method. All non mutable objects are copies. I too have wondered why copy isn't a builtin, and yet some builtin objects do make copies. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacement for keyword 'global' good idea? (e.g. 'modulescope' or 'module' better?)

2005-08-09 Thread Ron Adam
uld just increment a reference counter, and it wouldn't be removed from shared until it reaches zero again. Using 'share' twice with the same name in the same function should cause an error. Using 'shared' with a name that is not in shared name space would cause an error. Just a few thoughts. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: finding sublist

2005-08-02 Thread Ron Adam
n None. So you don't need to return 'no'. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Path as a dictionary tree key? (was Re: PEP on path module for standard library)

2005-08-01 Thread Ron Adam
t all if anyone posted improvements. (hint hint) ;-) Cheers, Ron Adam + output -- Define paths: path1 = ['hello', 'world'] path2 = ['hello', 'there', 'world'] path3 = ['hello', 'there', 'wide', &#x

Re: Path as a dictionary tree key? (was Re: PEP on path module for standard library)

2005-08-01 Thread Ron Adam
Brian Beck wrote: > Ron Adam wrote: > >> This give a more general purpose for path objects. Working out ways >> to retrieve path objects from a dictionary_tree also would be useful I >> think. I think a Tree class would also be a useful addition as well. >> >

Path as a dictionary tree key? (was Re: PEP on path module for standard library)

2005-08-01 Thread Ron Adam
x27;b') item = D_tree[path] or item = D_tree[Path('a','b')] That would be in place of.. item = D[path[0]][path[1]] -> item = D['a']['b'] This give a more general purpose for path objects. Working out ways to retriev

Re: [path-PEP] Path inherits from basestring again

2005-08-01 Thread Ron Adam
;/' will be considered a wart by many and a boon by others. If I'm right, there will be endless discussions over it if it's implemented. I'd rather not see that, so I'm still -1 concerning '/' for that reason among others. Cheers, Ron PS. Could someone repost

Re: PEP on path module for standard library

2005-07-30 Thread Ron Adam
en done. apath.close() etc... With this you can iterate a file system as well as it's files. ;-) (Add more or less methods as needed of course.) apath = device(dev_obj).path(some_path_sting) apath.open().write(data).close() or if you like... device(dev_obj).append(path_sting).open().write(data).close() Just a few thoughts, Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Friend wants to learn python

2005-07-29 Thread Ron Stephens
rials and books might be best for newbies to Python, depending on their background. It can be reached at http://www.awaretek.com/python/index.html Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: [path-PEP] Path inherits from basestring again

2005-07-27 Thread Ron Adam
Peter Hansen wrote: > Ron Adam wrote: > >> Michael Hoffman wrote: >> >>> Ron Adam wrote: >>> >>>> In all current cases, (that I know of), of differing types, '+' >>>> raises an error. >>> >>> >>>

Re: [path-PEP] Path inherits from basestring again

2005-07-27 Thread Ron Adam
Michael Hoffman wrote: > Ron Adam wrote: > >> In all current cases, (that I know of), of differing types, '+' raises >> an error. > > > Not quite: > > >>> "hello " + u"world" > u'hello world' > >>

Re: [path-PEP] Path inherits from basestring again

2005-07-27 Thread Ron Adam
ct or modify the original? p = path('C://somedir//somefile') p+='.zip' what would this do? p[-1]+='.zip' Or this? Cheer's Ron. -- http://mail.python.org/mailman/listinfo/python-list

Re: [path-PEP] Path inherits from basestring again

2005-07-25 Thread Ron Adam
o be: > >scripts = userfolder.joinpath(scriptfolder) >scriptpath = scripts.joinpath(self.config['system']['commandfile']) > > Even so I'm only +0 on it. > > -Peter I think the '+' is used as a join for both strings and lists, so i

Re: Ordering Products

2005-07-20 Thread Ron Adam
Kay Schluehr wrote: > Ron Adam wrote: > >> Kay Schluehr wrote: >> BTW.. Usually when people say "I don't want to discourage...", They >> really want or mean the exact oppisite. > > Yes, but taken some renitence into account they will provoke the &g

Re: Ordering Products

2005-07-19 Thread Ron Adam
Kay Schluehr wrote: > Hi Ron, > > I really don't want to discourage you in doing your own CAS but the > stuff I'm working on is already a bit more advanced than my > mono-operational multiplicative algebra ;) I figured it was, but you offered a puzzle: "Here

Re: Ordering Products

2005-07-18 Thread Ron Adam
eeds some better logic to merge adjacent like groups. I think the reverse sorting my be a side effect of the nesting that takes place when the expressions are built. Having the digits first might be an advantage as you can use a for loop to add or multiply them until you get to a not digit. Anyway, interesting stuff. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficiently Split A List of Tuples

2005-07-18 Thread Ron Adam
7;m tried to reinvent the wheel yet again. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   >