lower())
I prefer yours (it's simpler IMHO), but if I was doing a code review I
would accept either of these.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
>
> myClass.method = method_for_class
>
> inst = myClass( )
> inst.method( 'hello' )
I think a solution may be using the new module and the function
instancemethod:
instancemethod(function, instance, class)
This function will return a method object, bound to instance, or
unbound if instance is None. function must be callable.
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
() and write() methods in a similar way to remove
> > the first byte? For whatever reason I can't seem to make it work
> > myself. Thanks again.
>
> Funny. I just happened to read ESR's "how to ask questions the smart way" and
> your posts match quite a few o
I know seek is just about positioning and nothing else.
So, in fact the problem boils down to os support for deleting a bytes.
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 11, 7:45 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Alex Popescu wrote:
> > On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> >> > Forgive my newbie ignorance, but I am wondering why the other method
sks: the latter group may be the ones who
"dread errors", and therefore miss the "making mistakes, experiencing
failures, and learning from them" that is "how we improve".
Alex
--
http://mail.python.org/mailman/listinfo/python-list
becomes a
class field/member.
For defining instance members you need to always prefix those with
self (this) in the
contexts it is available (f.e. in the instance method context).
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
',text)
> >return text
>
> --
> Andre Engels, [EMAIL PROTECTED]
> ICQ: 6260644 -- Skype: a_engels
Andre I think that unfortunately your solution will not ignore inlined
scripting, inlined styling, etc.
On the otherside, I don't think there are many solutions available,
other than the Lynx approach somebody
has already suggested.
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
ign (unless you consider microcode "HW", and,
personally, I don't;-). [[Fortunately as a part of the CE minor I did
learn Fortran, Lisp and Pascal, and a few machine-languages too, so I
wasn't totally blown away when I found myself earning a living by
programming rather than by designing chips, but that's another
story:-)]]
Alex
--
http://mail.python.org/mailman/listinfo/python-list
sult in the same performance or at least have clear/
documented performance.
I don't think we really want to see in code something like:
if threshold:
do_it_with_list_function
else:
do_it_with_list_comprehension
bests,
./alex
--
.w( the_mindstorm )p.
> --
> Gabriel Genelli
On Jul 13, 6:02 am, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Alex Popescu a écrit :
> (snip)
>
>
>
> > You are defining the list in the class context and so it becomes a
> > class field/member.
>
> 'attribute' is the pythonic term.
Thank
r your app (at least not if they don't have an idea about your
environment, your existing pl knowledge,
your app, etc.).
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
grooves is a class/function defined inside the
> module, you don't need to import it before using it.
I am a bit confused: I think the above should be:
if MMA.grooves in a class/function defined inside the module MMA, you
don't need to import the
class/function before using it, but o
On Jul 15, 3:00 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> Alex Popescu wrote:
> > On Jul 14, 5:55 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
> > wrote:
> >> So, as always, one should measure in each specific case if optimization is
> >>
On Jul 15, 10:08 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Sun, 15 Jul 2007 08:49:54 -0300, Alex Popescu
> <[EMAIL PROTECTED]> escribió:
>
>
>
> >> > But, I still don't understand how python can access a function in a
> >
; me.
If they're global variables of a certain module XYZ, your C code may
"import" XZY (or look it up in the C API equivalent of the sys.modules
dict) and get those variables as attributes of object XYZ. Is that what
you mean by ``variables defined in your Python program''...?
Alex
--
http://mail.python.org/mailman/listinfo/python-list
James T. Dennis <[EMAIL PROTECTED]> wrote:
...
> You can start writing all your code now as: print() --- calling
> the statement as if it were a function. Then you're future Python
...except that your output format will thereby become disgusting...:
>>> name
78ncp <[EMAIL PROTECTED]> wrote:
> hi...
> how to implementation algorithm latent semantic indexing in python
> programming...??
You may get more responses (as in, >0!-) if you give some URL about what
this algorithm is supposed to do.
Alex
--
http://mail.python.org/mailm
MD <[EMAIL PROTECTED]> wrote:
> Hi Alex,
>Thanks for your reply. It was exactly what I was looking for. Two
> additional questions
> 1) Is there anyway to find out which modules a variable belongs to
> when I have only its name (and its not qualified with the
7;t checked it yet.
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
MD <[EMAIL PROTECTED]> wrote:
> Hi Alex,
> Thanks for the answer. Are there any C defines (for e.g. STRING,
> BOOLEAN) corresponding to each Python type?
No, I know of no such "defines" -- what good would they do?
Alex
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 17, 4:41 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
> <[EMAIL PROTECTED]> escribió:
>
> > On Jul 17, 1:44 am, Stef Mientki <[EMAIL PROTECTED]>
> > wrote:
> >> I want to hav
; OOP languages that still follow the variable=>memory address containing
> object structure.
C++, definitely. But most OO languages, like Java &c, use a more modern
"object reference" naming scheme, just like Python, FP languages, etc.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 17, 4:41 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
> <[EMAIL PROTECTED]> escribió:
>
> > On Jul 17, 1:44 am, Stef Mientki <[EMAIL PROTECTED]>
> > wrote:
> >> I want to hav
On Jul 17, 4:41 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
> <[EMAIL PROTECTED]> escribió:
>
> > On Jul 17, 1:44 am, Stef Mientki <[EMAIL PROTECTED]>
> > wrote:
> >> I want to hav
en checking with gmane I've
noticed that all my posts got in (and now I am trying to figure out how can I
apologize for multiple posts :-) ).
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
Alex Popescu gmail.com> writes:
>
> On Jul 17, 4:41 am, "Gabriel Genellina" yahoo.com.ar>
> wrote:
> > En Mon, 16 Jul 2007 20:13:19 -0300, Alex Popescu
> > gmail.com> escribi
>
I apologize for posting the previous message a couple of time
patents supposed to last 17 years, anyway? A patent granted in
1989 should have expired in 2006, I believe (though IANAL, so...).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
llow heterogeneous
order-comparisons any more (they can't be removed in 2.* without
breaking backwards compatibility -- 3.0 is allowed to break backwards
compatibility, but 2.* isn't).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
eep losing links.
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965> .
Alex
--
http://mail.python.org/mailman/listinfo/python-list
x27;a', 1), ('A', 'a', 2), ('A', 'a', 3), ('A', 'b', 1), ('A', 'b',
2)], [('B', 'a', 1), ('B', 'b', 1)]]
However, you want a second level of grouping -- so, instead of the plain
list(ss), you need to apply this concept again:
>>> [[list(sss) for k,sss in gb(ss,itm(1))] for k, ss in gb(l, itm(0))]
[[[('A', 'a', 1), ('A', 'a', 2), ('A', 'a', 3)], [('A', 'b', 1), ('A',
'b', 2)]], [[('B', 'a', 1)], [('B', 'b', 1)]]]
...and there you are.
May be more readable with a little auxiliary function to capture what I
just called "this concept" with a readable name:
>>> def group(s, i): return [list(ss) for k, ss in gb(s, itm(i))]
...
>>> [group(ss,1) for ss in group(l,0)]
[[[('A', 'a', 1), ('A', 'a', 2), ('A', 'a', 3)], [('A', 'b', 1), ('A',
'b', 2)]], [[('B', 'a', 1)], [('B', 'b', 1)]]]
This does one more "list(...)" step, but if your lists aren't huge the
readability may be worth the small slow-down.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
values())
According to the profiler the loop takes about 7 seconds and the call to
array() 10 seconds with N=1,700,000.
Is there a faster way to do this using Numeric?
-Alex Mont
--
http://mail.python.org/mailman/listinfo/python-list
ve differently or implement
a new protocol described by the second object (I think this is the
Pythonic way of calling it).
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
bject() is
evaluated at call time, and so if the initialization is expensive you
will probably see surprises.
thanks in advance,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
Neil Cerutti <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> On 2007-07-20, Alex Popescu <[EMAIL PROTECTED]> wrote:
>> Hi all!
>>
>> I am pretty sure this has been asked a couple of times, but I
>> don't seem to find it on the archives (Google
u expect that there is key in dict
>
I may be missing something but I think the 3 approaches are completely
equivalent in terms of functionality.
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
than all
you have to do is:
for k in my_dict.keys().sort():
# rest of the code
If you just want to keep a list of ordered keys you can probably do
something like:
key_list = list(my_dict.keys())
key_list.sort()
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/lis
Miles <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> On 7/20/07, Alex Popescu <[EMAIL PROTECTED]> wrote:
>> If you just want to iterate over your dict in an ordered manner than
>> all you have to do is:
>>
>> for k in my_dict.keys().sort():
>>
mpile("x in dic","","eval"))
> 1 0 LOAD_NAME0 (x)
> 3 LOAD_NAME1 (dic)
> 6 COMPARE_OP 6 (in)
> 9 RETURN_VALUE
>
> "dic.has_key(x)" goes throu
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Alex Popescu a écrit :
>> Jakub Stolarski <[EMAIL PROTECTED]> wrote in
>
>
> [snip...]
>
>
> d = dict()
> answer = d.get('answer', 42)
> answer in d
> =>
ards,
> Ryan Ginstrom
>
What "build" tools are available in Python? Any initial hints are highly
appreciated.
bests,
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
ad
>
I see... what that document doesn't describe is the alternatives to be
used. And I see in that list a couple of functions that are probably used a
lot nowadays (callable, reduce, etc.).
bests,
./alex
--
.w the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list
On 7/22/07, Ryan Ginstrom <> wrote:
> Hi Alex:
>
> Do you develop for Windows? Are you looking to automate a build
> process?
>
> The standard library's build module is distutils:
> http://docs.python.org/lib/module-distutils.html
>
> As I mentioned in m
ment" is one threading model, but it still means that your
application and your in-process server must be compatible with it
(again, we're discussing the fact that out-of-process servers, at a
performance price, can do away with these minor limitations).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
s many such iterator objects, and
never raises StopIteration, thus obviously producing an unending loop.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
eeds, but I hope the general idea
is clear.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
, and calling the next method of the
object (iterator) which is returned by that function when called:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
gt;
> Thank you for that answer Alex, even though I didn't ask the question I
> was wondering the same thing myself.
You're welcome -- refreshing to see somebody who can actually understand
and accept the answer, rather than going on unrelated tangents when one
tries to help th
ts of different types that
compare equal; therefore that "documented behavior" is flat wrong and
needs to be fixed.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
7;is' test cannot, one more weird reason why it's better):
>>> class metaWeird(type):
... def __eq__(self, other): return True
...
>>> class Weird: __metaclass__ = metaWeird
...
>>> x = Weird()
>>> type(x) == type(None)
True
(warning to all innocen
mistaken
about what "a list of classes" means. I'd rather get confirmation of
that point before I address your question; if you use totally,
irretrievably wrong terminology, miscommunication's likely:-(.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
a Python-like language to C, and allows one to
> interact with it from Python with very little difficulty.
...and Boo, which is kind of a Python dialect in the same sense as Pyrex
is, but has type inference as well as declarations, and (there being
only one current implementation) compiles in
e CPUs in cheap
consumer products would change people's perceptions -- I wonder...
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Jorgen Grahn <[EMAIL PROTECTED]> wrote:
> As a C and C++ programmer (not a C/C++ programmer), I have to say that
Yeah, I wonder, what's C divided by C++ -- maybe about 0.731...?
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Tommy Grav <[EMAIL PROTECTED]> wrote:
> On Apr 19, 2007, at 11:00 PM, Alex Martelli wrote:
>
> > Alan Isaac <[EMAIL PROTECTED]> wrote:
> >
> >> currently documented behavior:
> >> "objects of different types always compare unequal".
>
ly the case that experienced
programmers, trained in a very different environment, had to be nearly
coerced to respect encapsulation; so the enforced encapsulation
mechanisms of languages born at that time may well have been warranted.
Nowadays, I agree with your thesis that having extra mecha
Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> En Fri, 20 Apr 2007 11:40:00 -0300, Alex Martelli <[EMAIL PROTECTED]>
> escribió:
>
> > I'm still interested to know where that erroneous quote from Alan Isaac
> > comes from, because if it's in Python
.zip, .gz and .bz2 archives, understands the most-used
options of GNU Tar, and is also much faster; for most purposes it is to
be preferred to GNU Tar", to quote).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
ourage),
but I thought Apple's Address Book didn't, and, having just tried a
VCard export from mine, it looks quite ASCII to me. Maybe you've set
some kind of preference, or...?
Alex
--
http://mail.python.org/mailman/listinfo/python-list
have installed to build a new file of some dbm type).
If by "keywords seeking" you mean performing full-text search, none of
these modules are at all suitable. Perhaps you might want to try
pylucene, <http://pylucene.osafoundation.org/>, or other such
third-party modules, for the purpose -- it that IS indeed your purpose.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
>
> ie the last statement (s[1:2]) with a simple slice does not call the
> new __getitem__ What am I missing.
For backwards compatibility, slicing without a step on some ancient
built-in types (including strings, but also lists) goes to __getslice__
(an otherwise obsolete method) instead
so popular). The main point here is that a
relational DB's tables _should_ be already very well optimized for
storing "sets", since those table ARE exactly nothing but sets of tuples
(and a 1-item tuple is a tuple for all that:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
gt;>>>>ch4(item, n+1)
> >>>>> ch4(list(sys.argv[1]))
...
> > for interest sake: is my method unredeemable?
>
> Let's just say that I don't currently see an obvious way of redeeming
> it. ;-)
Change the outer if into a while, and the recursive calls into proper
assignments to n. They're both tail-recursive calls, so this won't
change the semantics, as it happens.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
t such black magic in production. The completely different
way is: just don't.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
gt;> m.foo
23
>>> m.bar
45
>>>
A module may be appropriate, since it's little more than a "wrapper
around a dict to access items by dot notation":-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
es -- and it's certainly
> production code.
Personally, I'd much rather give up super (not a big loss) and classic
classes (a substantial net gain:-) than have to maintain such "black
magic" in a production environment. Explicit is better than implicit,
&c.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
edfialk <[EMAIL PROTECTED]> wrote:
> Alex, very nice. That should be good enough for me.
> The rest of you as well, thanks for all the help.
>
> I, unfortunately, failed to realize the actual platform the script is
> for is IronPython. When trying to import calendar i
gramming in Django a
lot these days... ah well, consistency, hobgoblin, little minds, &c:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
y, and I believe the underlying dotNet CLR does
do threads nicely; we'll see what develops on that front, I guess.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
", and why I think the
PSF should do likewise in this case.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
crosoft's own proprietary CLR (and also modify IronPython as you
require, given the above-mentioned license).
Other possible alternative starting points include pirate (the Python
compiler for the Parrot virtual machine) -- I don't believe it's
currently under active development (no more than, say, Jython), but I
might well be wrong on this issue; and "Python dialects" ranging from
Pyrex to Boo.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
te the random.Random class and you can
call .seed on it as well as anything else, and no other module will
infringe on "your" module's Random instance. The "global functions" of
module random exist for those who *SPECIFICALLY* want globally shared
behavior, of course.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Hi everybody, does anyone know how to detect a key press from a
keyboard. Well I do know how to do that, but i need to detect just one
press and ignore the others. I mean, my program checks an input from the
outside (a sensor) and i emulate that signal as a keypress, but the
sensor doesn`t send the
Hi everybody, does anyone know how to detect a key press from a
keyboard. Well I do know how to do that, but i need to detect just one
press and ignore the others. I mean, my program checks an input from the
outside (a sensor) and i emulate that signal as a keypress, but the
sensor doesn`t send the
pass
has_key exists only for backwards compatibility; the 'in' operator is
preferable.
$ python -mtimeit -s'd={}' 'd.has_key(23)'
100 loops, best of 3: 0.289 usec per loop
$ python -mtimeit -s'd={}' '23 in d'
1000 loops, best of 3: 0.139
adays, as in this case, he implemented it many,
many years ago -- method get of the dict type, as others already said.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
at the
same time, as long as you use the "new" way (meaning, in this case, the
one that's been around for "only" about seven years...!!!) -- now that's
a combination of factors that's reasonably typical of Python, but not
quite so frequent in other languages!-)
Alex
--
http://mail.python.org/mailman/listinfo/python-list
e exactly opposite principle, "Don't save anything you can
recalculate"... of course, the best approach is generally a compromise,
but it's good to be aware of the potentially high costs of caching:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
EuGeNe Van den Bulke <[EMAIL PROTECTED]> wrote:
> Alex Martelli, brilliant speaker and Python evangelist (in my Shu Ha
> eyes anyway), lives in the States and is Italian. Busy as you'd expect
> from someone working for Google, decides to make the trip to Europe for
> a Py
#x27;or', 'pass', 'print',
'raise', 'return', 'try', 'while', 'with', 'yield']
call help(kw) from an interpreter prompt for any one of these values for
more information. E.g.,
>>> help('and')
will give you section 5.1 (Boolean operations), all the way to
help('yield') giving 6.8 (The yield statement). Some of the keywords
have no specific info, e.g. help('as') will not be very informative:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
orithms such as
Newton's root-finding approach and the like -- I shudder to think how
many people with CS bachelor degrees and even post-grad degrees are just
never taught these fundamentals, yet end up having to program _some_
floating point computations, mistakenly thinking they can...).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
ould blame the
> standards committee, not the compiler writers. Very few features of
I was thinking of "Fortran IV" aka Fortran '66, where as I recall per
the standard you were _supposed_ to only use integers in a DO, but
several compilers supplied real loop variables as an extension, and got
its implementation wrong.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
and-line dinosaurs, the people who prefer running
python at a shell prompt (rather than more advanced things such as
ipython, or IDEs such as PyDev, IDLE, etc, etc) this doesn't really tend
to be that high a priority, as we're quite used to "not necessarily
auto-integrated&qu
ty offered
by ctype, as the higher-level stuff is plenty sufficient to get a lot of
core dumps:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
considered as keys into a dict. There are of course ways to "collapse"
them (e.g, use (type(e), str(e)) as the dict key, or, many others), but
at any rate this does not appear to have anything to do with the problem
you report.
Could you perhaps post a complete, self-sufficient short script or
interactive interpreter session, such as the few lines I've just copied
and pasted above, to help us understand your problem? (More generally,
<http://www.catb.org/~esr/faqs/smart-questions.html> has pretty good
advice about "how to ask questions the smart way").
Alex
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud <[EMAIL PROTECTED]> wrote:
> André wrote:
[snipping total repost of André's post]
> > I'm really annoyed at Python - and not for the reasons already
> > mentioned on this list.
> >
> > Everyone know that programming is supposed to be a dark art, nearly
> > impossible to learn.
s
reasonably short list (I feel much the same way about None, by the way).
pychecker, pylint, and friends, are a much better way to detect and warn
about all sort of anomalies of this kind.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
t directory of temp should work fine. Since you don't
give us the exact command line you're trying to execute, it's impossible
to guess exactly what you're doing.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
ance (and Catalunya, for those who prefer
cava, etc -- basically, all regions that export champagne!-).
Alex
[1] yah, I do remember MSFT flirting with $60 [considering the early'03
split] at the end of '99 -- that was just Wall Street being crazy, and
the fall from THOSE heights is N
uding Python.
Personally, I swear by VIM (the full downloaded version with GUI support
and everything, see <http://macvim.org/OSX/index.php>) but unless you
like the general approach of vi I guess you're more likely to swear AT
it than BY it:-).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
, so it can run just as well on (e.g) 2.2.1 (and earlier) as
2.2.2 (and later) -- breaking all of that code which always worked fine
is a decision not to be taken as lightly as you appear to imply.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
johnny <[EMAIL PROTECTED]> wrote:
> Any Good tools to create CSV Files? ReportLab only creates pdf
> files. I need something to create CSV files.
<http://docs.python.org/lib/module-csv.html>
Alex
--
http://mail.python.org/mailman/listinfo/python-list
known host? connection timeout? HTTP error?
I think <http://www.python.org/doc//lib/module-urllib.html> gives good
information about these issues.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
of code in it", Foreman Acton's "Real computing
made real", now out in a wonderfully cheap Dover edition: Acton makes
this case better than I've ever seen it made elsewhere, and offers many
excellent examples of how numerical computation SHOULD be done).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Alan Isaac <[EMAIL PROTECTED]> wrote:
> "Alex Martelli" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > If you're running test1.py as your main module, then it's not part of a
> > package, so the relative import should indee
m.
Use, instead, the DSU that is now build into Python:
listofsets.sort(key=len)
this will be faster (as well as more readable &c) than programming your
own DSU, and is exactly the reason the key= parameter was added.
I also suggest avoiding reduce in favor of a simple explicit loop.
Alex
--
l?
sum is for summing NUMBERS -- using it on lists is O(N squared).
So, this solution is asymptotically VERY slow, as well as obfuscated.
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman <[EMAIL PROTECTED]> wrote:
> Alex Martelli wrote:
> > Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> >...
> >>>>> decorated.sort()
> >...
> >>> def index(sequence):
> >>> return sorted(range
RobJ <[EMAIL PROTECTED]> wrote:
> http://pyschool.robj.webfactional.com/
Things start on a pretty bad note when I'm asked to select my OS:
Ubuntu Linux
Windows XP
I'm running MacOSX. What now? Why is there no choice "none of the
above"...?!
Alex
--
http://mai
be correct. And if it's not, it's not
> because they're all O(N log N).
And if it is, it's not because of the "one sort" versus "two sorts": by
that sole criterion you just cannot guess (sensibly) at speed (measuring
is much better, though it has its own pitfalls).
Alex
--
http://mail.python.org/mailman/listinfo/python-list
1501 - 1600 of 2602 matches
Mail list logo