Re: Python Mauritius Usergroup - End of Year report 2020

2021-01-03 Thread Alex Kaye
Super report, need more like it from others ! A.K. On Sun, Jan 3, 2021 at 2:06 AM Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> wrote: > Greetings, > > ^^ Thanks! > > Kind Regards, > > Abdur-Rahmaan Janhangeer > about | blog >

Re: Poor man's OCR: need performance improvement tips

2005-09-24 Thread Alex Stapleton
On 24 Sep 2005, at 19:14, qvx wrote: > Hi all, > > > 4. Process each line: compare pixels of each letter of alphabet with > corresponding pixels in line of input picture. This consists of loops > comparing pixel by pixel. This is my performance bottleneck. > > I'm using PIL for initial image p

Human readable number formatting

2005-09-27 Thread Alex Willmer
ble(1024, base=2) == '1 KiB' and enforcing of 3 digits at most (ie human_readable(100) == '0.1 KB' instead of '100 B). However I can't get the right results adapting the above code. Here's where I'd like to ask for your help. Am I chasing the right target, in basing my function on log()? Does this function already exist in some python module? Any hints, or would anyone care to finish it off/enhance it? With thanks Alex -- http://mail.python.org/mailman/listinfo/python-list

CSV like file format featured recently in Daily Python URL?

2005-10-07 Thread Alex Willmer
ther data",data,data data,data,"",data Can anyone remember this file format/python module? With thanks Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Alex Martelli
t. You may not have had any use for this > kind of code, but unfamiliary with certain types > of problems, doesn't make something contrived. It's so contrived it will raise a SyntaxError due to the spurious extra colon on the first line;-). Or, consider, once the stray extra colon i

Re: "no variable or argument declarations are necessary."

2005-10-08 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > ap.py:4: No global (test) found > > ap.py:5: Local variable (ego1d) not used > > Helen:/tmp alex$ > > > > If you're so typo-prone and averse to unittests that

Re: Will python never intend to support private, protected and public?

2005-10-08 Thread Alex Martelli
-) I also had fun rereading that little piece of mine... Unfortunately my current presence is probably a somewhat short-lived phenomenon (I just need a breather right now, but I'll have to plunge back into Google work AND writing the 2nd edition of the Nutshell soon...), but, for a short while, I'm back! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-10-08 Thread Alex Martelli
ect existing coding standards, I entirely avoid the double-underscore usage, while single-underscores are OKish). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python

2005-10-08 Thread Alex Martelli
ting of > > course with the Python site itself, and others, but I felt a bit > > lacking from the Python site, it seems it was only made for those > > who installed the source distribution, as for the other people... > > Anyways, thanks for the help! > > I have no exp

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-08 Thread Alex Martelli
ison operation but you can easily roll your own heap by transforming > each item to a (key,item) tuple. Now that I'm thinking about it, it might > be a good addition to the cookbook. I believe Python 2.5 adds a key= argument to heapq's functions... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Google Not Universal Panacea [was: Re: Where to find python c-sources]

2005-10-08 Thread Alex Martelli
e doing fine, though. She's currently taking a C class at college and claims "the more I know C, the more I love Python" - and I gather she's evangelizing (and the class is about 50/50 genderwise;-). > Also, many regular readers didn't grow up speaking English (I was

Re: Feature Proposal: Sequence .join method

2005-10-08 Thread Alex Martelli
at you mean by "inside generators ... automatically trapped", or what's undocumented about that. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV like file format featured recently in Daily Python URL?

2005-10-08 Thread Alex Willmer
On Fri, 2005-10-07 at 18:56 +0200, Fredrik Lundh wrote: > Alex Willmer wrote: > > > I'm trying to track down the name of a file format and python module, > > that was featured in the Daily Python URL some time in the last month or > > two. > > http://www.netpro

Re: Python for search engine development

2005-10-08 Thread Alex Martelli
One notably strong point of Python is that it "plays well with others", and I would advise you to leverage this fact. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV like file format featured recently in Daily Python URL?

2005-10-08 Thread Alex Willmer
On Thu, 2005-10-06 at 07:44 -0800, EP wrote: > Was it something like ARFF? http://www.cs.waikato.ac.nz/~ml/weka/arff.html Yes that was it thankyou. Although it would seem there isn't a general python module, rather a Cookbook script to perform conversion to SQL. I must have confused ARFF with HDF

Re: [Pythoncard-users] Re: Pythoncard mental block

2005-10-09 Thread Alex Tweedly
the same thing as Hypercard. The parallels with Hypercard aren't that strong. :-) In this case, PythonCard is more versatile (i.e. less helpful) - it just returns the string entered, leaving it up to you whether to one-way hash it, encrypt it, use it as an MD5 key phrase, or

Re: Python's Performance

2005-10-09 Thread Alex Stapleton
On 9 Oct 2005, at 19:04, Bruno Desthuilliers wrote: > Laszlo Zsolt Nagy a écrit : > > >> Dave wrote: >> >> >> >>> Hello All, >>> >>> I would like to gather some information on Python's runtime >>> performance. As far as I understand, it deals with a lot of string >>> objects. Does it require a l

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-09 Thread Alex Martelli
#x27;t. I would still go for the heap solution since IMO the resulting > code it's more readable and easier to understand. I'm not so sure about either sentence...: Helen:~/pynut/samp alex$ python merger.py --numstreams=10 --minlen=100 --how=S Best time for 10 loops: 0.24711

Re: Question about parsing a string

2005-10-10 Thread Alex Martelli
ndex(']') url = s[_startlen:where_closebracket] txt = s[where_closebracket+1:-_endlen] if not txt: txt = url return '%s' % (url, txt) I've just typed in this code without trying it out, but roughly it should be what you want. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: What about letting x.( ... ? ... ) be equivalent to ( ... x ... )

2005-10-10 Thread Alex Martelli
l ever have multi-methods (any more than I expect to see them in Java, C++ or C#), but that's no reason to forget them:-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python book

2005-10-10 Thread Alex Martelli
hrh1818 <[EMAIL PROTECTED]> wrote: > This book is not a new book. It is an updated version of Magnus's 2002 > Practical Python book. Then it's probably a good book, because Practical Python sure was! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-10 Thread Alex Martelli
make sense. If we had key= arguments, that would ENSURE no such comparison, but heaps didn't support that in 2.4 and I wanted to keep the playing field level, so I used the above old trick to ensure stable sorting without comparisons beyond a given field (more details were explained in the 1s

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-10 Thread Alex Martelli
else: best_source[0] = key(best_source[2]) Of course, since the sort method DOES accept a key= parameter, this could be simplified, but I'll leave it like this to make it trivial to see how to recode the merging by heap as well (in 2.4)... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: A problem while using urllib

2005-10-11 Thread Alex Martelli
ur program hits some wall of maximum simultaneously open files), but I can't reproduce it here (MacOSX, tried both Python 2.3.5 and 2.4.1). What version of Python are you using, and on what platform? Maybe a simple Python upgrade might fix your problem... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do *args, **kwargs properly

2005-10-11 Thread Alex Martelli
ef fn(*values, **opts): cmp = opts.pop('cmp', cmp) if opts: raise ValueError, 'Unknown option(s): %s' % opts.keys() # rest of function here There are some cases where ignoring extra options, or just warning about them, may be more appropriate, but normally I would check... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for info on Python's memory allocation

2005-10-11 Thread Alex Martelli
s = [0] * len(iterable) > > for i in xrange(len(iterable)): > > s[i] = iterable.next() > > Faster? Maybe. Only testing can tell -- but I doubt it. But as for less Testing, of course, is trivially easy: Helen:/tmp alex$ python -mtimeit -s'i=xrange(7)' 'L=[x for x in i]&

Re: Python's garbage collection was Re: Python reliability

2005-10-11 Thread Alex Martelli
ify GC semantics (exactly WHEN some given garbage gets collected)... allow such multiple implementations leeway in optimizing behavior for the target VM(s). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Alex Martelli
uot;requiring no imports". Python, if anything, already has too many built-ins -- once backwards compatibility can be broken (i.e., in 3.0), many of them should be moved to standard library modules, "requiring imports" (which are cheap operations anyway). The desire for MORE built-ins with no real advantage (since "requiring no imports" ISN'T a true advantage) is definitely misplaced. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-13 Thread Alex Martelli
Rune Strand <[EMAIL PROTECTED]> wrote: > Ok, Alex. I know a good explanation when I see one. Thanks! You're welcome! I've tried to give good (but shorter!-) explanations in the Nutshell, too, but of course it's easier to aim a specific explanation to a specific qu

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Alex Martelli
Tom Anderson <[EMAIL PROTECTED]> wrote: > On Tue, 11 Oct 2005, Alex Martelli wrote: > > > Tom Anderson <[EMAIL PROTECTED]> wrote: > > ... > >> Has anyone looked into using a real GC for python? I realise it would be a > > > > If you mean mark-

Re: Python's Performance

2005-10-14 Thread Alex Stapleton
On 12 Oct 2005, at 09:33, bruno modulix wrote: > Donn Cave wrote: > >> Quoth "Fredrik Lundh" <[EMAIL PROTECTED]>: >> | Alex Stapleton wrote >> | >> | > Except it is interpreted. >> | >> | except that it isn't. Python source co

Re: confusion between global names and instantiated object variable names

2005-10-14 Thread Alex Martelli
should not trigger this error. Most likely problem: you have typed a comma where you meant to type a dot, for example instead of self.menubar you wrote self,menubar somewhere -- it's a hard error to spot with certain fonts. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem splitting a string

2005-10-15 Thread Alex Martelli
NP'], ['is', 'VL'], ['funny', 'JJ']] > > which needs flattening. because the flattening is easy: [ x for x in y.split('_') for y in z.split(' ') ] Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem splitting a string

2005-10-15 Thread Alex Martelli
, 'is', 'VL', 'funny', 'JJ'] > > Which is probably slow. To bad extend doesn't take multiple arguments. Using sum on lists is DEFINITELY slow -- avoid it like the plague. If you have a list of lists LOL, DON'T use sum(LOL, []), but rather [x for x in y for y in LOL] Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Some set operators

2005-10-15 Thread Alex Martelli
gt; > My suggestion is to remove them, and keep them only as explicit > non-operator versions (.symmetric_difference(), .update(), > .intersection_update(), etc). But maybe now it's too much late to > remove them... Maybe someone gentle can explain me the advantage of > havi

Re: Some set operators

2005-10-16 Thread Alex Martelli
Giovanni Bajo <[EMAIL PROTECTED]> wrote: > Alex Martelli <[EMAIL PROTECTED]> wrote: > > > I still vaguely hope that in 3.0, where backwards incompatibilities > > can be introduced, Python may shed some rarely used operators such as > > these (for all types,

Re: How to get a raised exception from other thread

2005-10-17 Thread Alex Martelli
sual overuse of a facility intended only to help in very peculiar cases (essentially in debuggers &c, where the thread's code may be buggy and fail to check a keep-alive flag correctly...!-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing lists

2005-10-17 Thread Alex Martelli
g.) random pivot selection in quicksort, when its big-O (i.e., worst-case) behavior will remain N-squared, just like naive quicksort, or, for that matter, bubblesort? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue question

2005-10-17 Thread Alex Martelli
ers who don't read docs to try and use it, possibly producing unreliable code which works when tested but silently breaks in real-life use). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with properties

2005-10-17 Thread Alex Martelli
quot;should" become the default by, say, 2.6, rather than waiting for 3.0. But, that's not an easy issue to call! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: generic xmerge ?

2005-10-17 Thread Alex Martelli
second-items getting compared when the first-items are equal. If you want to sort on first-items ONLY, leaving the tuples in the same order in the list when their first-items are equal: import operator X.sort(key=operator.itemgetter(0)) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: generic xmerge ?

2005-10-17 Thread Alex Martelli
critical for your overall application. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Run process with timeout

2005-10-17 Thread Alex Martelli
f it's finished, otherwise kill it (use its .pid attribute). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: generic xmerge ?

2005-10-17 Thread Alex Martelli
may perform better than L = sorted(l1+l2+l3) -- if speed matters a lot, be sure to try (and measure!) both versions. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic generation of doc-strings of dynamically generated classes

2005-10-17 Thread Alex Martelli
st like, the best way to make instances of any type is generally to call that type): derived = type(base)('derived', (base,), {'__doc__': 'zipp'}) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: reading hebrew text file

2005-10-17 Thread Alex Martelli
I know of no ways to guess from here!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing lists

2005-10-17 Thread Alex Martelli
Christian Stapfer <[EMAIL PROTECTED]> wrote: > "Alex Martelli" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Christian Stapfer <[EMAIL PROTECTED]> wrote: > > > >> This is why we would like to have a way of (roughly)

Re: Run process with timeout

2005-10-17 Thread Alex Martelli
ts of Unix-like OSes, though. A setpgrp call (in the callback which you can request Popen to perform, after it forks and before it execs) might suffice... except that you can't rely on children process not to setpgrp's themselves, can you?! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: UI toolkits for Python

2005-10-18 Thread Alex Martelli
-- and why else would one use ANY Javascript, after all? My one issue with the JS/AJAX mania is that I really dislike JS as a language, particularly when you take the mixed mongrel dialect that you do need to reach all the various browsers and releases needed to make that 95% goal. But, alas, there is really no alternative!-( Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: override a property

2005-10-18 Thread Alex Martelli
cifically designed for your purpose -- e.g., one with a method that instances can call to add or remove themselves from the set of "instances overriding this ``property''" and a weak-key dictionary (from the weakref module) mapping such instances to get/set (or get/set/del, if you need to specialize "attribute deletion" too) tuples of callables. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-18 Thread Alex Martelli
ty(getFoo, setFoo, delFoo, 'this is the foo') Note that if you want subclasses to be able to customize behavior of foo accesses by simple method overrides, you need to program some "hooks" (an extra level of indirection, if you will). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-18 Thread Alex Martelli
itself is in your example) are many indeed, so your question is very strange. You cannot call an integer, you cannot divide methods, etc. Alex -- http://mail.python.org/mailman/listinfo/python-list

Bloodhound.Exploit.49 trojan found in MIMEBase.pyc

2005-10-18 Thread Alex Hunsley
to be found on various pages, but it's a pretty terse explanation: http://secunia.com/virus_information/22534/bloodhound.exploit.49/ Has anyone had this also? Is it perhaps a false positive? alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-18 Thread Alex Martelli
Johnny Lee <[EMAIL PROTECTED]> wrote: > Alex Martelli ??? Now that's a peculiar question... > > Johnny Lee <[EMAIL PROTECTED]> wrote: > > > > > But I still wonder what's the difference between the A().getMember and > > > A().member

Re: Hygenic Macros

2005-10-18 Thread Alex Stapleton
I seem to remember a rather ugly hack at some point in the past that created a new "operator" like so A |dot| B where dot was an object which had the OR operator for left and right arguments redefined seperately so that it only made sense when used in that syntax. I guess you could hack so

Re: Hygenic Macros

2005-10-18 Thread Alex Stapleton
Ahar got it http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122 Would something like that be any use? On 18 Oct 2005, at 13:21, Alex Stapleton wrote: > I seem to remember a rather ugly hack at some point in the past that > created a new "operator" like so > > A

Re: UI toolkits for Python

2005-10-18 Thread Alex Martelli
e there IS a finite amount of development resources to allocate). Maybe that's part of the explanation for the outstanding success of some enterprises founded by engineers, led by engineers, and staffed overwhelmingly with engineers, competing with other firms where marketing wield power...? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: List of strings to list of floats ?

2005-10-18 Thread Alex Martelli
ween a float towards the end of the longer list, and None...! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: UI toolkits for Python

2005-10-18 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > Mike Meyer <[EMAIL PROTECTED]> wrote: > >> What surprises me is that marketing types will accept turning away - > >> what's the current internet user base? 200 mi

Re: Sequence and/or pattern matching

2005-10-19 Thread Alex Martelli
was, say, in the different order: B->C A->B C->A would you want this detected as a loop, or not? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-21 Thread Alex Stapleton
On 21 Oct 2005, at 09:31, Harald Armin Massa wrote: > Casey, > > > >> I have heard, but have not been able to verify that if a program is >> about >> 10,000 lines in C++ >> it is about >> 5,000 lines in Java >> and it is about >> 3,000 lines in Python (Ruby to?) >> > > BTW: it is normally only 50

Re: sort problem

2005-10-21 Thread Alex Martelli
ed by calling int(...) or str(...) on some of the columns, and so on. This applies to "key=" in 2.4 just as well as to the (slightly slower) direct implementation in 2.3 and earlier. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-21 Thread Alex Martelli
ile i < 100 j = 923567 + i i += 1 end end f() comment out the 'end' statements, and at colons at the end of the def and while statements, and this is also valid Python. On my iBook...: Helen:~ alex$ time ruby -w tim.rb real0m5.367s user0m5.129s sys 0m0.041

Re: override a property

2005-10-21 Thread Alex Martelli
Robin Becker <[EMAIL PROTECTED]> wrote: ... > in answer to Bengt & Bruno here is what I'm sort of playing with. Alex > suggests class change as an answer, but that looks really clunky to me. > I'm not sure what Changing class is indeed 'clunky', though it

Re: Question about inheritance...

2005-10-22 Thread Alex Martelli
.__class__, self).draw() You never defined a method named 'draw', do you mean 'render'? > def outline(self): > print 'outline' + self.__class__ Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-22 Thread Alex Martelli
r(x=0; x<23; x++) { a=seq[x]; zap(a); blup(a); flep(a); } and for(x=0; x<23; x++) { a=seq[x]; zap(a); blup(a); flep(a); } are both commonly used styles -- the order of magnitude difference in lines of code is totally "illusory". Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: C extension modules in Python

2005-10-22 Thread Alex Martelli
ing it from. It's hard to say more without knowing about your system, and the way you've set things up for it in terms of loading of dynamic libraries (which IS a very system-dependent thing). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE recommendation please

2005-10-22 Thread Alex Martelli
Mac enthusiast, for not having tried them...), but they're surely worth investigating. Ditto for ActiveState's Komodo tool... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-23 Thread Alex Martelli
t may take me twice as long to rewrite the original 500 words into 200, as it took to put down the 500 words in the first place -- which helps explains why many of my posts are so long, as I don't take all the time to re-edit them, and why it taks so long to write a "Nutshell" series book, where conciseness is crucial. Nor it is only my own issue... remember Pascal's "Lettres Provinciales", and the famous apology about "I am sorry that this letter is so long, but I did not have the time to write a shorter one"!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How to separate directory list and file list?

2005-10-23 Thread Alex Martelli
7; the absolute path of the current directory, meaning I intend to ignore it). An expression that just provides the filename list is os.walk('.').next()[2] although this may be a tad too obscure to recommend it!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax across languages

2005-10-23 Thread Alex Martelli
ot;modifies in-place" (and, secondarily, question mark to indicate predicates). The distinction between, e.g., y = x.sort() and x.sort!() in Ruby is much clearer, IMHO, than that between, say, y = sorted(x) and x.sort() in Python... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax across languages

2005-10-23 Thread Alex Martelli
27;t want to store None to mean "no such object" but, to avoid repeated testing, rather want to store an object which "reliably does nothing", are reasonably common. In an abstract way, they're somewhat akin to having the 'pass' statement in the language itself;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax across languages

2005-10-23 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Alex> I've seen enough occurrences of "lambda x: x" in Python code with > Alex> a generally functional style that I'd love to have > Alex> operator.identity (and a few more trivial functions like that) for &

Re: calling a dylib in python on OS X

2005-10-23 Thread Alex Martelli
her Unix dialects. Try http://starship.python.net/crew/theller/ctypes/ ... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-23 Thread Alex Martelli
roperty, based on externalities certain uses might impose on unwilling parties, is as solid as a rock, both practically and theoretically -- however much anarchists or extreme libertarians might wish otherwise. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax across languages

2005-10-23 Thread Alex Martelli
nt something like "abs(a-b)/(abs(a)+abs(b)) < quadEpsilon" or thereabouts. Not too different from Numeric.allclose, except the latter is "richer" (it takes both absolute and relative "epsilons", and also implies an "and-reduce" if the objects being compared are arrays). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: how to count and extract images

2005-10-23 Thread Alex Martelli
st > one if it has been downloaded and go to next one, and if next one is > downloaded go to next one, and so on. Pass the index from where the search must start as the second argument to the s.find method -- you're already doing that for the second call, so it should be pretty obvious it

Re: Tricky Areas in Python

2005-10-23 Thread Alex Martelli
ean I'd rate the candidate 4 out of five, instead of 4.5 or more, for Python coding competence). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-23 Thread Alex Martelli
Andrew Durdin <[EMAIL PROTECTED]> wrote: > On 10/24/05, Alex Martelli <[EMAIL PROTECTED]> wrote: > > I may branch out into more advanced stuff such as asking > > for an example use case for a closure, a custom descriptor, or an import > > hook, for example >

Re: High Order Messages in Python

2005-10-23 Thread Alex Martelli
ical scope" of blocks is a highly controversial notion in the Ruby community; so I wouldn't necessarily count it as an _advantage_ of Ruby blocks... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: High Order Messages in Python

2005-10-24 Thread Alex Martelli
ors &c to the power of Ruby blocks may be taken as a clear indication that, right now (Ruby 1.8.* vs Python 2.4.*), Ruby's blocks are somewhat more powerful. As for the differences in style that will remain when Python 2.5 is born, we'll be back to "personal taste" level issues, it appears to me. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-24 Thread Alex Martelli
elf happens when you access s.foo (for s being an instance of this here-sketched class) and overriding works just as expected. This can be seen as the simplest possible use case for the "Template Method" Design Pattern, btw;-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-24 Thread Alex Martelli
Michele Simionato <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > ... remember Pascal's "Lettres Provinciales", > > and the famous apology about "I am sorry that this letter is so long, > > but I did not have the time to write a shorter one&q

Re: Python vs Ruby

2005-10-24 Thread Alex Martelli
Jorge Godoy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > > forwards a lot to Python 3.0!-). But -- the "dream" solution would be > > to work closely with customers from the start, XP-style, so features go > > into the

Re: Tricky Areas in Python

2005-10-24 Thread Alex Martelli
list you're also modifying. > I had to look up the syntax, because i never use it in my code, yet. > > 3+4) I never used property - had to look it up. So i learned something > :) Good!-) Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Web based applications are possible with wxPython?

2005-10-25 Thread Alex Stapleton
Looks shockingly like yet another Java VNC client to me. On 18 Oct 2005, at 21:16, Eli Criffield wrote: > http://www.nomachine.com/companion_screenshots.php > > While not exacly what your talking about, its about as close as i can > think of. This allows you to run any X applications inside a web

Re: Tricky Areas in Python

2005-10-25 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > >> > class Sic: > >> > def getFoo(self): ... > >> > def setFoo(self): ... > >> > foo = property(getFoo, setFoo) > > > >

Re: Tricky Areas in Python

2005-10-25 Thread Alex Martelli
ith a flawed solution and asked to help debug it (by identifying the "tricky issue" on which it fails) appears to me to be perfectly acceptable. It IS the kind of task you face all the time IRL, and checks how well you know the language and libraries... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Set an environment variable

2005-10-26 Thread Alex Martelli
y experience, > > many people don't... > > True. Using Unix for 20+ years probably warps one's perception > of what's obvious and what isn't. This specific issue is identical in Windows, isn't it? I do not know any OS which does have the concept of "environm

Re: namespace dictionaries ok?

2005-10-26 Thread Alex Martelli
called only when an attribute is not found "in the normal way"). If you think about it, you're asking for incompatible things: by saying that a namespace X IS-A dict, you imply that X.update (&c) is a bound method of X; at the same time, you also want X.update to mean just

Re: How to replace all None values with the string "Null" in a dictionary

2005-10-27 Thread Alex Martelli
wd = dict((k, _auxd.get(k, c) for k, c in mydict.items()) [which might be a nice idea if you wanted to do _several_ substitutions;-)...] Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Double replace or single re.sub?

2005-10-27 Thread Alex Martelli
;','') > > I can change this to a single call to re.sub: > > html = re.sub('<([/]*)i>', r'<\1em>', html) > > Would this be a quicker/better way of doing it? *MEASURE*! Helen:~/Desktop alex$ python -m timeit -s'import re; h=&

Re: Generic utility class for passing data

2005-10-28 Thread Alex Martelli
but you can do even better: class Dummy(object): def __init__(self, **kwds): self.__dict__ = kwds prefill = Dummy(foreground='blue', background='red', pattern=mypattern) return prefill Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I sort these?

2005-10-28 Thread Alex Martelli
Or, better, pass a key-extraction function, that's much handier and faster (it automates the "decorate-sort-undecorate", DSU, idiom). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question: string replace

2005-10-28 Thread Alex Martelli
ctly. Save a copy, then rename it. That See module fileinput in the standard library, it does this for you automatically when used in the right way -- much better than rolling your own and having to debug it and maintain it forever! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question: string replace

2005-10-28 Thread Alex Martelli
also works;-) > Or, instead of using print, use sys.stdout.write(). Yep, generally better than 'print'. Alex -- http://mail.python.org/mailman/listinfo/python-list

pickling classes with __slots__

2005-10-28 Thread Alex Neyfakh
have __dict__ . I need to be able to pickle and unpickle them. As far as I could understand, I need to provide __getstate__ and __setstate__ methods for each class. Is there a universally accepted code for each method? If so, what is it? If there is no standard, what works? TIA Alex --

Re: Scanning a file

2005-10-28 Thread Alex Martelli
t; needed, as you can see, and what little "fiddling" is needed is entirely encompassed by the generator... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Opaque documentation

2005-10-28 Thread Alex Martelli
last clause. It should say "most software > projects." You over-specified the last clause. It should say "most projects." Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't this work? :)

2005-10-28 Thread Alex Martelli
en their specification says otherwise (just about all of them). Alex -- http://mail.python.org/mailman/listinfo/python-list

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