On Jul 22, 9:36 am, Hendrik van Rooyen
wrote:
> On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
>
> > My guess is that it was probably for optimization reasons long ago.
> > I've never heard a *good* reason why Python needs both.
>
> The good reason is the immutability, which lets you use
> a tup
On Jun 24, 11:40 pm, "J. Cliff Dyer" wrote:
> Also note that you can iterate over a file several times:
>
> f = open('foo.txt')
> for line in f:
> print line[0] # prints the first character of every line
> for line in f:
> print line[1] #prints the second character of every line
>
No, yo
On May 31, 12:41 pm, Beni Cherniavsky
wrote:
>
> Take a look athttp://openopt.org(python-scikits-openopt on debian/
> ubuntu) - a lot of optimization engines under one interface, so you
> can try different engines easily and without learning many interfaces.
>
Correction: don
On May 23, 4:22 pm, Esmail wrote:
>
> Is there some sort of simple Python module that would allow me to
> evaluate this type of function?
>
> In this particular instance I am interested in the minimum of
>
> x * sin(4*x) + 1.1 * sin(2*y), where x,y in range 0-10
>
> though in other problems the
[Long mail. You may skip to the last paragraph to get the summary.]
On May 12, 12:35 pm, Steven D'Aprano wrote:
> To really be safe, that should become:
>
> try:
> rsrc = get(resource)
> except ResourceError:
> log('no more resources available')
> raise
> else:
> try:
> do
On May 8, 12:07 am, MRAB wrote:
> def compound_filter(token_stream):
> stream = lowercase_token(token_stream)
> stream = remove_boring(stream)
> stream = remove_dupes(stream)
> for t in stream(t):
> yield t
The last loop is superfluous. You can just do::
def compoun
Small additions:
On Mar 26, 7:35 pm, "J. Cliff Dyer" wrote:
>
> 2) Aliasing imports is also cool. Show people how easy it is to switch
> from
>
> >>> import MySQLdb as db
> to
> >>> import psycopg2 as db
>
> and have all your dbapi2 code still work. Or from
>
> >>> from StringIO import StringIO
On Mar 14, 5:30 pm, Nick Craig-Wood wrote:
> BeniCherniavsky wrote:
> > This proposal outrageously suggests a special syntax for in-line
> > functions passed as keyword arguments::
>
> > >>> sorted(range(9), key(n)=n%3)
> > [0, 3, 6, 1, 4, 7, 2, 5, 8]
>
> > The claim is that such spec
This proposal (a) ignores Guido's clear-cut decision that lambda is
good as it is, (b) is weird in proposing a special-case syntax, (c) is
several Python versions too late for a graceful transition by 3.0.
But I don't won't to just throw the idea away, so I'm posting here.
If there is serious posit
#x27;-le' and '-be' variats, I suppose. Should there be a
variant without explicit endianity, using a BOM to decide (like
'utf-16')?
And it should combine surrogates into valid characters (on all builds),
like the 'utf-8' codec does, right?
--
Beni Cherniavsky &l
Alexander Schmolck wrote:
"Raymond Hettinger" <[EMAIL PROTECTED]> writes:
The rationale is to replace the awkward and slow existing idioms for dictionary
based accumulation:
d[key] = d.get(key, 0) + qty
d.setdefault(key, []).extend(values)
Indeed not too readable. The try..except version is
11 matches
Mail list logo