SpreadTooThin wrote:
> > that's trivial to do with slicing, of course. what makes you think you
> > need to do this by calling the "sort" method ?
> >
> >
>
> You are of course correct.. There might be a way to do this with
> slicing
> and i % 3
Slicing will work only with a sorted list.
--
SpreadTooThin wrote:
> I have a list and I need to do a custom sort on it...
>
> for example:
> a = [1,2,3,4,5,6,7,8,9,10] #Although not necessarily in order
>
> def cmp(i,j): #to be defined in this thread.
>
> a.sort(cmp)
>
> print a
> [1,4,7,10, 2,5,8, 3,6,9]
>
> So withouth making this into a
I think this is obviously great in interactive mode and would also be
very good in the early stages of developing if you have several sources
files. A little error prone maybe, and should be avoided in
"production" code I suppose. (I would like to track each name exactly,
on each installation of py
hing, Python's logic notation is readable
and complete but not compact. (which is fine for programming, and
that's the aim, isn't it?)
Bjoern Schliessmann wrote:
> Saizan wrote:
>
> > (However (not x) whould be as annoying as 1-x even if a little
> > more readable (if
John Roth wrote:
> The not operator and the bool() builtin produce
> boolean results. Since bool is a subclass of int,
> all the integer operations will remain integer
> operations. This was done for backwards
> compatability, and is unlikely to change in the 2.x
> series.
Ok, shame on me, I com
Bjoern Schliessmann wrote:
> Saizan wrote:
>
> > Why subclassing bool from int either __invert__ or __neg__ haven't
> > been overrided to produce a boolean negation?
>
> I wonder what -True or -False should evaluate to.
>
> Regards,
>
>
> Björn
>
&
Why subclassing bool from int either __invert__ or __neg__ haven't been
overrided to produce a boolean negation? I suspect backwards
compatibility or something alike, but I still wonder..
And since bool can't be subclassed, to have a type like bool but with
boolean negation what do you suggest? A
I embedded an Rpyc threaded server in a preexistent daemon (an irc
bot), this is actually very simple;
start_threaded_server(port = DEFAULT_PORT)
then I had the necessity to stop the thread which accept() new
connections without killing the whole app, the thread is simply a while
True that spawn
Thanks, I had completely missed the module traceback...
I'll use traceback.print_exc(), it seems the most straightforward way.
The only flaw is that the traceback starts in the method where i catch the
exception and not from "__main__", but I guess it can't be helped.
--
http://mail.python.org/ma
In an event-driven application i'd like to keep the program alive regardless of
any exceptions raised by the handlers,
but still be able to debug them by reading the appropriate TraceBack from
stderr.
I can put something like:
try:
self.call_handler(handler,*args)
except Exception, e:
10 matches
Mail list logo