Re: Why new Python 2.5 feature class C() return old-style class ?

2006-04-25 Thread Bengt Richter
On Sun, 23 Apr 2006 22:12:01 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] (IMO the proper way to indicate the you don't have a tuple is to use None or some other sentinel, not abuse a perfectly legal tuple value). dis.dis(compile('class X:pass','','exec')) 1 0 LOAD_CONST

Re: Why new Python 2.5 feature class C() return old-style class ?

2006-04-23 Thread Bengt Richter
, until py3k. Pontificating pushes my counter-pontificating button; that's the only explanation I have for doing this. I was going to stop wasting time, but find myself unable as yet fully to abandon scanning clp and python-dev ;-/ Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo

Re: Too Many if Statements?

2006-02-12 Thread Bengt Richter
c458: bla458 ... elif c1012: bla1012 else: done = False more, done = not done,True ... etc But the OP should find another approach I think, because this is still disgusting code ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo

Re: ordered sets operations on lists..

2006-02-12 Thread Bengt Richter
, of course. Perhaps newbies should be advised that [x for x in l1 if x in set(l2)] is not a (well) setified equivalent? I could see them being tempted. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: * 'struct-like' list *

2006-02-10 Thread Bengt Richter
On Tue, 07 Feb 2006 18:10:05 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] ernesto.py - [...] Just noticed: substrings = line.split() if substrings and isinstance(substrings, list) and substrings[0] == 'Name

Re: module with __call__ defined is not callable?

2006-02-10 Thread Bengt Richter
() as an ordinary function, and not be bothered with subclassing and jimmying sys.modules and such. Properties and methods are both forms of descriptors, so they need to be attributes of the type to work. With a subclass you could do that too. Regards, Bengt Richter -- http://mail.python.org/mailman

Re: Detecting line endings

2006-02-07 Thread Bengt Richter
be a mistake to convert or delete an '\r' ? (E.g., I think XML CDATA might be an example). Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Literal Escaped Octets

2006-02-07 Thread Bengt Richter
(s) '000102034142434430313233' binascii.b2a_base64(s) 'AAECA0FCQ0QwMTIz\n' which is also reversible later of course: h = binascii.hexlify(s) binascii.unhexlify(h) '\x00\x01\x02\x03ABCD0123' b64 = binascii.b2a_base64(s) binascii.a2b_base64(b64) '\x00\x01\x02\x03ABCD0123' Regards, Bengt

Re: * 'struct-like' list *

2006-02-07 Thread Bengt Richter
after Name: Ernesto line: 'Age: 44 Brithdy: 040106 SocialSecurity: 123456789\n' info [Person('David'), Person('Ernesto')] tweak to taste ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Generators vs. Functions?

2006-02-06 Thread Bengt Richter
(float.__sub__(*g()) for x in xrange(1)) -7.5428559682677587e-006 max(float.__sub__(*g()) for x in xrange(1)) -7.5428559682677587e-006 max(float.__sub__(*g()) for x in xrange(1)) -7.5428559682677587e-006 (It'll probably go ten times faster on a recent box ;-) Regards, Bengt

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Bengt Richter
' os.popen('ftype %s'%ft).read().split('=',1)[1].strip() 'D:\\MOZ\\MOZILL~1\\MOZILL~1.EXE -url %1' Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Intro to Pyparsing Article at ONLamp

2006-01-30 Thread Bengt Richter
the barn fell.) BTW, the online response has some clickable elements in the diagram to get to definitions of the terms. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Bengt Richter
conform to their usage preconceptions, but punish you with info discovery hell otherwise ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: writing large files quickly

2006-01-28 Thread Bengt Richter
that were never written are virtual blocks, inasmuch as read() at that location will cause the filesystem to return a block of NULs. I wonder if it will also write virtual blocks when it gets real zero blocks to write from a user, or even with file system copy utils? Regards, Bengt Richter

Re: Using non-ascii symbols

2006-01-27 Thread Bengt Richter
(300, 5) TIMES(3, 100) PLUS(300, 7) [25, 27, 205, 207, 35, 37, 305, 307] Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: generating method names 'dynamically'

2006-01-27 Thread Bengt Richter
the data? Are you the only one? Requirements, requirements ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a Python collection from an text-file

2006-01-27 Thread Bengt Richter
from the names loaded in the load method from the first line of the text file. The second line expects type names as you see in the types module, except without the Type suffix. Perhaps you can adapt for your purposes. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python String Substitution

2006-01-27 Thread Bengt Richter
to get Right: d[(1,2)] = Wrong print %((1,2))s % d '(1,2)' Wrong d[(1,2)] (1, 2) 'Right' Do you have a real use case? Just curious. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code written in 1998, how to improve/change it?

2006-01-26 Thread Bengt Richter
() 9 xbox[0]=4 g.next() 16 [g.next() for xbox[0] in xrange(10)] [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] One way to answer your question literally, whatever it may do to your gag reflex ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: customized instance dictionaries, anyone?

2006-01-26 Thread Bengt Richter
'] Wasted a bunch of time trying to get rid of that __getattr__ ;-/ Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Pulling numbers from ASCII filename not working

2006-01-26 Thread Bengt Richter
^^ ^^^ ^^ This is not lying ;-) I tried print repr(filename) and it returned the actual filename: 'n16w099.asc' , 'n17w062.asc' , etc. So you can see Latitude would be '16' '17' etc. right? On to the next traceback ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python

Re: Pulling numbers from ASCII filename not working

2006-01-25 Thread Bengt Richter
zFactor = 1/(113200 * (cos(radians))) BTW, capitalizing the first letter of python variable names is counter to usual convention. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: customized instance dictionaries, anyone?

2006-01-25 Thread Bengt Richter
'} y.foo Traceback (most recent call last): File stdin, line 1, in ? AttributeError: 'Y' object has no attribute 'foo' def ga(self, attr): print '__getattr__(%s)'%attr; return self.__dict__[attr] ... Y.__getattr__ = ga y.foo __getattr__(foo) _getdict 'bar' Regards, Bengt Richter

Re: Python code written in 1998, how to improve/change it?

2006-01-25 Thread Bengt Richter
, e.g., def gfoo(x, y): while True: yield x**2 + y**2 ifoo = gfoo('dummy','dummy') # or first pair for ifoo.x, ifoo.y in pairs: print ifoo.next() Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Using non-ascii symbols

2006-01-25 Thread Bengt Richter
he could use help with, if anything. He'd probably not like muddying any existing clear visions and plans with impractical ramblings though ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird generator id() behaviour (was Re: Python code written in1998, howto improve/change it?)

2006-01-25 Thread Bengt Richter
and the generator's yielded value could be ignored, but it could be handy if the generator is passed around IWT. The world could also feed info in as attributes of state. And other generators could share the same external state variable and all kinds of weird things could be built ;-) Regards, Bengt

Re: Redirecting standard out in a single namespace

2006-01-24 Thread Bengt Richter
On 23 Jan 2006 04:00:40 -0800, Fuzzyman [EMAIL PROTECTED] wrote: Bengt Richter wrote: [...] It wouldn't be shadowing, but I suppose you could replace sys.stdout with a custom object whose methods check where they were called from. Then you could give the object initialization parameters

Re: Decimal vs float

2006-01-23 Thread Bengt Richter
On Sat, 21 Jan 2006 14:28:20 +1100, Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 20 Jan 2006 04:25:01 +, Bengt Richter wrote: On Thu, 19 Jan 2006 12:16:22 +0100, =?ISO-8859-1?Q?Gerhard_H=E4ring?= [EMAIL PROTECTED] wrote: [...] floating points are always imprecise, so you wouldn't

Re: Redirecting standard out in a single namespace

2006-01-23 Thread Bengt Richter
it on or off etc. BTW, how about stderr? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code written in 1998, how to improve/change it?

2006-01-23 Thread Bengt Richter
On Mon, 23 Jan 2006 08:53:59 +1300, Carl Cerecke [EMAIL PROTECTED] wrote: Bengt Richter wrote: On Thu, 19 Jan 2006 23:16:57 -0500, Peter Hansen [EMAIL PROTECTED] wrote: How about something like actions = dict( ...a=compile('print A; state=b','','exec'), ...b=compile('print B

Re: Arithmetic sequences in Python

2006-01-23 Thread Bengt Richter
the various flavours of functions (function, bound method, unbound method, class method, static method...) *wink* but the difference between types and functions is fairly clear. Just don't ask about the difference between type and class... *wink* Why not? ;-) Regards, Bengt Richter -- http

Re: Python code written in 1998, how to improve/change it?

2006-01-20 Thread Bengt Richter
=b','','exec'), ...b=compile('print B; state=c','','exec'), ...c=compile('print C; state=None','','exec') ... ) state = 'a' while state: eval(actions[state]) ... A B C Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: excellent book on information theory

2006-01-19 Thread Bengt Richter
Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient implementation of deeply nested lists

2006-01-19 Thread Bengt Richter
a custom class factory that makes a class with a1..aN and can be instantiated with x, producing an object that behaves like L So the question in my mind is, how are you actually going to use these L things? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimal vs float

2006-01-19 Thread Bengt Richter
with an ordinary int ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

[OT] Nit: please don't user it's unless you can substitute it is without changing your inteded meaning.

2006-01-18 Thread Bengt Richter
(a book on punctuation) has something on that. (vs, Eats, Leaves, and Shoots -- panda vs gunslinger). Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Nit: please don't user it's unless you can substitute it is without changing your inteded meaning.

2006-01-18 Thread Bengt Richter
On 18 Jan 2006 04:19:37 -0800, Fuzzyman [EMAIL PROTECTED] wrote: Bengt Richter wrote: Typos happen to all of us, but in case you hadn't realized what it's is a contraction for (it is), now you do, and you can save yourself further embarrassment (assuming you care ;-). If your friends won't

Re: Preventing class methods from being defined

2006-01-17 Thread Bengt Richter
, in _null Exception: not allowed to access c2 = C(False) c2.test() test from c vars(c) {'test': bound method C._null of __main__.C object at 0x02EF3C4C} vars(c2) {} R._restrict ['test'] Still don't know what real application problem this is solving, but that's ok ;-) Regards, Bengt

Re: Decimal ROUND_HALF_EVEN Default

2006-01-17 Thread Bengt Richter
is the way some other int conversions have worked, but I can't recall the context ATM. I.e., just trim the fractional bits from the theoretical fixed point twos complement number, which always subtracts those positive-value fractional bits algebraically. Regards, Bengt Richter -- http

Re: proposal: another file iterator

2006-01-16 Thread Bengt Richter
become visible for me yet, but I assume Jean-Paul was referring to lambda use as in e.g. (untested): for chunk in iter(lambda frd=open('yerf', 'rb').read:frd(blocksize), ''): ... Does it not do what you want? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: instance attributes not inherited?

2006-01-16 Thread Bengt Richter
method Child.__init__ of __main__.Child object at 0x02EF80CC c.sup.__init__() Inside Parent.__init__() I don't know if this helps ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-16 Thread Bengt Richter
On Mon, 16 Jan 2006 21:58:26 +1100, Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 16 Jan 2006 10:34:40 +, Bengt Richter wrote: class A: ... def __getattr__(self, attr): print 'A().%s'%attr; raise AttributeError ... class B: ... def __getattr__(self, attr): print 'B

Re: Is 'everything' a refrence or isn't it?

2006-01-16 Thread Bengt Richter
On Mon, 16 Jan 2006 21:58:26 +1100, Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 16 Jan 2006 10:34:40 +, Bengt Richter wrote: class A: ... def __getattr__(self, attr): print 'A().%s'%attr; raise AttributeError ... class B: ... def __getattr__(self, attr): print 'B

Re: Preventing class methods from being defined

2006-01-16 Thread Bengt Richter
to advantage sometimes, but needs good documentation to be clear for the next code maintainer ;-) I guess I should re-read your original requirements that led to thes design ideas. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Listing partitions (on win32)

2006-01-15 Thread Bengt Richter
gets '' which makes the if fail) def fakeGetLogicalDriveStrings(): ... return [c+':' for c in (chr(n) for n in xrange(ord('A'), ord('Z')+1)) ... if os.popen('dir %s:\\xxx'%c).read()] ... fakeGetLogicalDriveStrings() ['C:', 'D:', 'E:', 'V:', 'W:'] Regards, Bengt

Re: Listing partitions (on win32)

2006-01-15 Thread Bengt Richter
On Sun, 15 Jan 2006 08:08:16 -0500, Roger Upole [EMAIL PROTECTED] wrote: Bengt Richter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 14 Jan 2006 16:52:33 -0800, Claude Henchoz [EMAIL PROTECTED] wrote: Hi Is there any way of listing partitions on a (win32) computer without using

Re: instance attributes not inherited?

2006-01-15 Thread Bengt Richter
calling Parent.__init__ from Child.__init__, depending on desired semantics. Is this a problem with Python's notion of how OO works? Nope ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to remove subset from a file efficiently?

2006-01-14 Thread Bengt Richter
/sys. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive tree list from dictionary

2006-01-14 Thread Bengt Richter
']] Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-14 Thread Bengt Richter
Ada was green ;-) Makes me wonder if generators could usefully have rendezvous('?, es?) ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: flatten a level one list

2006-01-13 Thread Bengt Richter
addition implementation to ''.join was reasonable. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Failing unittest Test cases

2006-01-12 Thread Bengt Richter
and report if pass etc. Then if code change unexpectedly makes a test work, the config file can just be updated, not the test. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Bengt Richter
. Then the question becomes modified w.r.t. what prior state? This lets the OP ask at any time whether the dict is/has_been modified, but it's not a basis for e.g., a modification-event callback registry or such. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: More than you ever wanted to know about objects [was: Is everything a refrence or isn't it]

2006-01-12 Thread Bengt Richter
;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: can't solve an exercise-help me with it

2006-01-11 Thread Bengt Richter
Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Do you have real-world use cases for map's None fill-in feature?

2006-01-10 Thread Bengt Richter
On 10 Jan 2006 00:47:36 -0800, Raymond Hettinger [EMAIL PROTECTED] wrote: [Bengt Richter] What about some semantics like my izip2 in http://groups.google.com/group/comp.lang.python/msg/3e9eb63a1ddb1f46?hl=en (which doesn't even need a separate name, since it would be backwards

Re: Augmented generators?

2006-01-10 Thread Bengt Richter
of an easy way to write something that looks like a generator (using yield), but can also incorporate methods other than next? See above. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Augmented generators?

2006-01-10 Thread Bengt Richter
() ... it = DervAugit(dict(enumerate('abcd'))) for i in it: ... print i, it.value() ... 0 a 1 b 2 c 3 d Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.izip brokeness

2006-01-09 Thread Bengt Richter
On 9 Jan 2006 08:19:21 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: Op 2006-01-05, Bengt Richter schreef [EMAIL PROTECTED]: On 5 Jan 2006 15:48:26 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: [...] But you can fix that (only test is what you see ;-) : Maybe, but not with this version. from

Re: Do you have real-world use cases for map's None fill-in feature?

2006-01-09 Thread Bengt Richter
to exhaust though). Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-09 Thread Bengt Richter
, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Viewing Binary Data

2006-01-08 Thread Bengt Richter
at the right? Bit numbers or hex byte offsets at the left? Do you need a one-liner solution? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: question about mutex.py

2006-01-08 Thread Bengt Richter
principles established with corn flakes and decoder rings are thought to translate perfectly to the digital domain of FOSS distros including anything toy-like. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiway Branching

2006-01-08 Thread Bengt Richter
. for byte1, byte2 in (66,32), (32,1), (36,32), (32,32), (20,20): ... print '%10s = %r' %((byte1,byte2), pairvalues.get((byte1,byte2), 'DEFAULT ??')) ... (66, 32) = 0.16701 (32, 1) = 5 (36, 32) = 'natural' (32, 32) = 0 (20, 20) = 'DEFAULT ??' HTH Regards, Bengt Richter

Re: Multiway Branching

2006-01-08 Thread Bengt Richter
know better. I guess I do, since I always rant about requirements ;-/ Also don't know why I chose to use dict([]) vs {}, since there's no bare key names to clean the quotes off of. Oh well. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: decorator question

2006-01-08 Thread Bengt Richter
:04 2006 diff = 5.007000 sec foo(.5) started at Sun Jan 08 14:15:16 2006 ended at Sun Jan 08 14:15:17 2006 diff = 0.501000 sec Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the slickest way to transpose a square list of lists (tuple of tuples)?

2006-01-08 Thread Bengt Richter
it's not homework ;-) sq = [[r+c for c in 'abc'] for r in '123'] for r in sq: print r ... ['1a', '1b', '1c'] ['2a', '2b', '2c'] ['3a', '3b', '3c'] for r in (zip(*sq)): print r ... ('1a', '2a', '3a') ('1b', '2b', '3b') ('1c', '2c', '3c') Regards, Bengt Richter -- http://mail.python.org

Re: is there any lib can split string in this way?

2006-01-08 Thread Bengt Richter
containing escaped same) and strip quotes off) and tested only as you see ;-) import re rx = re.compile(r'([^]*)|(\w+)') s = 'abc def this is a test ok' [a or b for a,b in rx.findall(s)] ['abc', 'def', 'this is a test', 'ok'] Regards, Bengt Richter -- http://mail.python.org/mailman

Re: Does Python allow access to some of the implementation details?

2006-01-07 Thread Bengt Richter
) '-0x5A4653CA673768565B41F775D6947D55CF3813D1L' gentle rant (I leave it to your judgement as to how useful our current hex() representation of negative numebers is ;-) /gentle rant Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.izip brokeness

2006-01-06 Thread Bengt Richter
On 5 Jan 2006 14:34:39 -0800, [EMAIL PROTECTED] wrote: Bengt Richter wrote: On 5 Jan 2006 15:48:26 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2006-01-04, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: But here is my real question... Why isn't something like

Re: inline function call

2006-01-05 Thread Bengt Richter
really a distraction from more radical stuff I'd like to try ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread Bengt Richter
implementation, but I think binding site and reference as I have just used them, are also abstract concepts, capable of alternative, non-C implementation of the python semantics. So I thought I'd try this as a possible terminology, to see if it makes it any easier for anyone ;-) Regards, Bengt Richter

Re: Hypergeometric distribution

2006-01-05 Thread Bengt Richter
On Thu, 05 Jan 2006 09:47:02 -0600, Robert Kern [EMAIL PROTECTED] wrote: Bengt Richter wrote: On 4 Jan 2006 12:46:47 -0800, Raven [EMAIL PROTECTED] wrote: The problem with Stirling's approximation is that I need to calculate the hypergeometric hence the factorial for numbers within a large

Re: itertools.izip brokeness

2006-01-05 Thread Bengt Richter
)) for t in it: print t ... (3, 11) (5, 22) (8, 'Bye') (Feel free to generalize ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.izip brokeness

2006-01-05 Thread Bengt Richter
On Thu, 05 Jan 2006 07:42:25 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: On 4 Jan 2006 15:20:43 -0800, Raymond Hettinger [EMAIL PROTECTED] wrote: [ ... 5 options enumerated ... ] 6. Could modify izip so that one could write from itertools import izip zipit = izip(*seqs

Re: Translate this to python?

2006-01-04 Thread Bengt Richter
-1 j = 0 while jnPoints: # whatever body code i = j j += 1 Not sure what i is really for, but j seems to be independent, so perhaps (also untested, and caveat: it's past bedtime) i = nPoints - 1 for j in xrange(nPoints): # whatever i = j Regards, Bengt Richter -- http

Re: Hypergeometric distribution

2006-01-04 Thread Bengt Richter
that affects your judgement of Stirling's approximation. In fact, perhaps the semantics of your value usage could even suggest an alternate algorithmic approach to your actual end result. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.izip brokeness

2006-01-04 Thread Bengt Richter
and notice sentinel for yourself Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Hypergeometric distribution

2006-01-02 Thread Bengt Richter
wouldn't get zero if you scaled by 10**significant_digits (however many you require) before dividing. E.g., expected hits per trillion (or septillion or whatever) expresses probability too. Perhaps that could work in your calculation? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo

Re: python coding contest

2005-12-28 Thread Bengt Richter
lineseps (is that cheating on windows?) No imports. Guess I'll have to try another tack ;-/ Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-26 Thread Bengt Richter
On Sun, 25 Dec 2005 16:39:47 +0100, Simon Hengel [EMAIL PROTECTED] wrote: Hello, we are hosting a python coding contest an we even managed to provide a price for the winner... ^ How much are you going to sell him or her for? ;-) Regards, Bengt Richter -- http://mail.python.org/mailman

Re: Windows and python execution

2005-12-26 Thread Bengt Richter
? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido at Google

2005-12-23 Thread Bengt Richter
as your very own personal body guard ;) That is such a nice quote that I am going to put it in my email signature ! :) -Anand Maybe look into fixing the above problem while you're at it? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging: Formatter: name of the function

2005-12-23 Thread Bengt Richter
('hello') hello 'whatever' You could still do stuff unconditionally of course, and also inside foo. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido at Google

2005-12-22 Thread Bengt Richter
On Wed, 21 Dec 2005 21:47:29 -0500, Peter Hansen [EMAIL PROTECTED] wrote: Bengt Richter wrote: [roughly an inch is not exactly 25.4mm] At least according to my dusty 37th Edition Handbook of Chemistry and Physics (c) 1955. Maybe things have changed since then ;-) Wikipedia concurs with Jim

Re: Guido at Google

2005-12-22 Thread Bengt Richter
On Wed, 21 Dec 2005 18:30:03 -0700 (MST), Jim Benson [EMAIL PROTECTED] wrote: On Thu, 22 Dec 2005, Bengt Richter wrote: For Americans: 15 meters is roughly 50 feet. Google can do that too, of course. wink http://www.google.com/search?q=convert+15+meters+to+feet (49.2125984 feet

Re: deal or no deal

2005-12-22 Thread Bengt Richter
probability, you'd expect 19./26 0.73076923076923073 to be the fraction satisfying pick10 With a larger sample, the fraction should show better, e.g., sum(random.choice(amounts)10 for _ in xrange(100)) 730983 Does that help? Regards, Bengt Richter -- http://mail.python.org

Re: Guido at Google

2005-12-22 Thread Bengt Richter
on the head of a project? ;-) Seriously, if you heavies do sometimes work on the same project, it would be interesting to know what modes of co-operation you tend to adopt. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Providing 'default' value with raw_input()?

2005-12-22 Thread Bengt Richter
get old fast, so you might e.g. want to accept a '?' to get extra context-sensitive info instead, followed by retry. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: jython: True and False boolean literals?

2005-12-22 Thread Bengt Richter
On 22 Dec 2005 10:51:22 -0800, [EMAIL PROTECTED] wrote: Aren't there boolean literals for True and False in Python (jython)? I can't get true, True, false, or False to work. I ended up having to use (1==1) and (1==0). You may want to upgrade to a newer version. Regards, Bengt Richter -- http

Re: Providing 'default' value with raw_input()?

2005-12-22 Thread Bengt Richter
On 22 Dec 2005 12:42:36 -0800, planetthoughtful [EMAIL PROTECTED] wrote: Bengt Richter wrote: On 22 Dec 2005 08:55:17 -0800, planetthoughtful [EMAIL PROTECTED] wrote: I would like to include the ability to edit an existing value (drawn from an SQLite table) using a DOS console Python app

Re: parsing engineering symbols

2005-12-21 Thread Bengt Richter
= SI_prefixes[str[-1]] return float(str[:-1]) * 10**exp except KeyError: return float(str) ? Nit: why not move 10** out of myfloat into SI_prefixes (i.e., just retrieve precalculated factors)? Nit_2: No twinge of conscience shadowing str? ;-) Regards, Bengt Richter -- http

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Bengt Richter
a useful fact better. Maybe under str.__mul__ ? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Reducing import try/except boilerplate

2005-12-21 Thread Bengt Richter
expressions, e.g., import cond and name or alternate as mod # == import (cond and 'name') or alternate as mod Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido at Google

2005-12-21 Thread Bengt Richter
/inch so the distance from Martellibot to BDFL should more exactly be 15*39.37/12 49.2124999 Send bug report to google ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumeration idioms: Values from different enumerations

2005-12-20 Thread Bengt Richter
and FalseSentinel (or sentinel_t and sentinel_f or pick some names ;-) so we wouldn't be tempted to misuse unique builtins like NotImplemented and Exception etc. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing text

2005-12-20 Thread Bengt Richter
string vs regular expression). Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Do you recommend a good artificial intelligence book?

2005-12-20 Thread Bengt Richter
implementation is complete, but the Lisp version is closer. BTW, Peter Norvig is co-author ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing engineering symbols

2005-12-20 Thread Bengt Richter
function(s) = 12000.0 I searched the web, but could not find any function. It should be easy enough, if you can define precisely what contains engineering symbols means ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonic equivalent of upvar?

2005-12-20 Thread Bengt Richter
# Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >