Jach Feng writes:
>> > s = "Jack Brandom"
>> > s[3 : -13 : -1]
>> >> 'kcaJ'
>> >> I have no idea how to replace that -13 with a positive index. Is it
>> >> possible at all?
> That's not possible because a positive index is relative to the leftmost item > 0
And the middle index is al
I have 16 values of the period sequence 1, 2, 4, 8, 1, 2, 4, 8, ... I
compute its fourier transform using
>>> from scipy import fft, ifft
>>> x = [1,2,4,8,1,2,4,8]
>>> fft(x)
array([ 30. +0.j, 0. +0.j, -6.+12.j, 0. +0.j, -10. +0.j, 0. +0.j,
-6.-12.j, 0. +0.j])
Now how can I plot
Peter Otten <__pete...@web.de> writes:
> Boris Dorestand wrote:
>
>> Say we have [1,3,5,7], [2,3], [1,10]. I'd like to generate
>>
>> [1,2,1]
>> [1,2,10]
>> [1,3,1]
>> [1,3,10]
>> [3,2,1]
>> [3,2,10]
>> [3,3,
Say we have [1,3,5,7], [2,3], [1,10]. I'd like to generate
[1,2,1]
[1,2,10]
[1,3,1]
[1,3,10]
[3,2,1]
[3,2,10]
[3,3,1]
[3,3,10]
[5, ...]
...
[7,3,10]
The number of input lists is variable. The example shows three lists,
but there could be only one or ten lists or any other
David Raymond writes:
>> This is true. I have written 0 as false in C so many times. But
>> clearly for me times have changed... I now look at numbers as a thing
>> in their own special class not to be confused as truth-values. (So much
>> so that I fell for this.) But I confess I still thin
Chris Angelico writes:
[...]
>> Anyway, I kind of replied just to thank you all for the great group this
>> is. ChrisA, I don't know how can keep up with this newsgroup, but you
>> do. This is crazy. Years go by and when I come back, there you are
>> still. You're priceless.
>
> You're most
Chris Angelico writes:
> On Sun, Jun 21, 2020 at 2:02 AM Boris Dorestand
> wrote:
>>
>> I just wrote
>>
>> def f(y, N, k = None):
>> k = k or (N - 1)
>> return k
>>
>> I was surprised to find out that 0 == False, so f(7, 31, 0) pr
I just wrote
def f(y, N, k = None):
k = k or (N - 1)
return k
I was surprised to find out that 0 == False, so f(7, 31, 0) produces 31.
I'd like 0 to be a valid choice for k.
How do you guys let k be an optional argument such that it defaults to
N - 1?
Thank you.
--
https://mail.pytho
Boris Borcic wrote:
Rustom Mody wrote:
def fl1(l): return [y for x in l for y in x]
# recursive flatten
def fr(l):
... if not isinstance(l,list): return [l]
... return fl1([fr(x) for x in l])
For a short non-recursive procedure - not a function, modifies L in-place but
none of its
Rustom Mody wrote:
def fl1(l): return [y for x in l for y in x]
# recursive flatten
def fr(l):
... if not isinstance(l,list): return [l]
... return fl1([fr(x) for x in l])
For a short non-recursive procedure - not a function, modifies L in-place but
none of its sublists.
>>> def flat
You can use [random.random() * 5 for x in range(100)] but works only
on range [0, 5). If you want to include 5, you will need more code.
Cheers,
FELD Boris
2013/3/12 Norah Jones :
> I want to create a random float array of size 100, with the values in the
> array ranging from 0 to 5.
2013/1/13 Tim Chase :
> On 01/13/13 06:45, subhabangal...@gmail.com wrote:
>
SIZE = 3
for i in range(len(list1)//SICE):
> ... print list1[i*SIZE:i*SIZE+SIZE]
> ...
> [1, 2, 3]
> [4, 5, 6]
> [7, 8, 9]
> [10, 11, 12]
>
A little shorter and simpler version:
>>> x = x[1:]
>>> for i in ra
How are you importing unittest2, do you have something like this ?
try:
import unittest2 as unittest
except ImportError:
import unittest
If it's the case, you are maybe using default unittest while you think
you are using unittest2.
2012/12/13 Daniel Laird :
> On Thursday, December 13, 2012
Don't think that it's possible with webbrowser, you should try with Selenium.
For example with sst (Simple Selenium Test), it open url in current
tab or create a new one if no one exists:
from sst.actions import *
go_to('http://www.ubuntu.com/')
2012/12/10 Jabba Laci :
> Hi,
>
> With the webbrow
Did you take a look at https://www.shiningpanda-ci.com/?
2012/10/19 andrea crotti :
> 2012/10/19 Michele Simionato :
>> Yesterday I released a new version of the decorator module. It should run
>> under Python 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3. I did not have the will
>> to install on my ma
You can try appaccelerator, it seems to support python and you should be
able to access geolocalisation (according to wikipedia:
https://en.wikipedia.org/wiki/Appcelerator_Titanium)
Le 15 avril 2012 16:44, Noam Peled a écrit :
> I want to write an Android application using Python. I've found 2 o
Hello,
I am new to Python and I hope my question makes sense. We are trying to
make PDFs 508 Compliant, meaning that the objects within them have to be
tagged. The problem is that we have hundreds, and potentially thousands
of PDFs, since they are automated reports that we create on a regular
b
A good tutorial will surely help :
http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/
The idea between *args and *kwargs is to create function (callables) which
accepts an arbitrary number of anonymous and/or keyword arguments.
It's useful when you want to create a fu
's an excellent idea and, when the tutorials were expanded
enough, i should be good to integrate it with python.org website (but it's more
a dream than something else...)
One question, if i want to write a tutorial about import mechanism, how can i
manage the file system ?
Nice work !
--
Cobra seems interessant, open-source, but the dependance on Mono and
.Net annoy me a bit.
Otherwise, cobra have good ideas, a syntax similar to python.
One thing i really love is the "How-To" and the "Samples" pages on
it's website, i think it's a very good thing fo
Take a look at :
http://ipython.scipy.org/doc/manual/html/interactive/tutorial.html#use-your-input-history
Cheers,
FELD Boris
--
FELD Boris
Sent with Sparrow
On vendredi 25 mars 2011 at 22:03, Ken D'Ambrosio wrote:
> Hey, all. A co-worker asked me a question, and I've got no idea
If you're using argparse, you have a method for that named
"add_mutually_exclusive_group". Tutorial :
http://www.doughellmann.com/PyMOTW/argparse/#mutually-exclusive-options
Cheers,
Feld Boris
2011/3/23 T :
> For a Python script with multiple command line options, what is th
n.org/library/socketserver.html). I'm not sure about
how shelve manage concurrency, but in my opinion, you'll need to
create a single process or thread which manage read and write
operation in order to avoiding race conditions.
Cheers,
Feld Boris
2011/3/23 T :
> Hello all, I am writing
Yes, i did not mention this solution, using virtualenv is a very good practice,
but before create a virtualenv with a specific version of python, you must have
installed it globally, isn't it ?
Regards,
--
FELD Boris
Sent with Sparrow
On lundi 21 mars 2011 at 14:45, macm wrote:
> On M
lation.
No specific problem, i use these Python versions without any problem on mac os
x : 2.5, 2.6, 2.7, 3.0, 3.1, 3.2.
--
FELD Boris
Sent with Sparrow
On lundi 21 mars 2011 at 13:31, Robert wrote:
> Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> without them st
Terry Reedy wrote:
The straightforward code
if a in L and b in L and c not in L and d not in L
scans the list 4 times.
of course for a single scan one can setify the list and write
S=set(L)
if a in S and b in S and c not in S and d not in S
or even, I guess, something like
{a,b} <= S and
I think the best way to do this is using css with specific media
type.Take a look at : http://martybugs.net/articles/print.cgi
-- FELD BorisSent with Sparrow
On dimanche 21 novembre 2010 at 03:35, Hidura wrote:
Arnaud Delobelle wrote:
macm writes:
Hi Folks
How convert list to nested dictionary?
l
['k1', 'k2', 'k3', 'k4', 'k5']
result
{'k1': {'k2': {'k3': {'k4': {'k5': {}}
Regards
macm
reduce(lambda x,y: {y:x}, reversed(l), {})
d={}
while L : d={L.pop():d}
--
http://mail.python.org/
Lawrence D'Oliveiro wrote:
flebber wrote:
Has anyone had much success with python macro's. Or developing powerful
macro's in an language?
I did an application for my own use recently, involving automatically
generating invoices in editable OOWriter format from my billing database. I
gave up o
candide wrote:
So what is the right way to initialize to 0 a 2D array ? Is that way
correct :
>>> t=[[0 for _ in range(2)] for _ in range(3)]
That's overkill :) You can skip the inner loop by using a list display, eg
t=[[0,0] for _ in range(3)]
It seems there is no more trouble now :
Ignacio Mondino wrote:
On Tue, Jun 15, 2010 at 8:49 AM, superpollo wrote:
goal (from e.c.m.): evaluate
1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three
consecutive + must be followed by two - (^ meaning ** in this context)
my solution:
s = 0
for i in range(1, 2011):
...
>On Dec 23, 5:22 pm, Sean DiZazzo wrote:
> On Dec 23, 1:57 pm, tekion wrote:
>
>
>
> > All,
> > some of the servers I have run python 2.2, which is a drag because I
> > can't use subprocess module. My options that I know of is popen2
> > module. However, it seems it does not have io blocking
>
with a -OO compile.
Anyone can comment, please?
Thanks,
Boris
--
http://mail.python.org/mailman/listinfo/python-list
eed string ...
Suggestions are appreciated! boris
--
http://mail.python.org/mailman/listinfo/python-list
kill for defunct children after a time.sleep(0.5); allow
dependent processes to complete their job before totally closing down the
request.
4. Report os errors as exceptions; but not errno.ECHILD, which means trying to
kill none existing child; keep this as a warning.
This is more suscinct code a
I agree there is no rap against "while True"-loops. As an example these are
very useful especially when receiving continuous data over a queue, pipe
socket, or over any other connection. You set to block, receive data,
then process data and finally loop around to wait for next data segment. O
Sverker Nilsson wrote:
Sverker Nilsson wrote:
It reads one Stat object at a time and wants to report something
when there is no more to be read from the file.
Hmm, am I right in thinking the above can more nicely be written as:
>>> from guppy import hpy
>>> h = hpy()
>>> f = open(r'your.hp
y I could define an abstract method
within a metaclass and have it behave with abstraction when the class is
created off the metaclass?
I other words, I want to force an implementation of cls_abc() method when
MyKlass(object): __metaclass__ = MetaExample is declared, or else get
NotImplement
Raymond Hettinger wrote:
There is a natural inclination to do the opposite. We factor code
to eliminate redundancy, but that is not always a good idea with
an API. The goal for code factoring is to minimize redundancy.
The goal for API design is having simple parts that are easily
learned and c
reby I will try to create class objects on
the fly at runtime out of nothing; or almost nothing.
I can attach my code if necessary, but as indicated it is identical to LaCour's
in the article with the necessary syntax changes for python 3.0.
Thanks
Boris
--
http://mail.python.org/mailman/listinfo/python-list
Ross wrote:
If I have a list of tuples a = [(1,2), (3,4), (5,6)], and I want to
return a new list of each individual element in these tuples, I can do
it with a nested for loop but when I try to do it using the list
comprehension b = [j for j in i for i in a], my output is b =
[5,5,5,6,6,6] inste
Armin wrote:
Why on earth would you want to? That'd be like translating Shakespeare
into a bad rap song!
lol, actually I would prefer a rap song over Shakespeare, so your analogy
doesn't work there ;)
Why, some people do prefer Perl over Python, so what's wrong with the analogy ?
--
http
seconded.
--
http://mail.python.org/mailman/listinfo/python-list
Python Nutter wrote:
Looks like we finally get tkinter GUI based programs according to
Issue# 2983 in Python 3.1a so our programs don't look like something
out of early 1980's
Please don't confuse History gratuitously. Make that mid 90's.
Cheers, BB
--
http://mail.python.org/mailman/listinfo/
Chris Rebert wrote:
On Thu, Feb 26, 2009 at 3:05 AM, Clarendon wrote:
...
L=['a', 'b', 'c', 'a']
I want to delete all 'a's from the list.
But if L.remove('a') only deletes the first 'a'.
How do you delete all 'a's?
There are several ways. I'd go with a list comprehension:
and for a coupl
itlist[i] = (x+(i*10) for i,s in (i,count()) for x in s)
oops, that would be
itlist[i] = (x+(i*10) for i,s in [(i,count())] for x in s)
or equivalent, kind of ugly anyway.
--
http://mail.python.org/mailman/listinfo/python-list
The minimal correction, I guess, is to write
itlist[i] = (x+(i*10) for i in [i] for x in count())
instead of
itlist[i] = (x+(i*10) for x in count())
although
itlist[i] = (x+(i*10) for i,s in (i,count()) for x in s)
will better mimic generalizations in the sense that the "minimal cor
Tim Chase wrote:
success = None
for i in range(5):
#Try to fetch public IP
success = CheckIP()
if success:
break
if not success:
print "Exiting."
sys.exit()
Though a bit of an abuse, you can use
if not any(CheckIP() for _ in range(5)):
print "Exiting"
sys.e
Tim Chase wrote:
success = None
for i in range(5):
#Try to fetch public IP
success = CheckIP()
if success:
break
if not success:
print "Exiting."
sys.exit()
Though a bit of an abuse, you can use
if not any(CheckIP() for _ in range(5)):
print "Exiting"
sys
Chris Rebert wrote:
On Wed, Oct 22, 2008 at 12:59 PM, Henry Chang <[EMAIL PROTECTED]> wrote:
This seems like a simple problem, but I can't find a simple solution.
Suppose I have two lists of integers.
List A = [A1, A2, A3]
List B = [B1, B2, B3]
I just simply want a new list, such as:
List C
Kirk Strauser wrote:
While we're on
the subject, use keyword arguments to dict like:
foo.update(dict(quux='blah', baz='bearophile', jdd='dict'))
was *much* slower, at 11.8s.
Presumably you would save half of that time by writing simply
foo.update(quux='blah', baz='bearophile', jdd
Terry Reedy wrote:
Boris Borcic wrote:
...
- allowing containment tests, ie "x in Number" to invoke isinstance()
in the background when the container is of type . My brain is
too muddled by flu at the moment, to see whether Guido's fabled time
machine allowed him to already
Bruno Desthuilliers wrote:
[EMAIL PROTECTED] a écrit :
...
A intriguing wider proposition would be to transpose Ruby's notion of
"Open Classes" to Python built-in metaclasses (or just to type
itself ?).
No, thanks. Even the Ruby guys start to think making evrything open may
not be such a goo
Bruno Desthuilliers wrote:
Boris Borcic a écrit :
Given the ABC innovation, maybe an infix syntax for isinstance() would
be good.
Possibilities :
- stealing "is" away from object identity. As a motivation, true use
cases for testing object identity are rare;
"x is None"
Given the ABC innovation, maybe an infix syntax for isinstance() would be good.
Possibilities :
- stealing "is" away from object identity. As a motivation, true use cases for
testing object identity are rare; forcing the usage of a function or method to
test it, would dissuade abuse.
- allow
42, for instance.
Proof :
>>> 42 is not object
True
QED
--
http://mail.python.org/mailman/listinfo/python-list
Gerard flanagan wrote:
George Sakkis wrote:
..
Note that this works correctly only if the versions are already sorted
by major version.
Yes, I should have mentioned it. Here's a fuller example below. There's
maybe better ways of sorting version numbers, but this is what I do.
Indeed, you
cnb wrote:
this recursive definition of sum thrumped me, is this some sort of
gotcha or am I just braindead today?
and yes i know this is easy a a for x in xs acc += x or just using the
builtin.
def suma(xs, acc=0):
if len(xs) == 0:
acc
else:
suma(
Why don't you use import and __import__() ? - They seem designed for such an
application.
I mean, I am not against vicious hacks for the fun of them, but not if they
serve the illusion that what they do can't (easily) be achieved other ways.
Cheers, BB
Peter Waller wrote:
Dear Pythoners,
I
I wrote:
Tino Wildenhain wrote:
[...]
sum(['a','b'],'')
: sum() can't sum strings [use
''.join(seq) instead]
Yes which is a bit bad anyway. I don't think hard wiring it is such a
nice idea. You know, walks like a duck, smells like a duck...
If it makes sense to handle things differently
Tino Wildenhain wrote:
Hi,
Luis Zarrabeitia wrote:
Quoting Laszlo Nagy <[EMAIL PROTECTED]>:
...
Even better:
help(sum) shows
===
sum(...)
sum(sequence, start=0) -> value
Returns the sum of a sequence of numbers (NOT strings) plus
the value
of parameter 'start'. When the
castironpi wrote:
On Sep 8, 8:54 am, Boris Borcic <[EMAIL PROTECTED]> wrote:
David C. Ullrich wrote:
(ii) If A is a subset of B then we should have
max(A) <= max(B). This requires that max(empty set)
be something that's smaller than everything else.
So we give up on that.
David C. Ullrich wrote:
(ii) If A is a subset of B then we should have
max(A) <= max(B). This requires that max(empty set)
be something that's smaller than everything else.
So we give up on that.
Er, what about instances of variations/elaborations on
class Smaller(object) : __cmp__ = lambda
D,T=[dict((x.split('.')[0],x) for x in X) for X in (dat,txt)]
for k in sorted(set(D).union(T)) :
for S in D,T :
print '%-8s' % S.get(k,'None'),
print
HTH
W. eWatson wrote:
Maybe there's some function like zip or map that does this. If not, it's
probably fairly easy to do with pu
Alexnb wrote:
Uhm, "string" and "non-string" are just that, words within the string. Here
shall I dumb it down for you?
string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
text6 no text7 yes text8"
It doesn't matter what is in the string, I want to be able to know exactly
Is your product ID always the 3rd and last item on the line ?
Else your output won't separate IDs.
And how does
output = open(output_file,'w')
for x in set(line.split(',')[2] for line in open(input_file)) :
output.write(x)
output.close()
behave ?
[EMAIL PROTECTED] wrote:
I have a csv fil
Pierre Dagenais wrote:
What is the easiest way to draw to a window? I'd like to draw something
like sine waves from a mathematical equation.
Newbie to python.
--
http://mail.python.org/mailman/listinfo/python-list
For very simple things, the standard module turtle might be your best bet.
BB
John Machin wrote:
Instead of sum(a + b for a, b in zip(foo, bar))
why not use sum(foo) + sum(bar)
?
or even sum(foo+bar) as may apply.
Cheers, BB
--
http://mail.python.org/mailman/listinfo/python-list
Yves Dorfsman wrote:
So would it be a worthy addition to python, to add it right in the core
of the language, and hopefully in an efficient manner ?
Note that the s[0,2:6] syntax is currently allowed because of the distinct
semantics that the Numeric module and its successors numarray and
One way :
>>> from functools import partial
>>> def func(item) : print item
>>> llist = [partial(func,item) for item in range(5)]
>>> for thing in llist : thing()
0
1
2
3
4
wyleu wrote:
I'm trying to supply parameters to a function that is called at a
later time as in the code below:
llist
Duncan Booth wrote:
Torsten Bronger <[EMAIL PROTECTED]> wrote:
The biggest ugliness though is ",".join(). No idea why this should
be better than join(list, separator=" "). Besides, ",".join(u"x")
yields an unicode object. This is confusing (but will probably go
away with Python 3).
It is o
Marc 'BlackJack' Rintsch wrote:
On Fri, 02 May 2008 19:19:07 +1000, Astan Chee wrote:
Hi,
Im not sure if this is more of a math question or a python question. I
have a variable in python:
>>> v = 10.0**n
is there a way to find the value of n if i know only v aside from
str(v).split('+')[1]
Paul Hankin wrote:
> On Mar 10, 3:12 am, George Sakkis <[EMAIL PROTECTED]> wrote:
>> On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>> On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote:
Someone knows if it's possible to make this __iter__ function with just
one 'yie
D'Arcy J.M. Cain wrote:
>> I find I hit it mostly with calls to map() where I want to apply
>> some transform (as above) to all the items in a list of
>> parameters such as
>>
>>"%s=%s&%s=%s" % map(urllib.quote, params)
>
> Isn't map() deprecated? The above can be done with;
>
> "%s=%s
Paul Rubin wrote:
> Russell Warren <[EMAIL PROTECTED]> writes:
>> That is exactly where I started (creating my own request handler,
>> snagging the IP address and stashing it), but I couldn't come up with
>> a stash location that would work for a threaded server.
>
> How about a dictionary indexed
TeroV wrote:
> It isn't list comprehension, it is generator expression
> http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Generator_expressions
Nice. :)
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> if any(x[0]==element[0] for x in a):
How come this list comprehension isn't in [] brackets?
--
http://mail.python.org/mailman/listinfo/python-list
Preston Landers wrote:
> Shift-Tab does it for me. It can also dedent whole blocks if you have
> them selected.
Excellent. Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
Hi
Suppose I have three blocks:
if 1:
if 2:
if 3:
# here I want my cursor go back to second block (if 2:)
What is the standard shortcut for this? ctrl+arrow keys aren't, arrow keys
alone aren't either.
--
http://mail.python.org/mailman/listinfo/python-li
Duncan Booth wrote:
> Boris Borcic <[EMAIL PROTECTED]> wrote:
>> Arnaud Delobelle wrote:
>>> Whereas when "3.0*1.0 is 3.0" is evaluated, *two* different float
>>> objects are put on the stack and compared (LOAD_CONST 3 / LOAD_CONST
>>> 1 / COM
Arnaud Delobelle wrote:
> On Feb 13, 10:19 pm, Tobiah <[EMAIL PROTECTED]> wrote:
> print float(3.0) is float(3.0)
>> True
> print float(3.0 * 1.0) is float(3.0)
>> False
>
> [You don't need to wrap your floats in float()]
>
def f():
> ... return 3.0 is 3.0, 3.0*1.0 is 3.0
> ...
>
Duncan Booth wrote:
> In this particular case I think the lambda does contribute to the
> obfuscation. Yes, they are single expressions, but only because that
> have been contorted to become single expressions. The first two return
> generators, so if you don't force them into a lambda you can wr
Duncan Booth wrote:
> Boris Borcic <[EMAIL PROTECTED]> wrote:
>
>> It is more elementary in the mathematician's sense, and therefore
>> preferable all other things being equal, imo. I've tried to split
>> 'gen' but I can't say the result is s
Arnaud Delobelle wrote:
> On Feb 17, 4:03 pm, Boris Borcic <[EMAIL PROTECTED]> wrote:
>> George Sakkis wrote:
>>> On Feb 17, 7:51 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>>>> BTW, I keep using the idiom itertools.chain(*iterable). I guess that
George Sakkis wrote:
> On Feb 17, 7:51 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>
>> BTW, I keep using the idiom itertools.chain(*iterable). I guess that
>> during function calls *iterable gets expanded to a tuple. Wouldn't it
>> be nice to have an equivalent one-argument function that ta
Arnaud Delobelle wrote:
>
> In Python you can do anything, even
...pass the Turing test with a one-liner. Back after 9/11, when US patriotism
was the rage, Python knew how to answer correctly the query
filter(lambda W : W not in 'ILLITERATE','BULLSHIT')
And Python 3.0 slated for next August o
[EMAIL PROTECTED] wrote:
> On Feb 16, 3:47 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>> Hi all,
>>
>> Recently there was a thread about function composition in Python (and
>> this was probably not the first). The fast way to create a
>> (anonymous) composite function
>>
>> f1 o f2 o ...
Steve Holden wrote:
> Boris Borcic wrote:
>> [EMAIL PROTECTED] wrote:
>>> ...Missing that, I think dict() and set() and
>>> tuple() and list() look better than using {} for the empty dict and
>>> {/} for the empty set and () for empty tuple (or {} for the empty
[EMAIL PROTECTED] wrote:
>
> ...Missing that, I think dict() and set() and
> tuple() and list() look better than using {} for the empty dict and
> {/} for the empty set and () for empty tuple (or {} for the empty dict
> and set() for the empty set).
The problem I have with them is in no way the l
Boris Borcic wrote:
> Arnaud Delobelle wrote:
> (...)
>>
>> from itertools import chain
>>
>> def overlaps(lst):
>> bounds = chain(*(((x[1],i), (x[2], i)) for i,x in enumerate(lst)))
>
> imho, this is a uselessly painful equivalent of
>
>
Arnaud Delobelle wrote:
(...)
>
> from itertools import chain
>
> def overlaps(lst):
> bounds = chain(*(((x[1],i), (x[2], i)) for i,x in enumerate(lst)))
imho, this is a uselessly painful equivalent of
bounds = ((x[k],i) for i,x in enumerate(lst) for k in (1,2))
Cheers, BB
--
http:
[EMAIL PROTECTED] wrote:
> On Feb 5, 12:26 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>> On 5 feb, 03:46, [EMAIL PROTECTED] wrote:
>>
>>> Some timing stats: On Windows XP, Python 3.0a2.
(...)
>>> Are threads an OS bottleneck?
>> I don't understand your threading issues, but I would not use 3.
washakie wrote:
> Hello,
>
> I have a list of datetime objects: DTlist, I have another single datetime
> object: dt, ... I need to find the nearest DTlist[i] to the dt is
> there a simple way to do this? There isn't necessarily an exact match...
>
> Thanks!
> .john
>
min(DTlist,key=lambd
Wish you'd opted out of typing all that static.
BB
Russ P. wrote:
(...)
>
> What is that supposed to mean?
>
> Oh, I almost forgot. I'm supposed to sit here and be polite while
> clueless dolts make wise cracks. Sorry, but I haven't yet mastered
> that level of self-control.
>
> I would just l
Now there's always that style :
>>> print x
Traceback (most recent call last):
File "", line 1, in
eval(x)
File "", line 2
Traceback (most recent call last):
^
SyntaxError: invalid syntax
>>> eval(x)
Traceback (most recent call last):
File "", lin
er for unknowns. Returns same with values filled in.
>
> Beware that although in practice it solved all well-formed
> human-solvable problems I could find, it is not guaranteed to deal
> properly (or even terminate?) for underdetermined problems or determined
> problems that wou
for
unknowns. Returns same with values filled in.
Beware that although in practice it solved all well-formed human-solvable
problems I could find, it is not guaranteed to deal properly (or even
terminate?) for underdetermined problems or determined problems that would
require exploring choicepoin
I am surprised nobody pointed out explicitely that
True==1 and False==0
so that for instance
5*(True+True)==10
and even (but implementation-dependent) :
5*(True+True) is 10
BB
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I'm using debian linux, Python 2.4.4, and utidylib (http://
utidylib.berlios.de/). I wrote simple functions to get a web page,
convert it from windows-1251 to utf8 and then I'd like to clean html
with it.
Here is two pages I use to check my program:
http://www.ya.ru/ (in this case everythin
Carl K wrote:
> Rob Wolfe wrote:
>> Carl K <[EMAIL PROTECTED]> writes:
>>
>>> I need to take the take the pdf output from reportlab and create a
>>> preview image for a web page. so png or something. I am sure
>>> ghostscript will be involved. I am guessing PIL or ImageMagic ?
>>>
>>> all sugesti
1 - 100 of 295 matches
Mail list logo