Re: suggestions between these two books

2005-10-28 Thread Alex Martelli
r 2.3 and 2.4 (and perhaps 2.5 by the time I'll be done, as progress is being quite slow -- as uber technical lead at Google, I'm pretty busy these days!-), but I do agree that the current edition is still quite useful. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling class instances with __slots__

2005-10-28 Thread Alex Martelli
Alex <[EMAIL PROTECTED]> wrote: ... > I have a series of new classes with child-parent relationship and each > has unique __slots__. They don't have __dict__ . I need to be able to > pickle and unpickle them. As far as I could understand, I need to > provide __getsta

Re: Expanding Python as a macro language

2005-10-29 Thread Alex Martelli
t (some future Firefox version might perhaps integrate a Python engine, just like it integrates a Javascript engine today, but I wouldn't hold my breath waiting;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: py.log using decorators for DRY

2005-10-29 Thread Alex Martelli
with early binding), I'd code: def logit(fn): method = getattr(log, fn.func_name) def callit(**kwargs): return method(kwargs) return callit If you need to do late binding instead, you can move the getattr to inside the body of callit. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-29 Thread Alex Martelli
, since block always keeps the last overlap bytes; it needs to be changed into something like (warning -- untested code!-) if overlap>0: while True: next = f.read(blocksize-overlap) if not next: break block = block[-overlap:] + next yield block else: while True: next = f.r

Re: Scanning a file

2005-10-29 Thread Alex Martelli
Python, yes. In other equally valid implementations of the language, such as Jython, IronPython, or, for all we know, some future implementation of Classic, that may well not be the case. Many, quite reasonably, dislike relying on a specific implementation's peculiarities, and prefer to

Re: extracting numbers from a file, excluding fixed words

2005-10-29 Thread Alex Martelli
ing, untested code...]] infile = open('infile.txt') oufile = open('oufile.txt', 'w') for line in infile: if line.strip().isdigit(): oufile.write(line) oufile.close() infile.close() Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive generators and backtracking search

2005-10-29 Thread Alex Martelli
would mean no keywords would need to be added). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda functions within list comprehensions

2005-10-29 Thread Alex Martelli
you can use a lambda factory in the same role as the much clearer and more readable factory function you had (which I keep thinking is the _sensible_ solution)...: funcs = [ (lambda x,y: lambda n: x*y/n)(x,y) for x,y in a ] Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda functions within list comprehensions

2005-10-29 Thread Alex Martelli
Max Rybinsky <[EMAIL PROTECTED]> wrote: > Thank you for explanation, Alex. > It appears that almost every beginner to Python gets in trouble with > this ...feature. :) Almost every beginner to Python gets in trouble by expecting "do what I'm thinking of RIGHT NOW&qu

Re: Scanning a file

2005-10-29 Thread Alex Martelli
Paul Watson <[EMAIL PROTECTED]> wrote: > "Alex Martelli" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > In today's implementations of Classic Python, yes. In other equally > > valid implementations of the language, such as J

Re: Scanning a file

2005-10-29 Thread Alex Martelli
, emit messages that can erroneously end up in the redirected stdout of your program... VERY, VERY bad things. Don't ever catch and ``handle'' exceptions in such ways. In particular, each time you're thinking of writing a bare 'except:' clause, think again, and you'll most likely find a much better approach. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Expanding Python as a macro language

2005-10-29 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > For the other Alex observations (about Mac OsX and my examples of > automation centered on web automation) I have a PC, and the fact that > Python is very good at dealing with the web, doesn't help too much > in this case... All of your

Re: Automatic binding of **kwargs to variables

2005-10-29 Thread Alex Martelli
arg1, arg2=arg2) I don't understand what added value all of those extra, contorted lines are supposed to bring to the party. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-30 Thread Alex Martelli
memory chip just melted, the CPU's on strike, locusts...! Not stuff any program can do much about in the short term, except by switching to a different machine. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic binding of **kwargs to variables

2005-10-30 Thread Alex Martelli
equent use case, so this further level of refinement was apparently not warranted ("use only as much power as you need" is a programming principle that tends to promote simplicity, and therefore, in many cases, is well worth adhering to). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic binding of **kwargs to variables

2005-10-30 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > I find this style of coding repulsive when compared to: > > > > def foo(arg1=None, arg2=None): > > print dict(arg1=arg1, arg2=arg2) > > > > I don't understand

Re: process and spinning slash

2005-10-30 Thread Alex Martelli
pt spinning even the child process was ended. It would be astonishing if it were otherwise! The loop in function spin is deliberately coded to NEVER terminate, so of course it never does. > Any idea ? Thanks! Have the spin function accept the pid argument and exit the loop if said pid has termi

Re: process and spinning slash

2005-10-30 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > Have the spin function accept the pid argument and exit the loop if said > > pid has terminated; to check the latter, e.g., os.kill(pid, 0) -- this > > will raise an OSError if no process with t

Re: Scanning a file

2005-10-30 Thread Alex Martelli
John J. Lee <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > [...] > > If you're trying to test your code to ensure it explicitly closes all > > files, you could (from within your tests) rebind built-ins 'file' and > > 

Re: Scanning a file

2005-10-30 Thread Alex Martelli
t to re-raise the "accidentally caught" exception if needed. But if something goes wrong that you had NOT anticipated, just log as much info as you can for the postmortem, give nice diagnostics to the user if you wish, and do NOT keep processing -- and for these diagnostic-only purposes, use sys.excepthook, not a slew of try/except all over your application making it crufty and unmaintainable. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Controlling output using print with format string

2005-10-30 Thread Alex Martelli
he right tool for the job: print for simple output, often diagnostic in nature, where you don't mind the spaces and/or newlines that implies; sys.stdout.write when you do want to really control every aspect of the output. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickling and unpickling inherited attributes

2005-10-30 Thread Alex Martelli
Alex <[EMAIL PROTECTED]> wrote: > I have a serious problem and I hope there is some solution. It is > easier to illustrate with a simple code: > > >>> class Parent(object): > __slots__=['A', 'B'] > def __init__(self, a, b): >

Re: putting a string in Mac Address form

2005-10-30 Thread Alex Martelli
is the while loop part. Could it be better? What about replacing this whole block with, say...: return ':'.join(mac[c:c+2] for c in range(0, 12, 2)).upper() (as you did already check that len(mac) is 12...) Alex -- http://mail.python.org/mailman/listinfo/python-list

'super' to only be used for diamond inheritance problems?

2005-10-31 Thread Alex Hunsley
I've seen a few discussion about the use of 'super' in Python, including the opinion that 'super' should only be used to solve inheritance diamond problem. (And that a constructor that wants to call the superclass methods should just call them by name and forget about super.) What is people's op

data hiding/namespace pollution

2005-10-31 Thread Alex Hunsley
on what exactly you're coding, the size of the project etc., but what I'm trying to find out about is the python communities' recognised good practices. thanks, alex -- http://mail.python.org/mailman/listinfo/python-list

mixin helper class for unknown attribute access?

2005-10-31 Thread Alex Hunsley
I know that I can catch access to unknown attributes with code something like the following: class example: def __getattr__(self, name): if name == 'age': return __age else: raise AttributeError but is there an existing mixin helper class in

Re: data hiding/namespace pollution

2005-10-31 Thread Alex Hunsley
bruno at modulix wrote: > Alex Hunsley wrote: > >>There's no really specific questions in this post, but I'm looking for >>people's thought on the issues within... >> >> >>The two main versions I've encountered for data pseudo-hiding &

Re: data hiding/namespace pollution

2005-10-31 Thread Alex Hunsley
Jorge Godoy wrote: > Alex Hunsley <[EMAIL PROTECTED]> writes: > > >>Sorry, I wasn't being clear. What I should have said is that I don't like the >>idea of a typo in an assignment causing the assigning of the wrong thing. >>e.g. imagine a si

Re: data hiding/namespace pollution

2005-10-31 Thread Alex Hunsley
Jorge Godoy wrote: > Alex Hunsley <[EMAIL PROTECTED]> writes: > > >>Sorry, I wasn't being clear. What I should have said is that I don't like the >>idea of a typo in an assignment causing the assigning of the wrong thing. >>e.g. imagine a si

Re: mixin helper class for unknown attribute access?

2005-10-31 Thread Alex Hunsley
Steven D'Aprano wrote: > On Mon, 31 Oct 2005 10:39:40 +0000, Alex Hunsley wrote: > > >>I know that I can catch access to unknown attributes with code something >>like the following: >> >>class example: >> def __getattr__(self, name): >>

Re: data hiding/namespace pollution

2005-10-31 Thread Alex Hunsley
Jorge Godoy wrote: > Alex Hunsley <[EMAIL PROTECTED]> writes: > > >>Btw, can you recall the subject line of the thread? I'd like to google groups >>for it and have a read of that thread... >>ta! > > > Search for: "alex martelli pychecker&

Re: Need Python Pro for Help!! Plzz

2005-10-31 Thread Alex Hunsley
[EMAIL PROTECTED] wrote: > Need python Pro at [EMAIL PROTECTED] , if u wanna help, 1) Why would anyone want to help you when you're not even willing to spend the (small) time and effort to spell simple words like "you" correctly or make sure your post actually makes sense? Start by helping you

Re: data hiding/namespace pollution

2005-10-31 Thread Alex Hunsley
Steven D'Aprano wrote: > On Mon, 31 Oct 2005 10:35:19 +0000, Alex Hunsley wrote: > > >>There's no really specific questions in this post, but I'm looking for >>people's thought on the issues within... >> >> >>The two main versions I&

Re: mixin helper class for unknown attribute access?

2005-10-31 Thread Alex Martelli
restriction easily -- such restrictions are always intended against *accidental* cases, not against deliberate attacks). Differently from __slots__, Rats gives no problems with pickling, inheritance, etc, etc. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: data hiding/namespace pollution

2005-10-31 Thread Alex Martelli
Alex Hunsley <[EMAIL PROTECTED]> wrote: > There's no really specific questions in this post, but I'm looking for > people's thought on the issues within... > > > The two main versions I've encountered for data pseudo-hiding > (encapsulation) in p

Re: 'super' to only be used for diamond inheritance problems?

2005-10-31 Thread Alex Martelli
Alex Hunsley <[EMAIL PROTECTED]> wrote: > I've seen a few discussion about the use of 'super' in Python, including > the opinion that 'super' should only be used to solve inheritance > diamond problem. (And that a constructor that wants to call the >

Re: Scanning a file

2005-10-31 Thread Alex Martelli
language specs neither mandate nor forbid such behavior. How, exactly, does the OP believe the language specs should "allow" (presumably, REQUIRE) ``the runtime'' to communicate the sum total of all that it's doing or not doing (beyond whatever the language specs themselves may require or forbid it to do) on any particular occasion...?! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing empties

2005-10-31 Thread Alex Martelli
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Alex Martelli <[EMAIL PROTECTED]> wrote: > > > >the canonical idiom when you need such distinction is: > > > >_not_there = object() > >def foo(bar=_not_there, baz=_n

Re: Need Python Pro for Help!! Plzz

2005-11-01 Thread Alex Hunsley
Gerhard Häring wrote: > Alex Hunsley wrote: > >> [EMAIL PROTECTED] wrote: >> >>> Need python Pro at [EMAIL PROTECTED] , if u wanna help, >> >> [...] >> 2) Why should someone willing to help you enter into a private email >> discussion? [...]

Re: Need Python Pro for Help!! Plzz

2005-11-01 Thread Alex Hunsley
Fredrik Lundh wrote: > Alex Hunsley wrote: > > >>2) Why should someone willing to help you enter into a private email >>discussion? Newsgroups like this exist to help people > > > looks like "Fan" wants to run his own group: > > ht

Re: Need Python Pro for Help!! Plzz

2005-11-01 Thread Alex Hunsley
Alex Hunsley wrote: > Fredrik Lundh wrote: > >> Alex Hunsley wrote: >> >> >>> 2) Why should someone willing to help you enter into a private email >>> discussion? Newsgroups like this exist to help people >> >> >> >> looks like &q

Re: Storing empties

2005-11-02 Thread Alex Martelli
te "there is NOTHING here". I love it. For pickling, object() as a unique "nothing here, NOT EVEN a None" marker (AKA sentinel) works fine. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary that have functions with arguments

2005-11-02 Thread Alex Martelli
READY called func1 at the time the execfunc dict was being built. Suggestion: parenthesise differently to make tuples: execfunc = { 'key1' : (func1, ()), 'key2' : (func2, args) } now, something like: f, a = execfunc[k] f(**a) will work for either key. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary that have functions with arguments

2005-11-02 Thread Alex Martelli
Leif K-Brooks <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > execfunc = { 'key1' : (func1, ()), > > 'key2' : (func2, args) } > > > > now, something like: > > > > f, a = execfunc[k] > > f(*

Re: Most efficient way of storing 1024*1024 bits

2005-11-02 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: ... > You can use re.search on array.array byte vectors. I don't know how > the speed compares with string.find. Pretty well, though of course one should measure on representative cases for one's specific application needs:

Re: Python for .NET and IronPython

2005-11-02 Thread Alex Martelli
A beginner might be best advised to stick with CPython (and, if DotNet is needed, perhaps the Python-like language Boo) while IronPython stabilizes and fleshes out, but I'm rather more optimistic than you about the speed with which that will happen. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way of storing 1024*1024 bits

2005-11-02 Thread Alex Martelli
tpatterns with re or string.find; if the bits were packed 8 to a byte, such searches would be very hard. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion for (re)try statement

2005-11-02 Thread Alex Martelli
even a committee, would no doubt produce even more bloat. If you want bloat, go use a bloated language (there are so incredibly many of them, that you'll have your pick!), and please leave alone one of the few languages that have managed to at least control the amount of cruft they have accumulated over the years (we keep hoping for a REMOVAL of many legacy features come Python 3.0 time, in fact). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's website does a great disservice to the language

2005-11-02 Thread Alex Martelli
ea but not your formula. If the most junior team member was 1 month out of school, would it really be OK for the supervisor to be somebody who graduated 3 months ago?-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: weakrefs to functions for observer pattern

2005-11-02 Thread Alex Martelli
functions*, i.e., ones written in *C*. Just wrap any builtin function you need to register as observer into a tiny Python-coded wrapper and live happily ever after. ... > Not all objects can be weakly referenced; those objects which can > include class instances, functions written in Python (but

Re: Nested List Question

2005-11-02 Thread Alex Martelli
you observe is the only possible one. If you want copies instead, ASK for copies...: gridSystemId = [ [None]*columns for x in xrange(rows) ] Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way of storing 1024*1024 bits

2005-11-03 Thread Alex Stapleton
On 3 Nov 2005, at 05:03, Alex Martelli wrote: > Brandon K <[EMAIL PROTECTED]> wrote [inverting his topposting!]: > > >>> Six megabytes is pretty much nothing on a modern computer. >>> > > >> BTW, it'd be 6 megabits or 750kb ;) >> > &g

Re: Most efficient way of storing 1024*1024 bits

2005-11-03 Thread Alex Martelli
Alex Stapleton <[EMAIL PROTECTED]> wrote: ... > >>> Six megabytes is pretty much nothing on a modern computer. > > > >> BTW, it'd be 6 megabits or 750kb ;) > > > > ...but Mike was proposing using one digit per bit, hence, 6 megabytes. > >

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Alex Martelli
red, that apparently doesn't matter) and based on type inference, with several similarities to Python (I have no experience of Boo since Mono's installations on MacOSX haven't worked well for me, but on paper it looks nice). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Alex Martelli
some low levels, and BoostPython as "glue"); other Python success stories show it used in payroll applications (the hugely successful PayThyme), productivity ones (OSAF's Chandler), etc, etc. Look around the web for "Python success stories" and you may find man

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Alex Martelli
mentations, pyrex, BoostPython, and a zillion other tools, it's just about impossible to give examples of libraries which Python cannot use pretty easily and successfully. Library availability (through any or all of these tools) is one of the strong practical argument FOR Python!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I package a python script and modules into a single script?

2005-11-03 Thread Alex Martelli
's a recipe for that in the Python Cookbook (2nd edition). (I believe py2app doesn't need to package the standard library, either, since it comes with MacOSX 10.3 and later, but I haven't checked). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: weakrefs to functions for observer pattern

2005-11-03 Thread Alex Martelli
for me. > > I really enjoy python. So many good things have been added to the > language without taking the fun away :-) Glad to hear this! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Alex Martelli
ou didn't top-post, though (i.e., if you didn't put your comments BEFORE what you're commenting on -- that puts the "conversation" in a weirdly distorted order, unless one give up on quoting what you're commenting on, or invests a lot of time and energy in editing...;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's website does a great disservice to the language

2005-11-03 Thread Alex Martelli
Rocco Moretti <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > The Eternal Squire <[EMAIL PROTECTED]> wrote: > >... > > > >>2) Consider what he really wants for a supervisor of software > >>engineers. Ideally such a person should b

Re: Not Equal to Each Other?

2005-11-03 Thread Alex Martelli
thons standard library) and you'll do even better!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I package a python script and modules into a single script?

2005-11-03 Thread Alex Martelli
book -- but it does not address the specific problem you desire. Raedler's recipe does. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: when and how do you use Self?

2005-11-03 Thread Alex Martelli
le(23) In this case, the 'self' inside each method refers to the same object to which the name 'x' refers ``on the outside''. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning multiple languages (question for general discussion)

2005-11-03 Thread Alex Martelli
ers, on average -- admittedly, out of these, only sawzall and pyrex are ones I've used "for real", the other ones I've studied but never found real-life occasions to use, but that, too (using IRL about 25% of the languages one learns), is roughly par for the course (I would g

Re: Anomaly in creating class methods

2005-11-03 Thread Alex Martelli
at's all of the difference that's biting you... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Anyone Help me on this

2005-11-03 Thread Alex Martelli
cription's fee. In those 2 weeks you get to read for free a few books in the online library -- I'd suggest sampling the Nutshell, the Cookbook and possibly a couple more... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Anomaly in creating class methods

2005-11-03 Thread Alex Martelli
n about the several small differences between the new-style object model and the old-style, legacy one. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: I need Motivation

2005-11-03 Thread Alex Martelli
[EMAIL PROTECTED] wrote: > I m not a python Expert or anythin > i need help, i m losin my motivation to continue with python > can anyone inspire me again.??? Not without knowing more about your motivations for starting Python in the first place... Alex -- http://mail.python.or

Re: Most efficient way of storing 1024*1024 bits

2005-11-04 Thread Alex Stapleton
On 4 Nov 2005, at 10:26, Ben Sizer wrote: > Tom Anderson wrote: > >> On Wed, 2 Nov 2005, Dan Bishop wrote: >> >> >>> Tor Erik Sønvisen wrote: >>> >>> I need a time and space efficient way of storing up to 6 million bits. >>> >>> The most space-efficient way of storing bits is to

Re: Learning multiple languages (question for general discussion)

2005-11-04 Thread Alex Martelli
Magnus Lycka <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Yes, but I haven't found knowing (and using) Python dampens my > > enthusiasms for learning new languages. > > But you're more enthusiatic than most of us Alex. I wish > I could say th

Re: GMPY: divm() memory leak revisited

2005-11-05 Thread Alex Martelli
nderstand why that is the case), and the best way to reach me these days is through "gmail.com" . Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: __new__

2005-11-06 Thread Alex Martelli
ting A will not. I think the right correction to the Nutshell is therefore: x = C.__new__(C, 23) if isinstance(x, C): type(x).__init__(x, 23) and this is how I plan to have it in the 2nd edition. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning multiple languages (question for general discussion)

2005-11-06 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > I can't imagine NOT getting enthusiastic and stimulated by reading Van > > Roy and Hariri's book -- it IS quite as good and readable as SICP. > > It's been o

gmpy 1.01 rc near... anybody wanna test>

2005-11-06 Thread Alex Martelli
a great time to send me any bug reports or (minor;-) feature requests, since I hope to release a "1.01 release candidate" of gmpy ASAP. I'm currently unable to build any Windows version -- any volunteer for THAT task is doubly welcome;-). Thanks, Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-07 Thread Alex Martelli
mpy.mpz(4) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: unsupported operand type(s) for //: 'mpz' and 'mpz' while, on my machine: Helen:~/gmpy/test alex$ python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer,

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-07 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > gmpy users able to download and build from sourceforge's cvs are > > encouraged to test the current CVS version. > > Oh cool, I wondered whether any gmpy maintenance was

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-07 Thread Alex Martelli
hink VC per se will suffice -- somebody needs to build or find a suitable version of GMP for Windows, too. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: O_DIRECT on stdin?

2005-11-07 Thread Alex Fraser
ot;raw" > device files, where the current offset and transfer size must be a > multiple of some block size? Very likely. It is also likely that the same applies to the destination (ie memory) address. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON LOOSING FOR JAVA???????

2005-11-07 Thread Alex Martelli
nybody to _worry_ about "the future of ... Python"?! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: overloading *something

2005-11-07 Thread Alex Martelli
I've looked at getitem, getslice, and iter. What is it if not one of these? Obviously James hadn't looked at __iter__ in the RIGHT way! > > And, how about the "**something" operator? > > > > James > > A dictionary would be pretty much the same except

Re: BayPIGgies: November 10, 7:30pm (Google)

2005-11-07 Thread Alex Martelli
except Hasan's talk (but, you'll miss a chance to sample Google's famous food...;-). Emailing Neal would still be nice, just so we know you're expected to show up... but, not absolutely _required_! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-07 Thread Alex Martelli
loadable from sourceforge). > Thanks for the updates to gmpy! You're welcome, and thank YOU for the feedback &c. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: which feature of python do you like most?

2005-11-08 Thread Alex Stapleton
On 8 Nov 2005, at 12:21, [EMAIL PROTECTED] wrote: > which feature of python do you like most? > I think this question might be a bit like asking whether you love your mum or your dad most to a lot of people ;) People like Python as a whole usually. It's not like C++ or PHP or anything where

Re: Storing empties

2005-11-08 Thread Alex Martelli
some small amount of memory -- any object that's unique and you never need to pass can play the same role as a sentinel, obviously. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Newb ??

2005-11-09 Thread Alex Martelli
h rice existed in the world to satisfy the request...;-). Well, repeated halving is just like repeated doubling "backwards", so it squeezes vast ranges of possibilities down to tiny ones just as fast as repeated doubling produces oceans of rice from a small chessboard;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-09 Thread Alex Martelli
e clients thin. The only issue is, your apps will require network connectivity to execute... but these days, with airlines and train lines busy adding wi-fi, and towns busily blanketing themselves with free wi-fi, etc, etc, that's less and less likely to be a big problem... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-09 Thread Alex Martelli
eedup wrt Python, and some speedup wrt gmpy 1.0 (all GMP's merit -- I didn't address performance aspects at all in this delta). Just out of curiosity: what performance do you get on the Athlon with a pentium3-compiled GMP? > I did very that the tp_compare errors are fixed.

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread Alex Martelli
the itertools module is and remains a PRECIOUS resource. If you want an iterator rather than a list, itertools.ifilter is quite appropriate here. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread Alex Martelli
iltin namespace shouldn't get too crowded. But what I think matters little -- what __GvR__ thinks is more important...!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > This becomes a valid list comprehension by writing 'if' instead of > > 'when'. > valid, yes. efficient, I am not sure. > > [ x for x in xrange(1000) if p(x) ] > &

Re: Iterator addition

2005-11-09 Thread Alex Martelli
ators, lists, files, dicts, etc, etc -- I'm not so sure. Right now, if I mistakenly try to add a list to a dict, I get an exception which immediately alerts me to my mistake. I definitely wouldn't want to lose that... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Alex Martelli
frequent use cases for such an addition, I doubt it's worth even trying to make a patch in order to time it against itertools.takewhile... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Alex Martelli
intermediate object. For example, instead of: for x in takefile(foo, takewhile(bar, zlupp)): ... you may choose to code, e.g., zlupps_bars = takewhile(bar, zlupp) zb_foos = takewhile(foo, zlupps_bars) for x in zb_foos: ... Flat is better than nested. Sparse is better than dense. Readability counts. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-10 Thread Alex Martelli
th versions > (not suprising really since both are using the same libgmp.so on the > system). Yep, as I said any speed differences should be due to the underlying GMP, since gmpy.c itself has not undergone any speed-related change. > Thanks and look forward to the release Thank YOU for th

Re: Python obfuscation

2005-11-10 Thread Alex Martelli
uot; (whatever that means), but in assembly code, C, C++... so your last paragraph is easily shown to be an irrelevant aside -- it's not an issue of what language the code is in. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-10 Thread Alex Martelli
t; (and equally unprintable in polite company). If I could choose to eradicate only one of these two from the world, I'd opt for the spelling -- the widespread and totally unfounded belief in the worth of obfuscation is also damaging, but less so, since it only steals some time and energy from

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Alex Martelli
;' would? I don't see how "it breaks out of the whole thing expression" -- it terminates ONE for-clause (and what else would your cherished ``when'' do?). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I've created Windows binaries for Python 2.3 and 2.4. It should be > compatible with PentiumPro or later processors. Thanks! I hope to package up a release early next week, and to include these. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Newb ??

2005-11-11 Thread Alex Martelli
or with -Qnew on Python's commandline or 'from __future__ import division' at the top of your module -- to help you get used to it). Alex -- http://mail.python.org/mailman/listinfo/python-list

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