Debian says "Warning! you are running an untested version of Python." on 2.3

2005-01-13 Thread Alex Stapleton
Whenever I run python I get "Warning! you are running an untested version of Python." prepended to the start of any output on stdout. This is with Debian and python 2.3 (running the debian 2.1 and 2.2 binaries doesn't have this effect) Does anyone have any idea how to stop this or have even see

Re: reference or pointer to some object?

2005-01-13 Thread Alex Martelli
same thing) are VERY close in Java and Python. I hope this is enough to show that static or dynamic is quite a different issue -- Java's more or less statically typed, Python dynamically, but their model of variables is VERY similar anyway. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: hash patent by AltNet; Python is prior art?

2005-01-15 Thread Alex Martelli
#x27;m neither patriotic nor competitive, so I'd rather look forward to a world entirely free of this blight -- but hey, where I can make a difference is HERE, so, HERE is where I act. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling extension class

2005-01-18 Thread Alex Martelli
except (ImportError, KeyError, AttributeError), _xx: print ' OOPS, error (%s): %s' % (_xx.__class__, _xx) raise PicklingError( and let us know exactly what his modified pickle.py outputs...? Thanks, Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling extension class

2005-01-18 Thread Alex Martelli
(e.g.) import the.real.hyper sys.modules['hyper']=the.real.hyper before you pickle; but I suspect UNpickling would fail in that case. Using the standard library copy_reg module to register your way to pickle and recover instances of your type might work better. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: what would you like to see in a 2nd edition Nutshell?

2005-01-18 Thread Alex Martelli
ing to current plans: I'll be able to give more precise information later this year). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: what would you like to see in a 2nd edition Nutshell?

2005-01-18 Thread Alex Martelli
y ignore it. If standard Python changed in this respect, I would of course take that into account in the next following edition!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Contributor's List

2005-01-18 Thread Alex Martelli
uot;years of work down the drain": gmpy scratches the itch I made it for, and occasional references to others using it are just a little extra bonus, even if they do make my heart give a little jump of joy each time I see one. I think that's the spirit in which to do open-source development... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Zen of Python

2005-01-21 Thread Alex Martelli
Timothy Fitz <[EMAIL PROTECTED]> wrote: ... > Perhaps Tim Peters is far too > concise for my feeble mind It's Zen, it's beyond Mind. Let it speak to your True Self! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Configuring Python for Tk on Mac

2005-01-21 Thread Alex Martelli
: Tk support is there alright, it's Tcl/Tk which _isn't_. Get MacPython, its PackageManager will explain where to get Tcl/Tk Aqua from, as a prereq for Tkinter and IDLE! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Unbinding multiple variables

2005-01-21 Thread Alex Martelli
u one bit in tracking down your leaks. I would rather suggest you look into module gc... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: default value in a list

2005-01-22 Thread Alex Martelli
ly. I guess that might be considered "elegant", for suitably contorted meanings of "elegant"... it's on the site, too, but I don't have the URL at hand. It's instructive, anyway, but I wouldn't suggest actually using it in any kind of production code... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Zen of Python

2005-01-22 Thread Alex Martelli
d the fact that the variable is also maintained upon normal termination). (musing...): I think the reason there's no real use case for using a listcomp's control variable afterwards is connected to this distinction: listcomps have no `break'... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: list unpack trick?

2005-01-22 Thread Alex Martelli
ncise but nice in its own way (itertools.repeat gives an empty iterator when its 2nd argument is <=0, of course). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Reload Tricks

2005-01-22 Thread Alex Martelli
n Activestate's online cookbook -- I made some enhancements to it as I edited it for the forthcoming 2nd edition of the cookbook (due out in a couple of months), but the key ideas are in the online version too (sorry, no URL at hand). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
ementation, BTW, is "in between" -- some buffering, but bounded consumption of memory -- but whether that tidbit of pragmatics is part of the file specs, heh, that's anything but clear (just as for other important tidbits of Python pragmatics, such as the facts that list.sort is wickedly fast, 'x in alist' isn't, 'x in adict' IS...). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
rds compatibility reasons). Neither does it return a list: it returns "an `xrange' object", a specialized type that's not an iterator, though it's iterable. It's a type, btw: >>> xrange >>> so it's not surprising that calling it returns instances of it (enumerate and reversed are also types, but *WITH* 'next'...). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: finding name of instances created

2005-01-22 Thread Alex Martelli
André Roberge <[EMAIL PROTECTED]> wrote: > alex = CreateRobot() > anna = CreateRobot() > > alex.move() > anna.move() H -- while I've long since been identified as a 'bot, I can assure you that my wife Anna isn't! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
it -- THIS way, assertRaises performs the call under its own control (inside the try clause of a try/except statement) and can and does catch and report things appropriately. The frequency of this misunderstanding is high enough to prove to me that strictness is not FULLY understood by some "intermediate level" Pythonistas. However, I doubt the right solution is to complicate Python with the ability to have some arguments be strict, and other lazy, much as sometimes one might yearn for it. _Maybe_ one could have some form that makes ALL arguments lazy, presenting them as an iterator to the function itself. But even then the form _should_, I suspect, be obvious at the call site, rather than visible only in the "def"... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: list unpack trick?

2005-01-22 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > >> or (readable): > >> > >> if len(list) < n: > >> list.extend((n - len(list)) * [item]) > > > > I find it just as readable without the redundant if

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
e should probably fail > noisily, or at least emit a warning. Under what conditions, exactly, would you want such an exception? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Class introspection and dynamically determining function arguments

2005-01-22 Thread Alex Martelli
hon.fyxm.net/pycon/papers/traits.html>. Facilitating such presentation tasks (no doubt including editing) appears to be a major driving force for Traits. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: default value in a list

2005-01-22 Thread Alex Martelli
ssfully by now I've forgotten a lot of the perl I used to know... care to clarify? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: circular iteration

2005-01-22 Thread Alex Martelli
in range(30): > > print c[i%len(c)] > > I don''t know if it's faster, but: > > >>> import itertools > >>> c=['r','g','b','c','m','y','k'] > >>> for i in iterto

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > If it changed the semantics of for-loops in general, that would be quite > > inconvenient to me -- once in a while I do rely on Python's semantics > > (maintaining the loo

Re: Zen of Python

2005-01-22 Thread Alex Martelli
taining backwards compat with this kind of horrors means listcomps need to keep leaking until Python 3.0, alas. But hopefully no farther... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: What YAML engine do you use?

2005-01-22 Thread Alex Martelli
in the check. Accepting just square brackets, braces, commas, constant strings and numbers, and comments, should be pretty safe -- we'd no doubt want to also accept minus (for unary minus), plus (to make complex numbers), and specifically None, True, False -- but that, it appears to me, still

Re: debugging process

2005-01-22 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > I think that this must have something to do with python expecting > itself to by in a TTY? Can anyone give any idea of where I should be > going with this? http://pexpect.sourceforge.net/ Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Reload Tricks

2005-01-23 Thread Alex Martelli
ll those who need to keep using older versions of Python, though; to fit more recipes in, the historical discussions of how you did things with Python 1.5.2, 1.6, 2.0 etc have been ruthlessly snipped... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Alex Martelli
lf_ is going away right after being created... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Alex Martelli
ne): show_help(m.group(1)) Demeter's Law suggests that the 'm.value.group' accesses in your approach are better handled by having m delegate to its `value'; and the repeated m.set(re.search( ... seem to be a slight code smell, violating "once and only once", which suggests merging into a single `set' method. Your approach is more general, of course. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: compile python to binary

2005-01-24 Thread Alex Martelli
he like were what he was > referring to, if you had read his first sentence: > > "I have seen some software written in python and delivered as binary form." Sorry, Doug, not clear to me. I have seen, for example, some games delivered with binary files with names such as something

Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Alex Martelli
ay.) ;) Surely joining all the regexp's into one big one with | would be faster and more compact, but, with variable numbers of groups per sub-regexp, determining which regexp matched can perhaps be tricky (issues with matching mo.lastindex to the correct sub-regexp). So, I can understand the desire to do it sequentially, regexp by regexp. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-26 Thread Alex Martelli
us Data Structures Equals Programs" *IS* all about? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: fast list lookup

2005-01-26 Thread Alex Martelli
less what you need is not just to determine whether l contains a certain element but rather something different (such as doing the same determination for several elements on an unchanging l). Alex -- http://mail.python.org/mailman/listinfo/python-list

cookielib and urllib2: thread-safe?

2005-01-26 Thread Alex Hunsley
threads in my python script. So the important question is: are cookielib and urllib2 thread safe? Are there any precautions that apply to using these libs in a multi-threaded context? thanks! alex -- http://mail.python.org/mailman/listinfo/python-list

Re: HAVE YOU HEARD THE GOOD NEWS!

2005-01-27 Thread Alex Hunsley
[EMAIL PROTECTED] wrote: Good News! Do you know how simple it is to go to Heaven after this life has ended? Some people believe that belonging to a local church, temple, mosque or synagogue will get them to Heaven. Others believe that water baptism, obeying the ten commandments or just being a good

Re: python without OO

2005-01-27 Thread Alex Martelli
rt at <http://www.python.org/peps/pep-3000.html> -- while each of us will find there some "complexity" one loves and uses often (be it lambda, buffer, reload, ...), it's a good start. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-27 Thread Alex Martelli
of the article you quote (although it acknowledges that other think differently) is that better tools (including iterative, NOT waterfall, development; and, agile programming approaches, more generally) are the way to mitigate that horrid track record. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: exclude binary files from os.walk

2005-01-27 Thread Alex Martelli
binary". In any case, since you need to open and read all the files to check them for "being binary", either by your definition or whatever heuristics you might prefer, you would really not ``excluded them from os.walk'', but rather filter os.walk's results by these criteria. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: exclude binary files from os.walk

2005-01-27 Thread Alex Martelli
ey're 0xFF and 0xFE -- so they definitely don't qualify as ASCII. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Please suggest on the book to follow

2005-01-27 Thread Alex Martelli
g_ part, most people might be better served by "Learning Python" -- or, for that matter, the already recommended "Practical Python" (it has many significant completely worked-out example programs -- I was a TR for it, too) or "Dive into Python" (VERY fast and meant for already-experienced programmers -- I wasn't a TR for it, but, my _wife_ was...;-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: String Fomat Conversion

2005-01-27 Thread Alex Martelli
;" I hope this concisely indicates that the problem (in today's current implementations) is only with switching FROM iteration TO other approaches to reading, and (if the file is seekable) there's nothing so problematic here that a good old 'seek' won't cure... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about 'None'

2005-01-28 Thread Alex Martelli
e. (Untested code, as I don't have any 2.0 on which to test it anyway). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: limited python virtual machine

2005-01-28 Thread Alex Martelli
, , , , , , , , , , , , , , ] Traipse through these, find one class that has an unbound method, get that unbound method's func_globals, bingo. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: limited python virtual machine

2005-01-29 Thread Alex Martelli
Nick Coghlan <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Steven Bethard <[EMAIL PROTECTED]> wrote: > >... > > > >>If I could see how to go from 'object' (or 'int', 'str', 'file', etc.) > >&

Re: Pystone benchmark: Win vs. Linux (again)

2005-01-29 Thread Alex Martelli
ut hearsay to go on, but IBM's compiler for PPC chips, and Intel's compiler for Intel chips, appear to claim that they have excellent code generation, for example. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-29 Thread Alex Martelli
equivalent to: > > self.m = type(self.__init__)(method, self, Test) Another approach with the same result is to exploit the fact that a function is a descriptor: self.m = method.__get__(self, Test) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: limited python virtual machine

2005-01-29 Thread Alex Martelli
Aahz <[EMAIL PROTECTED]> wrote: ... > >>>> object.__subclasses__() ... > One thing my company has done is written a ``safe_eval()`` that uses a > regex to disable double-underscore access. will the regex catch getattr(object, 'subclasses'.

Re: limited python virtual machine

2005-01-29 Thread Alex Martelli
Stephen Thorne <[EMAIL PROTECTED]> wrote: > On Sat, 29 Jan 2005 08:53:45 -0600, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > > > >> One thing my company has done is written a ``safe_eval()`` that uses > > >> a regex to disable double-undersc

Re: limited python virtual machine

2005-01-29 Thread Alex Martelli
Skip Montanaro <[EMAIL PROTECTED]> wrote: > Alex> I dunno, maybe I'm just being pessimistic, I guess... > > No, I think you are being realistic. I thought one of the basic tenets of > computer security was "that which is not expressly allowed is forbidden&q

Re: limited python virtual machine

2005-01-30 Thread Alex Martelli
ere would still be use cases for an in-process sandbox, although it's surely true that making one would not be trivial. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Need programming tip

2005-01-30 Thread Alex Martelli
issing parts. What you need to do in each case, I don't know... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style article with interesting section on white space

2005-01-30 Thread Alex Martelli
be considered unless your project's budget for programming tools is Rubenesque? Do you think the costliest professional compilers cannot EVER find, on any given benchmark, some optimization worth a 25% speedup wrt the cheapest or free compilers...?! I really can't believe you'd claim any of this. Maybe you will want to clarify what, if anything, you mean here. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style article with interesting section on white space

2005-01-30 Thread Alex Martelli
mance on different platforms. Trying to imply that this has ANYTHING to do with the LANGUAGE the programs are coded in, as opposed to the compilers and expenses one is willing to incur for them, is either an extremely serious error of logic, if incurred in good faith, or else is an attempt to &qu

Re: Dynamic class methods misunderstanding

2005-01-31 Thread Alex Martelli
thor of class Test means to pass in as "method", it's not clear whether Test(divmod) or Test(staticmethod(foo)) is more likely to be of interest to them as a use case. If ``method'' is a function, which is both a descriptor AND callable, either approach works; otherwise, one has to pick an approach, or try both approaches with a try/except. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested scopes and class variables

2005-01-31 Thread Alex Martelli
UNCTION0 6 STORE_FAST 1 (g) 5 9 LOAD_FAST1 (g) 12 RETURN_VALUE >>> and: >>> dis.dis(f.func_code.co_consts[1]) 3 0 LOAD_FAST0 (x) 3 STORE_FAST

Re: variable declaration

2005-01-31 Thread Alex Martelli
aster, because it fits my brain, rather than changing the way I think. If Python doesn't fit YOUR brain, for example because your brain is ossified around a craving for the declaration of variables, then, unless you're specifically studying a new language just for personal growth purposes, I think you might well be better off with a language that DOES, at least until and unless your brain changes by other means. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: how do i create such a thing?

2005-01-31 Thread Alex Martelli
e corresponding value might be for. It's HIGHLY advisable to have your __getattr__ methods raise AttributeError for any requested name that starts and ends with double underscores, possibly with some specific and specifically designed exceptions. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: implicit conversion

2005-01-31 Thread Alex Martelli
your bigint class a constructor (not declared as ``explicit'', if you're coding C++) which accepts as its argument a python long might help...? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-01-31 Thread Alex Martelli
u might claim that, whatever percentage it may be, it's "frittered away on inconsequential newsgroups". Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-01-31 Thread Alex Martelli
just as ugly as one might imagine, but fortunately quite marginal, so one can almost forget it. I have nothing against a declarative style _per se_ -- it just doesn't fit Python's "everything happens at runtime" overall worldview, and that simple and powerful worldview is a good part of what makes Python tick SO well. I think there's a space for declarative languages, and it is mostly ``orthogonal'' to Python. See, for example, <http://www.strakt.com/docs/ep04_caps.pdf>, specifically the part of the presentation that's about BLAM -- that's a declarative language (with embedded Python for ``actions'', e.g., triggers, and computations), and I think a neat and useful design, too. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-02-01 Thread Alex Martelli
Michael Tobis <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Michael Tobis <[EMAIL PROTECTED]> wrote: > > > he can perfectly > > well correct his misexpression if he cares to -- not my job to try to > > read his mind and perform exegesis on his w

Re: how do i create such a thing?

2005-02-01 Thread Alex Martelli
elf._delegate supply them or be responsible to raise AttributeError if necessary. Alex -- http://mail.python.org/mailman/listinfo/python-list

equivelant of Java's toString() method? (not repr)

2005-02-01 Thread Alex Hunsley
(The log function expects a string) What is the magic incantation to get the string I want so I can pass it to my function? I've tried repr() but that isn't it (I suspected it wouldn't be). I suppose I'm looking for the equivelant of Java's toString() method... thanks

Re: equivelant of Java's toString() method? (not repr)

2005-02-01 Thread Alex Hunsley
Alex Hunsley wrote: Pretty simple seeming question, but can't find answer via google or docs... I am using urllib2 as follows: handle = urlopen(req, postdata) # and URL to return a handle on ... print handle.info() the print statement prints out the headers: Content-Type: text

Re: variable declaration

2005-02-01 Thread Alex Martelli
prepared to remove the current 'recursion limit' AND offer tail-call optimization possibilities, at the very least. All in all, I fail to see what gains would be expected by making Python into a single-assignment or single-binding language, even on a module by module basis, to repay this kind of awkwardness. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Next step after pychecker

2005-02-02 Thread Alex Martelli
Python's runtime in Python, type inferencing on a somewhat restricted ("not too dynamic/meta at runtime") subset of Python plays a key role there. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you do arrays

2005-02-02 Thread Alex Martelli
about a certain subject, or just look up something specific. Trying to make a book that's both a hand-holding tutorial _and_ a quick reference would produce a book that is not very good at either task, IMHO. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-04 Thread Alex Martelli
at fancy/clever: for val in (x for x in lst if x is not None): return val return None Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: changing local namespace of a function

2005-02-05 Thread Alex Martelli
To reiterate the latter, and dress it up nicely too, it's class wrapwell(object): def __init__(self, somedict): self.__dict__ = somedict and use d=wrapwell(whateverdict) to make the wrapper. Now, reading or writing d.x is just like reading or writing whateverdict['x&

Re: empty classes as c structs?

2005-02-05 Thread Alex Martelli
it__(self, data): self.__dict__ = data Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: "Collapsing" a list into a list of changes

2005-02-05 Thread Alex Martelli
yield item lastitem = item that's basically just the same as your code but without the strangeness of making an enumerate for the purpose of ignoring what the enumerate adds to an ordinary iterator. Alex -- http://mail.python.org/mailman/listinfo/python-list

a type without a __mro__?

2005-02-05 Thread Alex Martelli
python-dev, I've even IM'd a couple of Python-guru friends, but the friends are equally stumped and I'm getting no answers on python-dev nor from the submitter of the bug report. So, I thought I'd turn to the collective ingenuity of comp.lang.python... thanks in advance for an

Re: changing local namespace of a function

2005-02-05 Thread Alex Martelli
ct_to_wrap and there you are. Affecting *BARE* names is a completely different order of magnitude of complication away from affecting *COMPOUND* names. Barenames are, almost inevitably, handled with deep magic, essentially for the purposes of can't-do-without optimization; compound names are _way_ more malleable... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-05 Thread Alex Martelli
max(lst) This fails when lst is empty (the specs presumably imply a None should be returned then). More robust: return max(lst or [None]) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-02-05 Thread Alex Martelli
Alexander Zatvornitskiy <[EMAIL PROTECTED]> wrote: > Hi, Alex! > > 31 jan 2005 at 13:46, Alex Martelli wrote: > > (sorry for the delay,my mail client don't highlight me your answer) > > AM> Since the lack of declarations is such a crucial design choice

Re: a type without a __mro__?

2005-02-05 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > Can anybody suggest where to find (within the standard library) or how > > to easily make (e.g. in a C extension) a type without a __mro__, except ^

Re: variable declaration

2005-02-05 Thread Alex Martelli
only one, for sure -- there must have been a dozen before you, at least. Fortunately, even though almost each and every one of them has wasted more of everybody's time with such ideas, than even their scare-tactics claim of ``wastes of time'' due to lack of declaratio

Re: variable declaration

2005-02-05 Thread Alex Martelli
Nick Coghlan <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > 'global' is an ugly wart, to all intents and purposes working "as if" it > > was a declaration. If I had to vote about the one worst formal defect > > of Python, it would surely be

Re: variable declaration

2005-02-05 Thread Alex Martelli
Arthur <[EMAIL PROTECTED]> wrote: > On Sat, 5 Feb 2005 17:00:15 +0100, [EMAIL PROTECTED] (Alex Martelli) > wrote: > > > >I consider this one of the worst ideas to have been proposed on this > >newsgroup over the years, which _IS_ saying something. \ > > I wo

Re: Alternative to standard C "for"

2005-02-05 Thread Alex Martelli
aceback (most recent call last): File "", line 1, in ? AttributeError: 'xrange' object has no attribute 'next' >>> No next method -> not an iterator. iter(xrange(...)) DOES return an iterator, btw. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-02-05 Thread Alex Martelli
o NOT let a type override what this one augmented assignment means; that looks like an "attractive nuisance" tempting people to be too clever. Still, if you write a PEP, I would mention the possible alternative and why it's being rejected in favor of this simpler one. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-02-05 Thread Alex Martelli
ntrance into stupid firms broadens its potential appeal from less than 10% to around 100% of the market, which is good news for sellers of books, tools, training, consultancy services, and for Python programmers everywhere -- more demand always helps. *BUT* the price is eternal vigilance... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: a type without a __mro__?

2005-02-06 Thread Alex Martelli
attribute__(attr) > > class D(object): > __metaclass__ = C Yay -- *exactly*!!! This simple trick reproduces the problem AND shows that using inspect.getmro fixes it. EXACTLY what we needed. Thanks!!! Now I can make a proper patch with unittest as well as the fix. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple constructors

2005-02-06 Thread Alex Martelli
as C++ overloaded constructors, which you seem to like. If you want to do this all the time, you could even build appropriate infrastructure for this task -- a little custom descriptor and metaclass, and/or decorators. Such infrastructure building is in fact fun and instructive -- as long as you

Re: Word for a non-iterator iterable?

2005-02-06 Thread Alex Martelli
er multiple-times", I like "re-iterable"; it centers on what you can DO with the object, rather than quibbling what it ISN'T;-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Alex Martelli
ble in unmoderated groups. Shunning, or pelting the troll with abuse whenever he shows up, etc, etc, sure. But, banning? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: bytecode obfuscation

2005-02-06 Thread Alex Martelli
the secrecy IS critical for that part. If you're currently distributing that ``secrecy critical'' code as JVM bytecodes or intel machine code, and there IS indeed a profit to be made in cracking it, rest assured that it IS cracked, somewhere. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: bad generator performance

2005-02-06 Thread Alex Martelli
] while stack: rightmost = stack.pop() if is_leaf(rightmost): yield rightmost else: stack.extend(rightmost.all_children()) This isn't the traversing you're looking for, but it is _a_ traversing of a recursive data type, non-recursive, an

Re: tree functions daily exercise: Table

2005-06-21 Thread alex goldman
Xah Lee wrote: > > well yes... but this was emulation of Mathematica functions. > (Disclaimer: Mathematica is a trademark of Wolfram Research Inc, who is > not affliated with this project) You could have fooled me. -- http://mail.python.org/mailman/listinfo/python-list

RE: threads and sleep?

2005-07-06 Thread Alex Stapleton
Is SYS V shared memory a totalyl stupid way of doing distributed locks between processes then? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jonathan Ellis Sent: 06 July 2005 05:45 To: [email protected] Subject: Re: threads and sleep? Peter Hansen wr

why UnboundLocalError?

2005-07-08 Thread Alex Gittens
or len(align)!=len(fields): raise 'Argument mismatch' str = '' while measure()!=0: str += cutbits() What's causing the error? Thanks, Alex -- ChapterZero: http://tangentspace.net/cz/ -- http://mail.python.org/mailman/listinfo/python-list

already written optparse callback for range and list arguments?

2005-07-09 Thread Alex Gittens
I would like my program to accept a list of range values on the command line, like -a 1 -a 1-10 -a 4,5,2 In the interest of avoiding reinventing the wheel, is there already available code for a callback that would enable optparse to parse these as arguments? Thanks, Alex -- ChapterZero: http

Slicing every element of a list

2005-07-12 Thread Alex Dempsey
Recently I tried to slice every element of a list of strings. First I tried: f = open("export.xls", "r") lines = f.readlines() for line in lines: line = line[1:-5] line = line.split('\"\t\"') This went without returning any errors, but nothing was sliced or split. Next I tried: for i in

use mod_python' session and redirect

2005-09-04 Thread wafd Alex
hi all when i use Session object to save a object and then i use util.redirect(req,url) to redirect a .psp.But in my psp i cann't load session so i cann't get object from session,help me,thanks here is my code .py s=Session.Session(req) s["cur_user"]=user s.set_timeout(1

Re: variable declaration

2005-02-06 Thread Alex Martelli
...so we'd better be careful (==eternal vigilance)... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python versus Perl ?

2005-02-06 Thread Alex Martelli
; salaries are at the top has been true since the first such poll -- not a huge difference, but statistically significant. What this finding _means_ is, of course, somewhat of a mystery (correlation isn't causation), as is, of course, the OP's less formal observation about job postings. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused with methods

2005-02-06 Thread Alex Martelli
pletely separate it from the idea of having set b.foo as an attribute of class A. Just try calling b.foo() without arguments and you'll get exactly the same error message -- from the underlying function foo, which is also b.foo.im_func (the function's FIRST argument is bound to b.foo.im_self, which is b; whence the error being about function foo taking exactly two arguments and only one having been given). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: empty classes as c structs?

2005-02-06 Thread Alex Martelli
ness in getDict and setDict -- structuring THEM as Template Methods, too -- to fully support such a subclass; but that's a well-known general issue with property, and the cost of the extra indirection -- mostly in terms of complication -- should probably not be borne here, it seems to me]] Alex -- http://mail.python.org/mailman/listinfo/python-list

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