dis.dis question

2005-10-08 Thread Ron Adam
, 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
in it. 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
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
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 do... def few(x,y): a = 'a' b = 'b' i

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 simply do, say from somewhere import debugdecorator

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 braking either too early or too late. Result: a new crater on Mars, named after the NASA

Re: no variable or argument declarations are necessary.

2005-10-04 Thread Ron Adam
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

Re: no variable or argument declarations are necessary.

2005-10-03 Thread Ron Adam
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: [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 settled, I wonder if further discussion

Re: Class Help

2005-10-01 Thread Ron Adam
() 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 to self.q. ---self.q Cheers, Ron -- http

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

2005-09-30 Thread Ron Adam
) 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? When it is referenced via the class. Ok, that's what I suspected

Re: PEP 350: Codetags

2005-09-28 Thread Ron Adam
# 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 field definitions wouldn't be needed. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python

Re: Dynamically adding and removing methods

2005-09-28 Thread Ron Adam
Steven D'Aprano wrote: On Tue, 27 Sep 2005 16:42:21 +, Ron Adam wrote: def beacon(self, x): ...print beacon + %s % x ... Did you mean bacon? *wink* Of course... remembering arbitrary word letter sequences is probably my worst skill. ;-) That, and I think for some reason

Re: What is self?

2005-09-27 Thread Ron Adam
', '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 +, Ron Adam wrote: Steven D'Aprano wrote: Or you could put the method in the class and have all instances recognise it: py C.eggs = new.instancemethod(eggs, None, C) py C().eggs(3) eggs * 3 Why not just add it to the class directly

Re: Dynamically adding and removing methods

2005-09-25 Thread Ron Adam
', 'beacon', 'ham', 'spam'] Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: What is self?

2005-09-25 Thread Ron Adam
, %s object has no attribute %s \ % (leader, set_name) ) Of course this wouldn't use the object names directly... I guess I'll need to look in the C object code to see exactly how it works. But the links you gave help. Thanks, Ron -- http://mail.python.org

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) I thought that I might have missed something there. Is there a paper on how

Re: Finding where to store application data portably

2005-09-23 Thread Ron Adam
. 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: 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, which is common. This matters because if you aren't

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 ~/.bombz, in Windows something like C:\Documents And Settings\user\Applicacation Data

Re: Finding where to store application data portably

2005-09-22 Thread Ron Adam
= os.path.join( os.environ[USERPROFILE], 'Application Data', 'Bombz' ) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

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? Why not return 42? Why not return a picture of a banana? My question still stands. Could it be helpful

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

2005-09-22 Thread Ron Adam
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=%2Bdomain=LIAGE%2Enetci=1718 Maybe an email to them would clear it up? Cheers, Ron -- http

Re: What is self?

2005-09-22 Thread Ron Adam
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
] --- 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: Question About Logic In Python

2005-09-21 Thread Ron Adam
to the PEP they were introduced to help reduce errors. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding where to store application data portably

2005-09-21 Thread Ron Adam
, and it not an acceptable alternative to good security either. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding where to store application data portably

2005-09-21 Thread Ron Adam
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 = parent + os.sep + '.bombz' Cheers, Ron -- http://mail.python.org/mailman/listinfo/python

Re: Organising a python project

2005-09-20 Thread Ron Adam
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 py2exe I think does a better job of cleaning up I think. Cheers, Ron # makeexe.py Create a stand alone distribution using py2exe

inspect getsource() minor fix?

2005-09-19 Thread Ron Adam
, self.last Cheers, Ron C:\Python24\Libdiff.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 and scol == 0

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 sure if it causes any problems anywhere else. elif

Re: Question About Logic In Python

2005-09-19 Thread Ron Adam
) * 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

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

Re: Software bugs aren't inevitable

2005-09-16 Thread Ron Adam
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: Software bugs aren't inevitable

2005-09-16 Thread Ron Adam
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: 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 provider has full access to the data

Re: encryption with python

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

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 can change if they want. The service provider

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 r[-3::-1] - [7, 6, 5, 4, 3, 2, 1, 0] # surprise The seven is include

Re: Possible improvement to slice opperations.

2005-09-07 Thread Ron Adam
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
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)] True After eating supper, I just realized that I could probably make my

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 one has yet explained the reasoning (vs the mechanics

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, and it passes for negative start and end values as well

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 10 # index's L[3::1] - [3, 4, 5, 6, 7, 8, 9] 3rd index

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
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
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 with positive indexes, you just need to understand

Re: Possible improvement to slice opperations.

2005-09-05 Thread Ron Adam
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
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
] # 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

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 range. To repeat, the current reason is compatibility

Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
, 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 of the best features

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 tricky and lead to unexpected results. This topic has come up

Re: Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
for the feedback, it was helpful. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

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 your

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

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's are zero based, but negative index's are 1 based. Which leads to a non symmetrical situations. indices

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

2005-08-31 Thread Ron Adam
', 'last', 'end', 'final'] Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: py to exe: suggestions?

2005-08-28 Thread Ron Adam
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], 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 dictionary should not be

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], 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 demonstrates why exec as a statement was a mistake

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

2005-08-21 Thread Ron Adam
to meet that guideline. This could be extended to: 2. The minimum required to run an agreed upon set of simple Python programs. I expect 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

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 yet meet that guideline, so it seems some modules still need

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

2005-08-17 Thread Ron Adam
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: [Python-Dev] implementation of copy standard lib

2005-08-16 Thread Ron Adam
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-16 Thread Ron Adam
) in every function or class that uses them. 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
' 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: [path-PEP] Path inherits from basestring again

2005-08-01 Thread Ron Adam
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 the links to the current pre-pep and the most recent module version so I can look at it closer look? -- http://mail.python.org/mailman

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

2005-08-01 Thread Ron Adam
]] - item = D['a']['b'] 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. Any thoughts on this? Cheers, Ron -- http

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. Any thoughts on this? I don't think

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

2005-08-01 Thread Ron Adam
posted improvements. (hint hint) ;-) Cheers, Ron Adam + output -- Define paths: path1 = ['hello', 'world'] path2 = ['hello', 'there', 'world'] path3 = ['hello', 'there', 'wide', 'world'] Store path keys in tree: hello world None there world None

Re: PEP on path module for standard library

2005-07-30 Thread Ron Adam
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

Re: Friend wants to learn python

2005-07-29 Thread Ron Stephens
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
]+='.zip' Or this? Cheer's Ron. -- http://mail.python.org/mailman/listinfo/python-list

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 + uworld u'hello world' 4.5 + 5 9.5 Question: Is a path object mutable? No. This should answer the rest of your questions. Yes

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. Not quite: hello + uworld u'hello world' 4.5 + 5 9.5 In the case of numeric types, it's an addition and not a join. I

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

2005-07-26 Thread Ron Adam
with the language is concerned. Cheers, Ron As for features we don't have yet, you could use an inerator. Something that gets stuff a little bit at a time. If you combine an iterator with a inerator, you would have a itinerator which would be quite useful for managing 'flight-paths

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 opposite. Old game theoretic wisdoms ;) True.. but I

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 might be an interesting puzzle

Re: Ordering Products

2005-07-18 Thread Ron Adam
Kay Schluehr wrote: Ron Adam wrote: Kay Schluehr wrote: On a more general note, I think a constrained sort algorithm is a good idea and may have more general uses as well. Something I was thinking of is a sort where instead of giving a function, you give it a sort key list. Then you can

Re: Efficiently Split A List of Tuples

2005-07-18 Thread Ron Adam
Raymond Hettinger wrote: [Ron Adam] Currently we can implicitly unpack a tuple or list by using an assignment. How is that any different than passing arguments to a function? Does it use a different mechanism? It is the same mechanism, so it is also only appropriate for low volumes

Re: Efficiently Split A List of Tuples

2005-07-18 Thread Ron Adam
the wheel yet again. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordering Products

2005-07-18 Thread Ron Adam
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: Ordering Products

2005-07-17 Thread Ron Adam
function that you might be able to play with.. There are shorter versions of this, but this has a few optimizations added. Overall it's about 10 times slower than pythons built in sort for large lists, but that's better than expected considering it's written in python and not C. Cheers, Ron

Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-11 Thread Ron Adam
peoples code more difficult. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators as generalized pre-binding hooks

2005-07-10 Thread Ron Adam
in can go in just about any direction you could want. http://www.muppetlabs.com/~breadbox/orth/ ;-) Cheers, Ron Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Use cases for del

2005-07-10 Thread Ron Adam
Reinhold Birkenfeld wrote: Ron Adam wrote: 'abc' is 'abcd'[:3] False Well of course it will be false... your testing two different strings! And the resulting slice creates a third. Try: ABC = 'abc' value = ABC if value is ABC: # Test if it is the same object pass

Re: Should I use if or try (as a matter of speed)?

2005-07-10 Thread Ron Adam
and then optimizing the parts that need it. When it's run on faster computers, those optimizations would be a bonus. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators as generalized pre-binding hooks

2005-07-10 Thread Ron Adam
Bengt Richter wrote: On Sun, 10 Jul 2005 05:35:01 GMT, Ron Adam [EMAIL PROTECTED] wrote: So far they are fairly equivalent. So there's not really any advantage over the equivalent inline function. But I think I see what you are going towards. Decorators currently must be used when

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Ron Adam
'] Works for me. ;-) I always thought list([1,2,3]) - [1,2,3] was kind of silly. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Use cases for del

2005-07-08 Thread Ron Adam
Steven D'Aprano wrote: Ron Adam wrote: def count_records(record_obj, start=0, end=len(record_obj)): That would work really well, except that it doesn't work at all. Yep, and I have to stop trying to post on too little sleep. Ok, how about... ? def count_records(record_obj, start=0

Re: removing list comprehensions in Python 3.0

2005-07-08 Thread Ron Adam
style: abc.tolist() list('a','b','c') abc.splitchrs() There's already a str.split() to create a list of words, and a str.splitline() to get a list of lines, so it would group related methods together. I don't thin adding sting methods to lists is a good idea. Cheers, Ron -- http

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-07 Thread Ron Adam
Reinhold Birkenfeld wrote: Ron Adam wrote: Given the statement: a = None And the following are all true: a == None Okay. (a) == (None) Okay. (a) == () Whoops! a (which is None) is equal to the empty tuple (which is not None)? It's not an empty tuple, it's an empty

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-07 Thread Ron Adam
. The lambda may be perfectly fine for that. But why not use def? func_x = lambda x: (someother_func_x(x,'value')) def func_x(x): return someother_func_x(x,'value') There's both nearly identical, but the def is understandable to beginners and advanced python programs. Cheers, Ron Am I just

Re: Use cases for del

2005-07-07 Thread Ron Adam
Grant Edwards wrote: On 2005-07-07, Ron Adam [EMAIL PROTECTED] wrote: It would be a way to set an argument as being optional without actually assigning a value to it. So it would still work like you expect even though v is not bound to anything. Like I said the bigger problem is that globals

Re: Use cases for del

2005-07-07 Thread Ron Adam
Steven D'Aprano wrote: Ron Adam wrote: Why would you want to use None as an integer value? If a value isn't established yet, then do you need the name defined? Wouldn't it be better to wait until you need the name then give it a value? Er, maybe I'm misunderstanding something here

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-07 Thread Ron Adam
a {dictionary_comp} would make it a complete set. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

<    3   4   5   6   7   8   9   10   >