Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-03 Thread Scott David Daniels
not understanding that they are not necessarily going to the same position. The fact that they provide an ambiguous display is enough to make them evil. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils problem windows xp python 2.4.2

2005-12-03 Thread Scott David Daniels
stemExit, e: pass # Failure. Patch and try again else: break # Successful run, no need to retry. print '*** Apparently a failure:', e.args[0] print '*** Patching and trying again' import patch_msvccompiler --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils problem windows xp python 2.4.2

2005-12-04 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > It didn't work with visual studio 5. .Net framework 2.0 > Do you have any suggestions? "It didn't work" is not very diagnosable. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Detect character encoding

2005-12-04 Thread Scott David Daniels
e). > > Thank you for any answer > Regards > Michal The two ways to detect a string's encoding are: (1) know the encoding ahead of time (2) guess correctly This is the whole point of Unicode -- an encoding that works for _lots_ of languages. --Scott David Daniels [EMAIL PR

Re: newbie write to file question

2005-12-04 Thread Scott David Daniels
= name + '.log' outputFile = open(os.path.join(root, name + '.log'), 'w') outputFile.write(str(table)) outputFile.close() table = {} So that you only write logs if something was found. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie - needing direction

2005-12-05 Thread Scott David Daniels
u try to get onto the desktop. Don't be so concerned about "having to learn too much" -- that learning is the whole point of initial projects. You don't know what you need to know now, so you are not in a position to make a well-informed choice of what you need to know. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing Eric?

2005-12-05 Thread Scott David Daniels
to, those differences leave something to choose. You should always feel free to grab the most recent matching the first two digits. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: timeit's environment

2005-12-05 Thread Scott David Daniels
te a paragraph or two that would have informed you and send it to the destination mentioned on the documentation page. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils problem windows xp python 2.4.2

2005-12-05 Thread Scott David Daniels
alling to do. See, for example: http://www.vrplumber.com/programming/mstoolkit/ --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: hash()

2005-12-05 Thread Scott David Daniels
John Marshall wrote: > For strings of > 1 character, what are the chances > that hash(st) and hash(st[::-1]) would return the > same value? Why not grab a dictionary and do the stats yourself? --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: hash()

2005-12-05 Thread Scott David Daniels
John Marshall wrote: > Scott David Daniels wrote: >> ... Why not grab a dictionary and do the stats yourself? > I was actually interested in the mathematical/probability > side rather than the empirical w/r to the current > hash function in python. Well, the probability depends o

Re: Bitching about the documentation...

2005-12-05 Thread Scott David Daniels
ladly take care of that -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Need eyes to look at code... time not having an attribute called asctime()

2005-12-05 Thread Scott David Daniels
Harlin Seritt wrote: > from utilities import * > from extractor import * > import time ... > data = os.popen(line).readlines() > time = data[-1].split()[-1][:-2] This seems an unfortunate choice of names. > except: > ... --Scott

Re: timeit's environment

2005-12-05 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Scott David Daniels wrote: ... >> Perhaps you could write a paragraph or two that would have >> informed you and send it to the destination mentioned on the >> documentation page. > > Yes, but I was hoping to get some sense of how such >

Re: Memoizing decorator

2005-12-05 Thread Scott David Daniels
So you can just use @Memoize def function ( --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: hash()

2005-12-05 Thread Scott David Daniels
Aahz wrote: > QOTW: Timbot makes an error ;-) Now exactly who was in charge of the replacement capacitors? --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over test data in unit tests

2005-12-05 Thread Scott David Daniels
> """ Three throws should result in expected score """ self.assertEqual(5 + 7 + 4, self.runs([5, 7, 4])) > def test_strike(self): > """ Strike should add the following two throws """

Re: Iterating over test data in unit tests

2005-12-06 Thread Scott David Daniels
throws = [5, 4] frame = 2 class Test_three(Test_Game): score = 14 throws = [5, 4, 5] frame = 2 class Test_strike(Test_Game): score = 26 throws = [10, 4, 5, 7] frame = 3 --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: WindowsXP development using msvc .net 2003

2005-12-07 Thread Scott David Daniels
r.com/programming/mstoolkit I also have some code to "monkey patch" distutils (change at runtime without having to alter any source code) if distutils seems to be the problem. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-08 Thread Scott David Daniels
scope for x, goes out of scope at end of if >> > If this genuinely troubles you then you can always isolate the scope > with a function, though of course you also no longer have the code > inline then. Or, if you must: def called(function): function() return called then:

Re: Using printf in a C Extension

2005-12-08 Thread Scott David Daniels
see the output on a terminal display (some stdout C systems are line buffered). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find the type ...

2005-12-09 Thread Scott David Daniels
t;>> int(a,16) # Silly me, 0xe is not a decimal > 14 Or even say "look to the text for a clue about the base": >>> int('0xe', 0) 14 >>> int('010', 0) 8 >>> int('10', 0) 10 -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Scott David Daniels
lambda is used too often in lieu of deciding what to write. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Scott David Daniels
David Bolen wrote: Scott David Daniels <[EMAIL PROTECTED]> writes: while test() != False: ...code... I'm not sure I follow the "error" in this snippet... The code is "fat" -- clearer is: while test(): ...code... The right s

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-31 Thread Scott David Daniels
gs in this thread, "Codito ergo sum" brings to mind one I love: "Cogito ergo spud!" -- I think, therefore, yam! (a U.S. Thanksgiving day coinage). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: exposing C array to python namespace: NumPy and array module.

2005-01-01 Thread Scott David Daniels
and writable views. Have a look at: http://members.dsl-only.net/~daniels/Block.html to see if it addresses your problem. It is MIT-licensed (give credit, but feel free to use). Let me know if it works OK, could use a tweak, or is completely useless. I'll be more than happy to r

Re: exposing C array to python namespace: NumPy and array module.

2005-01-01 Thread Scott David Daniels
Bo Peng wrote: Scott David Daniels wrote: I wrote "blocks and views" to overcome this problem. I was too impatient to wait for your reply. :-) I call 21-hour turnaround over New Year's Eve pretty good. Clearly I will never be quick enough for you ;-). Since I presented this a

mertz@gnosis.cx

2005-01-02 Thread Scott David Daniels
n, and it has a field "args" which will reflect the arguments with which the exception was created. So in these cases, x.args is ('some message',) and if the code were: >>> try: ... raise ValueError("some message", 42) ... except ValueErro

Re: Hlelp clean up clumpsy code

2005-01-04 Thread Scott David Daniels
for x in seq: try: for y in flatten(x): yield y except TypeError: yield x --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic search of list of dictionaries

2005-01-04 Thread Scott David Daniels
ed, you can then march through the lists in parallel, which should give you an O(n) algorithm. But overall you will have O(n log n) because of the sorts. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python design strategy (was Python evolution: Unease)

2005-01-04 Thread Scott David Daniels
rather than a strict guarantee of the type, code can be generated that does the test before choosing which path to choose, and have fast code on the type-specific path. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: The Industry choice

2005-01-04 Thread Scott David Daniels
nerally accepted view was that this company would either produce a spectacularly fast machine, or at least one of them would be dead. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4 on Windows XP

2005-01-05 Thread Scott David Daniels
:\Python24\Python.exe C:\Python24\Lib\idlelib\idle.pyw I suspect your real problem is the internal firewall in XP, in which case you'll need to allow building sockets to LOCALHOST (127.0.0.1) on port 8833, or, alternatively, start idle with the "-n" flag. --Scott David Daniels

Re: Building unique comma-delimited list?

2005-01-05 Thread Scott David Daniels
How about (for 2.4 or 2.3 using "from collections import Set as set": def combine(source, special='foo'): parts = set(source) if special in parts: return ', '.join([special] + list(parts - set([special]))) return ', '.join(parts) --Scott

Re: Python evolution: Unease

2005-01-07 Thread Scott David Daniels
quests/MacEnthon I seem to remember discussion about synchronizing with the windows 2.4 version to have essentially the same list. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting on keys in a list of dicts

2005-01-07 Thread Scott David Daniels
ovely property). There is another property which hasn't been mentioned: As written, only the key and the index are compared. Try sorting: tricky = [dict(a=5j, b=1), dict(a=4j, b=1)] or: similar = [(5j, 1), (4j, 1)] without the index. --Scott David Daniels [EMAIL PROTECTED

Re: Writing huge Sets() to disk

2005-01-10 Thread Scott David Daniels
)), dupelim(German)), dupelim(Czech)): Ponly.write(unmatched) English.seek(0) German.seek(0) Czech.seek(0) Polish.seek(0) for matched in inboth(inboth(dupelim(Polish), dupelim(English)), inboth(dupelim(German), dupelim(Czech))):

Re: Writing huge Sets() to disk

2005-01-10 Thread Scott David Daniels
Martin MOKREJÅ wrote: But I don't think I can use one-way hashes, as I need to reconstruct the string later. I have to study hard to get an idea what the proposed > code really does. Scott David Daniels wrote: Tim Peters wrote: Call the set of all English words E; G, C, and P s

Re: Python & unicode

2005-01-11 Thread Scott David Daniels
f you allow non-ASCII characters in symbol names, your source code will be unviewable (and uneditable) for people with ASCII-only terminals, never mind how comprehensible it might otherwise be. It is a least-common-denominator argument, not a "this is better" argument. -Scott David

Re: Help Optimizing Word Search

2005-01-12 Thread Scott David Daniels
han using some fancy algorithm coded completely in python. If these queries happen often, build a dictionary of sorted letters to lists-of-words. The setup will be slow, but use of such a secondary dictionary should be quite fast, with relatively easy dealing with ?s by iterations. --Scott Dav

Re: Python & unicode

2005-01-12 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: Scott David Daniels wrote: If you allow non-ASCII characters in symbol names, your source code will be unviewable (and uneditable) for people with ASCII-only terminals, never mind how comprehensible it might otherwise be. So how does one edit non ascii string literals at

Re: complex numbers

2005-01-12 Thread Scott David Daniels
mplex numbers to communicate. -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteration over two sequences

2005-01-12 Thread Scott David Daniels
is the future, Numeric is the "past", but in the present Numeric is better (and more mature) at some stuff than Numarray. Learning both is not much harder than learning one, actually (they share a lot). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: query python env

2005-01-14 Thread Scott David Daniels
mean by multiple Python versions. For example, for Windows 2K/XP, As long as you try for only distinct major versions (2.2.x, 2.3.x, 2.4.x). There should not be a problem. The primary issues are where (and how) does your system get to the python files. --Scott David Daniels [EMAIL PROTECTED] --

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Scott David Daniels
ht it might be an exponent, since it seemed to have too many on bits in a row to be part of 1.11. -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Scott David Daniels
G.Franzkowiak wrote: Scott David Daniels schrieb: franzkowiak wrote: I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program: def l32(c): return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Scott David Daniels
G.Franzkowiak wrote: Scott David Daniels schrieb: If you really want to do this kind of byte fiddling: http://members.dsl-only.net/~daniels/block.html Then: from block import Block, View b = Block(4) # enough space for one float (more is fine) iv = View('i', b) # gettin

Re: platform independent kbhit()

2005-01-17 Thread Scott David Daniels
make sure it doesn't impose an extra constraint on all terminal access. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: One-Shot Property?

2005-01-18 Thread Scott David Daniels
def __init__(self, calculate_function): self._calculate = calculate_function def __get__(self, obj, _=None): if obj is None: return self value = self._calculate(obj) setattr(obj, self._calculate.func_name, value) return value class Foo(object)

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Scott David Daniels
he language, but it might be a good library borrow to find out why the language is the way it is. -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Print to Windows default Printer

2005-01-20 Thread Scott David Daniels
save paper during your tests. It is a windows printer driver that creates a PDF file: http://sourceforge.net/projects/pdfcreator/ --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: finding name of instances created

2005-01-22 Thread Scott David Daniels
if isinstance(value, Robot)] # actual class name here Note, however, that a = b = CreateRobot() will give two different names to the same robot. And even: Karl = CreateRobot() Freidrich = CreateRobot() for robot in (Karl, Freidrich): robot.move() Will have two names for "Fre

Re: empty classes as c structs?

2005-02-04 Thread Scott David Daniels
mport Data blah = Data(some_field=3, other_field=13) ... blah.other_field = 23 ... --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: binary file

2005-06-20 Thread Scott David Daniels
27;file') sys.stdout, old = open('somefile.txt', 'w'), sys.stdout s.print_stats() sys.stdout, old = old, sys.stdout old.close() Looks to solve your problem to me. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
uld require huge > complexity increases in my apps (not using them would probably > at least triple the amount of code required in some cases).] You could check to see if the Python 2.5 pickling does a better job. Otherwise, you've got your work cut out for you. -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop until condition is true

2005-06-22 Thread Scott David Daniels
>>> d = 123456789 > >>> c == d > 1 > >>> c is d > 0 > ... > First of all, a lot of Python values except 1 (a.k.a. True) > are logically true in a Python expression Actually, True and 1 are interesting examples. >>> a, b = 1, True &g

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
Grant Edwards wrote: > On 2005-06-22, Scott David Daniels <[EMAIL PROTECTED]> wrote: >>>...Under Win32, the pickle module only works with a subset of >>> floating point values. In particular ... infinity or nan ... >> >>There is no completely portable way

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
(3) There is no standard-conforming way to detect these values. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: import search path

2005-06-22 Thread Scott David Daniels
/site-packages/Numeric/FFT/__init__.pyc' > Much shorter is: > import FFT > FFT.__file__ <> Note that (after the above): > import sys > sys.modules['FFT'] is FFT True --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
Grant Edwards wrote: > On 2005-06-22, Scott David Daniels <[EMAIL PROTECTED]> wrote: >>Several issues: > > >>(1) The number of distinct NaNs varies among platforms. > > According to the IEEE standard, there are exactly two: > signalling and quiet, a

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
Paul Rubin wrote: > Scott David Daniels <[EMAIL PROTECTED]> writes: > >>>Negative 0 isn't a NaN, it's just negative 0. >> >>Right, but it is hard to construct in standard C. > > > Huh? It's just a hex constant. Well, -0.0 doesn't

Re: Reraise exception with modified stack

2005-06-23 Thread Scott David Daniels
bar() except Exception, exception: addinfo(exception, "While doing x:") raise except Exception, exception: addinfo(exception, "While doing y:") raise except Exception, exc

Re: Reraise exception with modified stack

2005-06-23 Thread Scott David Daniels
Nicolas Fleury wrote: > Scott David Daniels wrote: > >> How about dropping reraise and changing: >> reraise(...) >> to: >> addinfo(...) >> raise > > > It doesn't work, or at least it doesn't do what I want. I

Re: key - key pairs

2005-06-23 Thread Scott David Daniels
uot;remove greatest", "find arbitrary", "remove arbitrary", "add entry" Depending on your choice on costs, the data structure changes. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: key - key pairs

2005-06-23 Thread Scott David Daniels
ss dict and provide get/set that always insert the value > as a key. So dict["string"]=time also means dict[time]="string". > Or am I missing something? Yup, getting to min and max. I presume that will be key-dependent. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-25 Thread Scott David Daniels
t;baz"="blah"} > > This smacks of creeping featurism. Is this actually useful in real code? Yes it's useful, and it grew organically from the keyword arg syntax. No new syntax was introduced to provide this; the existing syntax was used. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Thoughts on Guido's ITC audio interview

2005-06-26 Thread Scott David Daniels
gt; work reliably in Python with constants, which isn't very useful. Look at the Self language. That language has less of a surface concept of type than Python (classes are not defined). Still, Self was/is used as a platform to investigate type inferencing, code specialization, and native code generation. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Re: What is different with Python ? (OT I guess)

2005-06-28 Thread Scott David Daniels
Peter Otten wrote: > Christos TZOTZIOY Georgiou wrote: > >>and then, apart from t-shirts, the PSF could sell Python-branded >>shampoos named "poetry in lotion" etc. > > Which will once and for all solve the dandruffs problem prevalent among the > snake community these days. And once again the P

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

2005-06-28 Thread Scott David Daniels
http://www.handysoftware.com/cpif/ ... "Why teach computer programming to teenagers? For the same reason you would teach them piano or any other musical instrument. Consider the computer an instrument for the mind." I've not seen the book myself, but it seems like it is targeted to very nearly your situation, so I'd investigate it. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread Scott David Daniels
ess the enter key to exit.")... > > Your programm gives an error. You are trying to concatenate strings with > integers. > Might I suggest you were looking for this: ... print "Heads: ", heads print "Tails: ", tails print &

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-28 Thread Scott David Daniels
Ron Adam wrote: > Mike Meyer wrote: > >> Riccardo Galli <[EMAIL PROTECTED]> writes: >>> result = [value2,value1][cond] Or: result = [(lambda: expr0), lambda: expr1][cond]() Which is harder to understand than the if-based assignment even with 5-character expressio

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-29 Thread Scott David Daniels
Roy Smith wrote: > Andrew Durdin <[EMAIL PROTECTED]> wrote: >>Corrected version: >>result = [(lambda: expr0), lambda: expr1][bool(cond)]() Sorry, I thought cond was a standard boolean. Better is: result = [(lambda: true_expr), lambda: false_expr][not cond]() --Scott

Re: map vs. list-comprehension

2005-06-29 Thread Scott David Daniels
tra zip. You could try timing it using itertools.izip rather than zip. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: importing packages from a zip file

2005-06-29 Thread Scott David Daniels
port myModule.py Does this work for you? It gives me a syntax error. Typically, put the zip file on the sys.path list, and import modules and packages inside it. If you zip up the above structure, you can use: sys.path.insert(0, 'myZip.zip') import base.branch1.myModule --

Re: Inheriting from object

2005-06-30 Thread Scott David Daniels
self, *args, **kwargs): super(foo, self).__init__(self, *args, **kwargs) ... --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "Britishaccent"...

2005-07-01 Thread Scott David Daniels
Delaney, Timothy (Tim) wrote: > Grant Edwards wrote: > > >>On 2005-06-30, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: >> >> Due to some wierd property requiring conservation of >> consonants, when speaking Strine you've got to take the r's >> removed from words like "carrier" and "order", a

Re: shelve in a ZipFile?

2005-07-01 Thread Scott David Daniels
it. Even if uncompressed, the zip archive format is not going to happily allow you to change the size of any of the "files" it stores. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: map vs. list-comprehension

2005-07-01 Thread Scott David Daniels
mess that the design goals themselves are at fault for the big hairy mess. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Modules for inclusion in standard library?

2005-07-01 Thread Scott David Daniels
to be easily runnable for all developers is going to be tough for "third party programs." Making the interfaces work for differing versions of the 3PPs as the third parties themselves change their interfaces (see fun with Tcl/Tk versions for example), and building testbeds to test to all of

Re: Favorite non-python language trick?

2005-07-01 Thread Scott David Daniels
ften have a level of indirection that allows it to simply tweak an indirection table to implement this method. The reason I find it terrifying is that I can be passed an object, place it in a dictionary (for example) based on its value, and then it can magically be changed into something else wh

Re: Inheriting from object

2005-07-02 Thread Scott David Daniels
Bengt Richter wrote: > On Thu, 30 Jun 2005 08:54:31 -0700, Scott David Daniels <[EMAIL PROTECTED]> > wrote: >>Or, perhaps: >>class foo(object): >>def __init__(self, *args, **kwargs): >>super(foo, self).__init__(self, *args, **kwargs) >

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

2005-07-03 Thread Scott David Daniels
en a function taking no args and its result. 3) Python doesn't have a full set of functional primitives. Fold-right is one example, K-combinator is another, Why pick on reduce as-is to keep? There is another slippery slope argument going up the slope adding functional primitives. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Checkbutton initialization problem

2005-07-03 Thread Scott David Daniels
Paul Rubin wrote: > Python 2.4, Windows XP. If I say: > f = Frame() > f.grid() > v = IntVar() v.set(1) # Might help. v.get() at this point returned 0 for me. > c = Checkbutton(f, text='hi there', variable=v) > c.grid() > f.mainloop() -- http://mail.python.org/mailm

Re: map/filter/reduce/lambda opinions and backgroundunscientificmini-survey

2005-07-03 Thread Scott David Daniels
unds a lot like whining. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding NameError by defaulting to None

2005-07-06 Thread Scott David Daniels
l does not respond to message abc." My first reaction was always, "of course it doesn't, this message is useless." You really want the error to happen as close to the problem as possible. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Scott David Daniels
eresting community of users. These > probably make most of the difference. Well said. Writing speed is not everything; if it is, APL and Scheme win (and the evil Perl for string processing). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: (Win32 API) callback to Python, threading hiccups

2005-07-07 Thread Scott David Daniels
d Python's data structures to do that kind of work. --Scott David Daniels -- http://mail.python.org/mailman/listinfo/python-list

Re: Use cases for del

2005-07-08 Thread Scott David Daniels
ot just for speed). In older pythons the == result wasn't necessarily same as is-test. This made sense to me after figuring out NULL in database stuff. is-test will always work for None despite the other half. Not so for bogus objects like: >>> class WildCard(object): d

Re: Pattern question

2005-07-08 Thread Scott David Daniels
Gui else: raise "os %s not supported" % os.name class Installer(object): def __init__(self, guiFactory): self.gui = guiFactory(self) def main(): inst = Installer(makeGui) return inst.gui.main() --Scott David Daniels [EMAIL PROT

Re: Use cases for del

2005-07-09 Thread Scott David Daniels
;small" ints use a single identity can lead you to a mistaken belief that equal integers are always identical. >>> (12345 + 45678) is (12345 + 45678) False 'is' tests for identity match. "a is b" is roughly equivalent to "id(a) == id(b)". In

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Scott David Daniels
print a, abc a = Example(1,2) print a.__dict__ print a.a print a.abc --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting files in a subdirectory in a zip

2005-07-11 Thread Scott David Daniels
I was wondering if > there are any better ways. > import zipfile z = zipfile.ZipFile('block.zip') names = [name[7:] for name in z.namelist() if name.startswith('others/')] --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching through a list of tuples

2005-07-12 Thread Scott David Daniels
gt;>or "give me the first tuple whose 2nd element is y". iter(elem in lst if elem[3] == x).next() Does this look any better? At least it stops when the answer is found. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Slicing every element of a list

2005-07-12 Thread Scott David Daniels
the first one work. Further why > didn't the first one return an error? result = [line[1 : -5].split('\"\t\"') for line in lines] --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Frankenstring

2005-07-12 Thread Scott David Daniels
for c in thefile.read(): Or, if you did not want to do a full read: def filechars(afile): for line in afile: for char in line: yield char --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Building a function call? (update)

2005-07-13 Thread Scott David Daniels
eval("dothat(x,y)", None, (('x', 100), ('y', 200))) >> the right way to have it executed? You do know that you could do something like: result = eval('dothat')(100, 200) That is, eval of the function name gives you a function. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort files by date

2005-07-13 Thread Scott David Daniels
emy > If you have 2.4 or later: def mtime(filename): return os.stat(filename).st_mtime lst = sorted(glob.glob('*'), key=mtime) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Date & time in a Zip File

2005-07-13 Thread Scott David Daniels
y You should then be able to do something like: import zipf z = zipf.ZipFile('whatever.zip', 'a') and then copy the code for .write(...) using your own zinfo block. I imagine I'll eventually have a method like that named ".write_info(zinfo, data_itera

Re: What is your favorite Python web framework?

2005-07-18 Thread Scott David Daniels
an unknown quantity -- the phrase is usually only applied to horses that show well without the normal track record preceding that success. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regexp please

2005-07-22 Thread Scott David Daniels
Felix Collins wrote: > Hi, > I'm not a regexp expert and had a bit of trouble with the following search. > I have an "outline number" system like > 1 > 1.2 > 1.2.3 > I want to parse an outline number and return the parent. Seems to me regex is not the way to go: def parent(string):

<    2   3   4   5   6   7   8   9   10   11   >