Re: Python or Java or maybe PHP?

2006-01-02 Thread Alex Martelli
one and a > generator. > > (Or is this behavior different in Python 2.5? I hope not...) No misunderstanding on your part, just my error on untested code -- no changes in Python 2.5 so that yield of a generator means yielding each of its items, my bad, sorry. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-03 Thread Alex Martelli
trade-off, and yet most design IS about making trade-offs... > > There's no need to define this 'meta' attribute anywhere, it just > > springs into existence when you assign to it. > > ? > > "assign to it" with: > > setattr(Talker, 'meta', "Class meta information") > > but _not_ with this: > > Talker.meta = "Class meta information" > > correct? Nope: both forms have IDENTICAL semantics. They both work in just the SAME way. Try it out...! >>> class Talker(object): pass ... >>> Talker.meta = 'class metainfo' >>> print Talker.meta class metainfo >>> Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-03 Thread Alex Martelli
Duncan Booth <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > It IS true that in Python you cannot set arbitrary attributes on > > arbitrary objects. The workaround is to use a dict, indexed by the id > > of the object you want to "set arbitrary attri

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-03 Thread Alex Martelli
learned that I need to write *UNIT-TESTS* for all of my code -- me and another million programmers. Of course, unit tests, which are indispensable anyway to catch the += vs -= typoes, as a side effect also catch any typos such as zippo vs zappo. Very good expansions on these fundamental ideas can be seen at <http://www.mindview.net/WebLog/log-0025> and <http://www.artima.com/weblogs/viewpost.jsp?thread=4639>, by excellent authors Bruce Eckel and Robert Martin respectively (great experts of such languages as Java and C++, but aficionados of Python, Ruby, Smalltalk thanks to these considerations). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-04 Thread Alex Martelli
7;' as empty, using the no-op statement ``pass''). Still, some people believe there is mystical and magical power in having special syntax for something rather than using perfectly normal, general, and existing syntax for the purpose; such syntax-obsessed people will no doubt be more i

Re: OT: Degrees as barriers to entry [was Re: - E04 - Leadership! Google, Guido van Rossum, PSF]

2006-01-04 Thread Alex Martelli
Brian van den Broek <[EMAIL PROTECTED]> wrote: > (I do realize that US data isn't most pertinent to Steven, Alex or > myself -- au, it, ca -- but it is ready to hand. Shamefully, my Actually, I've been living in the US for over 9 months now, and like all immigrants I h

Re: Python or Java or maybe PHP?

2006-01-06 Thread Alex Martelli
ver Python functions though, these may have to be > extended to "full" closures if they aren't) and be considered by some as Python's closures are 'full', but don't allow inner functions to rebind names in the namespace of outer functions. I'm not su

Re: Spelling mistakes!

2006-01-06 Thread Alex Martelli
KraftDiner <[EMAIL PROTECTED]> wrote: ... > Frankly how are you ever to know if this type of error is occuring? <http://en.wikipedia.org/wiki/Unit_testing> . Alex -- http://mail.python.org/mailman/listinfo/python-list

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

2006-01-07 Thread Alex Martelli
t's unfortunate to propagate disinformation about its assignment semantics differing from Python's -- it will confuse people who know Java, and there are many of those. Alex -- http://mail.python.org/mailman/listinfo/python-list

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

2006-01-07 Thread Alex Martelli
ys, and don't currently have gmpy at hand). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-07 Thread Alex Martelli
you would by staying in the Netherlands. You'll have to invent some better excuse, to explain why you chose not to attend it. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Try Python update

2006-01-07 Thread Alex Martelli
want to add a bug report if you already know about it -- 'Try Python' is a neat hack, and useful, it well deserves some care from would-be bug reporters... but I can't see any links to "known problems" (or other bug-reporting facilities) from the base page. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: What's wrong with this code snippet?

2006-01-07 Thread Alex Martelli
ng it a staticmethod like so: > > @staticmethod() > def GenerateRandomColour(): > rn.seed() > colour = rn.choice(['C', 'P', 'Z']) > return colour No parentheses on the decorator line, just '@staticmethod'. Otherwise, fine. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy an Object (Again?)

2006-01-07 Thread Alex Martelli
oubt this is the root of your problem, but, at any rate, loop on a COPY of the list you're modifying -- e.g. change the first statement to objs = list(myListOfObjects) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Try Python update

2006-01-07 Thread Alex Martelli
o > put the cursor after all the text in a textarea, I'll fix this > now. I'm no Safari expert (and no great shakes at Javascript!), but, I'll ask around and report back here, thanks. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Worthwhile to reverse a dictionary

2006-01-07 Thread Alex Martelli
er only one case in a real-world program of needing anything like that -- the original dict had "sub"-dicts (mapping strings to numbers) as values, but fortunately it was acceptable for the application to have frozen sets of (key, value) pairs "stand for" those subsets in the "reversoid" dict (I sure did wish at the time I had "frozen dicts", though;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-08 Thread Alex Martelli
an obviously account for "hundreds of euros" already); Europython is specifically held in Europe to be cheaper and more convenient to attend for Europeans, and I've always met many people there who fell in the "income low to nonexistent" bracket for one reason or another. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Try Python update

2006-01-08 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > Mike Meyer <[EMAIL PROTECTED]> wrote: > > For some reason, I couldn't see the links at the end of the page; now I > > can, though they look sort of "ragged", but

Re: Sockets on Windows and Mac

2006-01-08 Thread Alex Martelli
ettings rather than any programming issue. Do remember to copy and paste, NOT summarize in your own words, otherwise you may make it unfeasible for us to help you out! Alex -- http://mail.python.org/mailman/listinfo/python-list

Newline at EOF Removal

2006-01-08 Thread Alex Nordhus
I am looking for a way to strip the blank line and the empty newline at the end of the text file. I can get the blank lines removed from the file but it always leaves the end line (which is blank) as a newline. My code is here and it works but leaves the newline at the end of the file. How do I g

Re: Try Python update

2006-01-08 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > I'm finding it hard to arrange my own experiments with Safari (I'm using > > a loaner machine since my normal one[s] are all having problems and > > under repair) but I'

Re: Real-world use cases for map's None fill-in feature?

2006-01-08 Thread Alex Martelli
easily been able to specify a different filler, I _would_ have been able to use it a couple of times. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Newline at EOF Removal

2006-01-09 Thread Alex N
Thank you guys for all your help. Was able to nail it down. uh I dunno where i saw the 'wt' at. somewhere online though. I have to do it in 2 stages though and run through a coula files but it works. import re f = open("oldfile.txt") w = open("newfile.txt", "w") for line in f: if line.strip():

Re: Newline at EOF Removal

2006-01-09 Thread Alex N
;\n')) and it works great! Now I can go on to the next step. Thank you guys for your help Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-09 Thread Alex Martelli
d, for example, in Amsterdam, so for a NL resident travel costs (and there never were any other) should have been truly minute. > google), but IMO it remains true that one needs at least one link to > corruption to be able to post to usenet. If you define every academic center and e

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-09 Thread Alex Martelli
try and you > would be wiser if you dropped this attitude. And hired hundreds of thousands of people a year (that's about the number of resumes we get now, WITH the current job offers) without selection? Sure, that would definitely ensure wisdom. Yeah, right. You're so pathetic you aren't even funny. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-09 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: ... > On the available evidence that seems completely untrue. Alex, as I know > from personal experience, has no problems accepting the material rewards > of a lifetime spent developing expertise, but that doesn't make him > elit

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-10 Thread Alex Martelli
Anton Vredegoor <[EMAIL PROTECTED]> wrote: ... > > On the bureaucratic side: Alex, we *have* a procedure at this point, and > > we have been trying to contact you several time in the past months -- with > > no success as far as I know, so I'll try via comp.lang.pyt

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-10 Thread Alex Martelli
ement to a team can prevent it from being a > 'linear combination of social peer pressure vectors'. Face your fears. Anything but linear. But that's not a FEAR of mine -- I would call it a HOPE, were it not for the fact that I see it concretely happening every day at work: teams that produce more value than the sum of their parts would, with mutual respect and amity growing among people from the wildest and most diverse mix of backgrounds and personalities. Alex -- http://mail.python.org/mailman/listinfo/python-list

Bug in struct.pack?

2006-01-11 Thread Alex Stapleton
from struct import pack >>> pack("B", 1) '\x01' >>> pack("BB", 0, 1) '\x00\x01' >>> pack("BI", 0, 1) '\x00\x00\x00\x00\x01\x00\x00\x00' >>> calcsize("BI") 8 >>> calcsize("BB") 2 Why does an unsigned char suddenly become 4 bytes long when you include an unsigned int in the format string? It'

Re: Bug in struct.pack?

2006-01-11 Thread Alex Stapleton
< Idiot. On 11 Jan 2006, at 10:46, Alex Stapleton wrote: > from struct import pack >>>> pack("B", 1) > '\x01' >>>> pack("BB", 0, 1) > '\x00\x01' >>>> pack("BI", 0, 1) > '\x00\x00\x00\x

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-12 Thread Alex Martelli
ith experience in sensor interfaces, for example). But if you only want wide open, uncrowded spaces, Google may not have a suitable opening for you... yet;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: flatten a level one list

2006-01-12 Thread Alex Martelli
q) instead] > >>> > > I've no idea why this limitation is here... perhaps it is because pre > python2.4 calling += on strings was very slow? No: when I implemented sum, I originally specialcased sum on strings to map down to a ''.join -- Guido decided it was confusing and had no advantage wrt calling ''.join directly so he made me put in that check. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: flatten a level one list

2006-01-13 Thread Alex Martelli
rk on _numbers_ -- the reason it takes that second optional parameter is essentially to be able to specify the ``type'' of numbers. In retrospect it might have been better to have a single argument (or interpret multiple ones like min or max do, maybe), forcing the starting value to be integer

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

2006-01-14 Thread Alex Martelli
prises* I ever got from Python...!-) ((I don't think this violates the "introduce no complexity that doesn't help understanding" rule -- I think the 1==1.0 case is important!)) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Can one class have multiple metaclasses?

2006-01-15 Thread Alex Martelli
The last recipe in the 2nd ed of Python Cookbook shows how to design an automatic "metaclass conflict reconciler" to do the inheritance on your behalf, btw. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing class methods from being defined

2006-01-15 Thread Alex Martelli
y module inspect for that) and construct an artificial dict, then drop the 'bases' and use an empty tuple of bases for the supercall (real inheritance doesn't let you "hide" methods, or other superclass attributes, ever). Etc, etc -- it's most surely possible to do what you want, whatever what you DO want is exactly!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-15 Thread Alex Martelli
py) could inherit from it in order to assert "yes, I *AM* a number!" and allow isinstance-based checks rather than ones based on "try to sum 0 and see if that gives an exception". A very small, localized, and potentially useful change, IMHO. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: how do "real" python programmers work?

2006-01-15 Thread Alex Martelli
ogramming -- if they're emacsers, bully for them, but I'm a vi'er myself (I keep telling myself I should learn emacs, but then, I also tell myself I should stop smoking, and I don't actually DO anything about that, either;-), and TDD can be used with any editor or IDE, anyway. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] pysqlite 2.1.0 released

2006-01-15 Thread Alex Martelli
n "non-ASCII text" here? At any rate, my compliments for a new release (which looks great!) of a most excellent module! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-16 Thread Alex Martelli
f 'baseinteger' goes away. The case for 'basenumber' is much stronger, and I'm making it on python-dev (where I already made it in the past, in the last few years); look for [basenumber site:python.org] and you'll find the few but informative posts that went around, mostly about 3 years ago. My main worry is that in the quest for a "perfect hierarchy" that keeps proving too tricky, something with real-life usefulness such as basenumber may fall by the wayside... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-16 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: ... > while the traditional > > xrange(f(n)-1, -1, -1) > > only evaluates it once but is IMO repulsive. Yep, reversed(range(f(n))) is MUCH better. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-16 Thread Alex Martelli
,-1,-1). But not easier than reversed(range(6)) [[the 5 in one of the two expressions in your sentence has to be an offbyone;-)]] Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to generate a list of the subclasses of C

2006-01-16 Thread Alex Martelli
Charles Krug <[EMAIL PROTECTED]> wrote: ... > I'm trying to create a list of all of C's subclasses: There's a class method for that very purpose: >>> class C(object): pass ... >>> class D(C): pass ... >>> class E(C): pass ..

Re: Arithmetic sequences in Python

2006-01-16 Thread Alex Martelli
g from the start to one past > the end specifically to help prevent signpost errors, and now some folks > want to undermine that. > > *shakes head in amazement* Agreed. *IF* we truly needed an occasional "up to X *INCLUDED*" sequence, it should be in a syntax that can&#

Re: Arithmetic sequences in Python

2006-01-16 Thread Alex Martelli
Roy Smith <[EMAIL PROTECTED]> wrote: > Alex Martelli <[EMAIL PROTECTED]> wrote: > >Agreed. *IF* we truly needed an occasional "up to X *INCLUDED*" > >sequence, it should be in a syntax that can't FAIL to be noticed, such > >as range(X, endinclu

Re: embedding python: simulating sequence get item / set item methods

2006-01-16 Thread Alex Martelli
print str(my_list[i]) > > Is this possible? Sure, see the details at <http://docs.python.org/api/newTypes.html> and consider that what you want will need to go into a PyMappingMethods or PySequenceMethods structure -- not well documented online, but just take a look in the Python

Re: OT: excellent book on information theory

2006-01-17 Thread Alex Martelli
- considering that I brought with me a hundred or more DVDs from the old country, and I get as many more here in shops or via netflix, I really couldn't do without. I legally ordered it on the web and it was legally delivered. What's illegal about it?! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-17 Thread Alex Martelli
(tentatively, I hope) Pronounced that the [...] form will stay in Py3K as syntax sugar for list(...). I find that to be a truly hateful prospect, but that's the prospect:-(. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: excellent book on information theory

2006-01-18 Thread Alex Martelli
Rocco Moretti <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Terry Hancock <[EMAIL PROTECTED]> wrote: > >... > >>due to the Evil Conspiracy of region-coding, I couldn't > >>watch the British DVD even if I were to import it (Well, >

Re: Arithmetic sequences in Python

2006-01-18 Thread Alex Martelli
quot;suggest lists" is that you're used to that display form in Python, but there's no real reason to HAVE a display form for lists at all, IMHO. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: excellent book on information theory

2006-01-18 Thread Alex Martelli
igh price to get a > region-free player in the USA, but I'm certainly not going > to. Me neither! I got mine for about $50 from a well-rated web merchant, as I recall -- is that what you mean by "a very high price"? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-18 Thread Alex Martelli
tillborn), others prize verbosity (or else Cobol would never have been coinceived); but Python's "Middle Way" tends to strike a good balance. IMHO, the balance would be better served by spelling list(1,2,3) rather than [1,2,3] (but the BDFL disagrees, so my opinion doesn't matter m

Re: OT: excellent book on information theory

2006-01-18 Thread Alex Martelli
n a chair rather than a sofa; depending on subtle nuances of the English dialect used (varying with time and space), this may have very different implications in defining the character and mood of this individual... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: web crawling.

2006-01-18 Thread Alex Martelli
t page, how could I request all of those images and > download them into some specified folder? I am sure this is quite easy, > but I am stuck. There's a good crawler in the Demo directory of the Python source distribution, so download and unpack said sources and look there. Alex -- h

python & camera

2006-01-20 Thread Alex Gittens
doing this? Thanks, Alex -- ChapterZero: http://tangentspace.net/cz/ -- http://mail.python.org/mailman/listinfo/python-list

Re: "Dynamic" website content

2006-01-21 Thread Alex Martelli
you want. A much more reliable way to achieve that is to use timed redirects, or an AJAX (Javascript-based) solution. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: new.instancemethod as a form of partial()

2006-01-21 Thread Alex Martelli
;gained" by wrapping a function into an unbound method is an implicit typecheck on the first argument, and if, as the class, you're using 'object' as in your example, that's not much use [even in other cases, it's no great shakes;-)]). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: new.instancemethod as a form of partial()

2006-01-22 Thread Alex Martelli
x27;s hope for the future. But a more complete 'partial' is likely to be acceptable sooner than any fix to bound/unbound methods: I suspect the only ingredient that's missing is a generous helping of irrefutable use cases. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
it would be horribly, painfully inconsistent if **2 was interpreted as "square each item". Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching very specific exceptions

2006-01-22 Thread Alex Martelli
raise Not sure the code in a socket.error has attributename 'errno', but I hope you get the general idea. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: ... > given length. You could get a 6/49 lotto tip with something like: > > choice(set(range(49)).powerset(6)) And that would be better than the current random.sample(range(49),6) in WHAT ways, exactly...? Alex -- http://

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
hon chooses to support this syntax variation by special methods in classes, and thus encourages people to create classes if they're keen on the syntax. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Alex Martelli schrieb: > > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >... > >> given length. You could get a 6/49 lotto tip with something like: > >> > >> choice(set(range(49))

Re: Sets and Membership Tests

2006-07-12 Thread Alex Martelli
_hash__). Of course, by going directly to object.__hash__ you're explicitly *avoiding* the override, so... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: testing array of logicals

2006-07-12 Thread Alex Martelli
lse) only, then test = sum(logflags) == len(logflags) is simpler and fast than, but equivalent to, my first suggestion. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-12 Thread Alex Martelli
wise, just as one example. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Alex Martelli
Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-13 01:50:18, Alex Martelli wrote: > > >> I'm not sure about which languages you are talking (pretty much all that > >> allow public methods also allow public attributes), [...] > > > >

Re: Number combinations

2006-07-19 Thread Alex Martelli
(0,10): > for b in range(0,10): > for c in range(0,10): > for d in range(0,10): > print "%s%s%s%s" %(str(a), str(b), str(c),str(d) for n in xrange(1): print "%4.4d" % n Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-20 Thread Alex Martelli
ike any other addition of, or change to, functionality, this would of course be a proposal for 2.6, since 2.5 is feature-frozen now. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python linker

2006-07-20 Thread Alex Martelli
ring it for separate download and installation; mfc80u.dll, similarly (albeit only at hundreds of sites;-); and so on, and so forth. The situation is quite similar for other languages, Python included, and other frameworks, wxWidgets (and wxPython on top it it) included. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python linker

2006-07-20 Thread Alex Martelli
e Python applications for .NET. See <http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython>: it's now in Beta9 and the final non-beta release should be out soon. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-20 Thread Alex Martelli
Paul Boddie <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > > > Well, range is a function in the current implementation, although its > > > usage is similar to that one would get if it were a cla

Re: function v. method

2006-07-20 Thread Alex Martelli
danielx <[EMAIL PROTECTED]> wrote: > > ...and source code... > > *shudders* What happened to all the goodness of abstraction? <http://www.joelonsoftware.com/articles/LeakyAbstractions.htm> Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Alex Martelli
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: ... > >>And of course import hooks. > > > > Python?? Where? > > RTFM: > http://www.python.org/doc/2.3.5/lib/built-in-funcs.html Perhaps a better reference is <http://www.python.org/dev/peps/pep-0302/>

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Alex Martelli
e, since somebody using Ruby instead of a P-language would be a... LAMR!!! If I were on the board of the Ruby equivalent of the PSF, I'd be lobbying hard for the language's name to be changed to PRuby -- with the P being mute, as in Wodehouse's character Psmith. _That_ would remove the acronymical barrier and ensure PRuby's triumph. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs. Linux

2006-08-02 Thread Alex Martelli
s accept the / as path separator? That > DOS was written on Xenix (Posix) systems (using the slash as path > separator)? That Microsoft was for a long time pretty much a pure Xenix > shop? Internally yes (indeed, they developed Xenix, before later selling it to SCO), but that does not

Re: Windows vs. Linux

2006-08-02 Thread Alex Martelli
jean-michel bain-cornu <[EMAIL PROTECTED]> wrote: > Andy Dingley a écrit : > > I'd never recommend dual-boot for anything! > Don't agree man, it's good for testing... It's bothersome for testing: virtualization is much handier in most cases. Alex -- h

Re: Windows vs. Linux

2006-08-02 Thread Alex Martelli
by the time PCs with hard disks were starting to become widespread, MS had lost interest in marketing Xenix, which only SCO was pushing, so it made sense in '87 for MS to sell SCO Xenix outright in exchange for a large slice of SCO's stock (20%, if I remember right). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs. Linux

2006-08-02 Thread Alex Martelli
's huge profits, at Microsoft's purchase of the makers of VirtualPC, at the rise of Parallels, at open-source developments such as QEMU and Xen... > I think the folks at microsoft are used to getting cursed at :) Particularly by their stockholders, with the stock down from a high of a

Re: function v. method

2006-08-02 Thread Alex Martelli
quot;this is a hook method which you should override in a subclass if you want to tweak some detail of functionality", it's all too easy to forget about the latter case (fortunately Queue.Queue is there to remind us of it:-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-08-02 Thread Alex Martelli
W support)... so (in this setting) you _could_ do it in SW, and save the $100+ per box that you'd have to spend at some shop such as <http://www.pcwatchdog.com/> or the like... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: regex question

2006-08-03 Thread Alex Ross
This might be more flexible: pat = re.compile(r"^(a*(?=b)b*(?=[ac])c*(?=[abd])d*)+$") tests = [('aabbbaabbcccbbbcccddd', True), ('aabcabcd', True), ('abcd', True), ('aabbccaabbccabcabababbb', True), ('aabbccaabbccabcabababbbabcd', True),

Re: Python open a named pipe == hanging?

2006-08-03 Thread Alex Martelli
cs in the nonblocking case(s) are somewhat weird (to my way of thinking, but then, my Unix background _is_ somewhat dated!-), but they wouldn't help you anyway, it seems to me -- looks like you'd like drastically different semantics (with neither open blocking, or just the reading one), but Unix just doesn't really offer them... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Your Programming Language Do This? Joel on functional programming and briefly on anonymous functions!

2006-08-03 Thread Alex Martelli
ou calling *Joel* an "all-java kid"?! He's an old clunker, just like me!, and HIS background is primarily in C and some kind of LISP -- he makes that quite clear in some of his books. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: E' possibile integrare ironpython con visual studio 2005?

2006-08-03 Thread Alex Martelli
LaGuna <[EMAIL PROTECTED]> wrote: > Se si come? > > Ciao by Enzo Questo newsgroup preferisce l'inglese -- per favore, chiedi su it.comp.lang.python invece che qui. This newsgroup prefers English -- please ask on it.comp.lang.python rather than here. Alex -- http://mai

Re: Python open a named pipe == hanging?

2006-08-04 Thread Alex Martelli
logic is in fact internal to the script, pushing the fraction of lines usefully running external processes to 20% or less, as you add logic, error-handling, and other glue functionality to the script. In such situations, languages such as Perl, Python or Ruby offer far better facilities (and the fac

Re: Python open a named pipe == hanging?

2006-08-04 Thread Alex Martelli
ference counts drops to 0 at this statement's end. (This would NOT necessarily happen in other Python implementations, such as Jython or IronPython, but I suspect THOSE implementations wouldn't have os.mkfifo...). > And the odds are fair that when you get this working, you > will run into some other inconvenient behavior. Named pipes > are a little tricky. Very -- particularly their blocking behavior at open (which appears to have perhaps tricked you in this case). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Design Patterns in Python

2006-08-05 Thread Alex Martelli
you can find the various PDFs at <http://www.aleax.it/python_mat_en.html> -- of course, they're somewhat fragmentary, but I hope they can be of some help! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Open letter to BDFL begging forgiveness.

2006-08-06 Thread Alex Martelli
rm that Comcast's email system is a mess (which is why I use other ways of doing mail -- and don't even get me started on Comcast's "news", might get my pressure up). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python open a named pipe == hanging?

2006-08-07 Thread Alex Martelli
ed behavior, at least in all Unix > > versions and variants I'm familiar with). > > But it does work. I edited that excerpt only to complete > missing parts, and ran it on MacOS X and GNU Linux. > > import os > f = '/tmp/r' > try: > os.unlink(f) > except: > pass You forgot to add os.mkfifo(f) here -- so you're writing and reading a perfectly ordinary file... of course *that* gives no problems!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-08 Thread Alex Martelli
r device then, as it came with teletypes typically used as consoles), so keeping track of columns would have a royal mess:-). I'm pretty sure you're still _able_ to take SOME Assembler-based course in most universities, but you need to strive pretty hard for the purpose... it's definitely not in the "default curriculum", even for EEs, much less CSs. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python open a named pipe == hanging?

2006-08-08 Thread Alex Martelli
factory. > [I don't know why I get tangled up in these named pipe problems, > when I know better myself than to use them!] I have no problems using named pipes _according to their documentation_ (so, in particular, no O_RDWR opening, and acceptance of their thread-blocking behavior on O

Re: How to change the path for python binary?

2006-08-10 Thread Alex Martelli
python" in the shell? One sufficient idea might be to put in your .bashrc file (or the like) a statement such as alias python=python2.3 Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: __contains__ vs. __getitem__

2006-08-10 Thread Alex Martelli
o use the mapping with string interpolation. > > > Well, this makes sens... But then why not use a plain dict to collect > data, and wrap it in a special one just before using it for > interpolation ? ie: Using a single container (and being able to modify and use it fluidly) is simply handier. That's what defaultdict in Python 2.5 is for, btw. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: __contains__ vs. __getitem__

2006-08-10 Thread Alex Martelli
... it may lead to > very inconsistent behavior. It's like overridind both __eq__ and __ge__ > with a different behavior. It's better for you to override > __contains__() too. I think it's perfectly safe -- that's what defaultdict in Python 2.5 does, after all. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Using a dictionary to pass data to/from embedded python functions

2006-08-12 Thread Alex Martelli
print "that's all" return and proceeded to compile and execute as follows: [[Note: it does not matter that I'm using 2.5, the code is just as fine with previous versions -- it just happens that 2.5 is what I'm using right now in order to help out with 2.5's

Re: Inconsistency producing constant for float "infinity"

2006-08-12 Thread Alex Martelli
ke different paths" (yeah, I _could_ study the sources, but I'm lazy:-)... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Inconsistency producing constant for float "infinity"

2006-08-12 Thread Alex Martelli
Tim Peters <[EMAIL PROTECTED]> wrote: [snip] thanks for an exhaustively satisfying explanation! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Using a dictionary to pass data to/from embedded python functions

2006-08-12 Thread Alex Martelli
wardm <[EMAIL PROTECTED]> wrote: > Thanks Alex for your help, (and advice on focusing the point of my > question). > > I was able to compile and run your example OK, but when I try to use the > "VarDictionary" in the > MyScriptModule.py code, I get an exception

<    6   7   8   9   10   11   12   13   14   15   >