Re: Last iteration?

2007-10-17 Thread Raymond Hettinger
> def lastdetecter(iterable): > "fast iterator algebra" > lookahead, t = tee(iterable) > lookahead.next() > t = iter(t) > return chain(izip(repeat(False), imap(itemgetter(1), > izip(lookahead, t))), izip(repeat(True),t)) More straight-forward version: d

Re: how to get my own namespace ?

2007-10-17 Thread Peter Otten
stef mientki wrote: > I want to view my own namespace, > i.e. to see the modules namespace in the module itself, > is that possible ? > > I can use >dir() > but I read dir is just a convenience function, > and besides I want key/value pairs. Use globals() or vars(). Peter -- http://mail.py

Re: Static variable vs Class variable

2007-10-17 Thread paul . melis
On Oct 10, 8:23 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > However, it is not true that += "always leads to a rebinding of a to the > > result of the operation +". The + operator for lists creates a new list. > > += for lists does an in-place modification: > > It still is true. > > a +=

Re: Simple HTML template engine?

2007-10-17 Thread Adrian Cherry
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > Did you read the OP's question ?-) Yup, as much as anyone else has. Why? Adrian -- http://mail.python.org/mailman/listinfo/python-list

Re: Static variable vs Class variable

2007-10-17 Thread Marc 'BlackJack' Rintsch
On Wed, 17 Oct 2007 00:33:59 -0700, paul.melis wrote: > On Oct 10, 8:23 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> > However, it is not true that += "always leads to a rebinding of a to the >> > result of the operation +". The + operator for lists creates a new list. >> > += for lists do

Re: Static variable vs Class variable

2007-10-17 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > On Oct 10, 8:23 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> rebinds a. Period. Which is the _essential_ thing in my post, because >> this rebinding semantics are what confused the OP. > > Doesn't this depend on wether "a" supports __iadd__ or not? Section > 3.

Re: Static variable vs Class variable

2007-10-17 Thread paul . melis
On Oct 17, 10:00 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Oct 10, 8:23 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > >> rebinds a. Period. Which is the _essential_ thing in my post, because > >> this rebinding semantics are what confused the OP. > > > D

Re: Last iteration?

2007-10-17 Thread Peter Otten
Raymond Hettinger wrote: > [Diez B. Roggisch] >> > out:) But I wanted a general purpose based solution to be available that >> > doesn't count on len() working on an arbitrary iterable. > > [Peter Otten] >> You show signs of a severe case of morbus itertools. >> I, too, am affected and have not y

Re: Capturing OutputDebugString information in python

2007-10-17 Thread Tim Golden
danbrotherston wrote: > I am trying to get the output from the win32 platform command > OutputDebugString. I have used the following C++ code as a > guideline: > > http://groups.google.com/group/microsoft.public.vc.utilities/browse_frm/thread/1434418cb968d053/1a3c957675242c7e?lnk=st&q=DBWIN_BUFFE

Re: Static variable vs Class variable

2007-10-17 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Curious, do you have the relevant section in the docs that describes > this behaviour? Yes, but mostly by implication. In section 3.4.7 of the docs, the sentence before the one you quoted says: These methods should attempt to do the operation in-place (modifying

Re: Static variable vs Class variable

2007-10-17 Thread paul . melis
On Oct 17, 11:08 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Curious, do you have the relevant section in the docs that describes > > this behaviour? > > Yes, but mostly by implication. In section 3.4.7 of the docs, the sentence > before the one you quoted says: > >

Re: Static variable vs Class variable

2007-10-17 Thread Hrvoje Niksic
[EMAIL PROTECTED] writes: > Right, the paragraph is actually pretty clear after a second > reading. I find it surprising nonetheless, as it's easy to forget > to return a result when you're implementing a method that does an > in-place operation, like __iadd__: I've recently been bitten by that,

Re: Python's coming... from unexpected angles.

2007-10-17 Thread Eric Brunel
On Tue, 16 Oct 2007 13:19:26 +0200, Ben Finney <[EMAIL PROTECTED]> wrote: > "Eric Brunel" <[EMAIL PROTECTED]> writes: > >> Well, I'd definetely vote for a name change for PyPy, as in french, >> it's pronounced "pee-pee", and yes, it means what you think it >> means... ;-) > > Does that mean you

UK Jobs With VISA Sponsorship

2007-10-17 Thread Devender.Kumar
Hi, Can u let me please about UK work Permit and Job..right now am in Norway and holding Schengen Visa Bye Devender Kumar 0047 96813328 This e-mail and any attachment are confidential and may be privileged or otherwise protected from disclosure. It is solely intende

Re: negative base raised to fractional exponent

2007-10-17 Thread Steve Holden
John Machin wrote: > On Oct 17, 8:03 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> Does anyone know of an approximation to raising a negative base to a >>> fractional exponent? For example, (-3)^-4.1 since this cannot be >>> computed without using imaginary numbers

Re: Last iteration?

2007-10-17 Thread Paul Hankin
On Oct 17, 8:16 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > def lastdetecter(iterable): > > "fast iterator algebra" > > lookahead, t = tee(iterable) > > lookahead.next() > > t = iter(t) > > return chain(izip(repeat(False), imap(itemgetter(1), > >

Re: NUCULAR fielded text searchable indexing

2007-10-17 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Oct 8, 7:00 pm, "Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> > wrote: >> [EMAIL PROTECTED] wrote: >>> ANNOUNCE: >>> NUCULAR fielded text searchable indexing >> Does "NUCULAR" stand for anything? The (apparent) misspelling of >> "nuclear" has already turned me off wan

Inheriting automatic attributes initializer considered harmful?

2007-10-17 Thread Thomas Wittek
Hi! I'm relatively new to Python, so maybe there is an obvious answer to my question, that I just didn't find, yet. I've got quite some classes (from a data model mapped with SQL-Alchemy) that can be instatiated using kwargs for the attribute values. Example: class User(object): def __in

Re: Static variable vs Class variable

2007-10-17 Thread Duncan Booth
Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > >> Right, the paragraph is actually pretty clear after a second >> reading. I find it surprising nonetheless, as it's easy to forget >> to return a result when you're implementing a method that does an >> in-place operation,

Re: Static variable vs Class variable

2007-10-17 Thread Hrvoje Niksic
Duncan Booth <[EMAIL PROTECTED]> writes: > Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > >> I've recently been bitten by [rebinding the var to what __iadd__ >> returns], and I don't understand the reasoning behind __iadd__'s >> design. I mean, what is the point of an *in-place* add operation >> (and

Re: negative base raised to fractional exponent

2007-10-17 Thread schaefer . mp
On Oct 17, 4:05 am, Ken Schutte <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Does anyone know of an approximation to raising a negative base to a > > fractional exponent? For example, (-3)^-4.1 since this cannot be > > computed without using imaginary numbers. Any help is appreciat

Re: Newbi Q: Recursively reverse lists but NOT strings?

2007-10-17 Thread Bruno Desthuilliers
Paddy a écrit : >> > story stargaming, I caught it first this time !-) > Shouldn't that be s-o-r-r-y :-) Oui :( >> <*ot> > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Static variable vs Class variable

2007-10-17 Thread Marc 'BlackJack' Rintsch
On Wed, 17 Oct 2007 13:41:06 +0200, Hrvoje Niksic wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: > >> Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >> >>> I've recently been bitten by [rebinding the var to what __iadd__ >>> returns], and I don't understand the reasoning behind __iadd__'s >>> design

Displaying future times

2007-10-17 Thread ryan k
I have a schedule of times in the future that I want to display in a timezone the user sets. There is a useful module http://www.purecode.com/~tsatter/python/README.txt (at that URL) with a function that takes seconds from the epoch and a time zone and returns what is basically a datetime object.

Displaying future times

2007-10-17 Thread ryan k
I have a schedule of times in the future that I want to display in a timezone the user sets. There is a useful module http://www.purecode.com/~tsatter/python/README.txt (at that URL) with a function that takes seconds from the epoch and a time zone and returns what is basically a datetime object.

Re: Static variable vs Class variable

2007-10-17 Thread Steven D'Aprano
On Wed, 17 Oct 2007 13:41:06 +0200, Hrvoje Niksic wrote: > The current implementation of += uses __add__ for addition and __iadd__ > for addition that may or may not be in-place. I'd like to know the > rationale for that design. Everything you need is in the PEP: http://www.python.org/dev/peps/

Re: Static variable vs Class variable

2007-10-17 Thread Duncan Booth
Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > > The current implementation of += uses __add__ for addition and > __iadd__ for addition that may or may not be in-place. I'd like to > know the rationale for that design. > Apart from the obvious short answer of being consistent (so you don't have t

Re: Automatically organize module imports

2007-10-17 Thread Andrew Durdin
On 10/15/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > Pyflakes will tell you which imports aren't being used (among other > things). I don't know if an existing tool which will automatically > rewrite your source, though. I'll second that recommendation of Pyflakes -- as the interpreter

Re: Static variable vs Class variable

2007-10-17 Thread Duncan Booth
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > Simply not to introduce special cases I guess. If you write ``x.a += > b`` then `x.a` will be rebound whether an `a.__iadd__()` exists or > not. Otherwise one would get interesting subtle differences with > properties for example. If `x.a` is

Best Python Linux distribution

2007-10-17 Thread Anthony Perkins
Hi everyone, What is the best GNU/Linux distribution (or the most preferred) for developing Python applications? Ideally I would like one with both Python *and* IDLE included on the install media (neither Ubuntu nor SUSE have IDLE on the CDs), so that I can use it on machines without a networ

Re: Dynamic and lazy import

2007-10-17 Thread Alexandre Badez
Thanks for all your advices, but it's not really what I would like to do. I'm going to be more clearer for what I really want to do. Here we have got many library for different applications. All those library have a version and between a version and an other, there isn't always a very good backwa

Re: Displaying future times

2007-10-17 Thread Steven D'Aprano
On Wed, 17 Oct 2007 12:20:06 +, ryan k wrote: > I have a schedule of times in the future that I want to display in a > timezone the user sets. There is a useful module > http://www.purecode.com/~tsatter/python/README.txt (at that URL) with a > function that takes seconds from the epoch and a t

Re: Static variable vs Class variable

2007-10-17 Thread Paul Melis
On Oct 17, 2:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > Simply not to introduce special cases I guess. If you write ``x.a += > > b`` then `x.a` will be rebound whether an `a.__iadd__()` exists or > > not. Otherwise one would get inter

Re: Inheriting automatic attributes initializer considered harmful?

2007-10-17 Thread Andrew Durdin
On 10/17/07, Thomas Wittek <[EMAIL PROTECTED]> wrote: > > Writing such constructors for all classes is very tedious. > So I subclass them from this base class to avoid writing these constructors: > > class AutoInitAttributes(object): > def __init__(self, **kwargs): > for k, v in k

Re: Python's coming... from unexpected angles.

2007-10-17 Thread Ben Finney
"Eric Brunel" <[EMAIL PROTECTED]> writes: > On Tue, 16 Oct 2007 13:19:26 +0200, Ben Finney > <[EMAIL PROTECTED]> wrote: > > Does that mean you pronounce the word for the serpent as > > "pee-thon"? > > Yes. > > > Anyway, the pronunciation of "Python" (and hence the "Py" in > > "PyPy") is however

Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread schaefer . mp
To compute the absolute value of a negative base raised to a fractional exponent such as: z = (-3)^4.5 you can compute the real and imaginary parts and then convert to the polar form to get the correct value: real_part = ( 3^-4.5 ) * cos( -4.5 * pi ) imag_part = ( 3^-4.5 ) * sin( -4.5 * pi ) |z

Re: Displaying future times

2007-10-17 Thread ryan k
On Oct 17, 1:52 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 17 Oct 2007 12:20:06 +, ryan k wrote: > > I have a schedule of times in the future that I want to display in a > > timezone the user sets. There is a useful module > >http://www.purecode.com/~tsatter/pyt

Re: Inheriting automatic attributes initializer considered harmful?

2007-10-17 Thread Thomas Wittek
Andrew Durdin: >> Is there already a standard lib class doing (something like) this? >> Or is it even harmful to do this? > > It depends on your kwargs and where they're coming from. They should come from my own code. > Does SQLAlchemy let you get a list of column names? Generellay, it does. Bu

Re: Best Python Linux distribution

2007-10-17 Thread Rafał Zawadzki
Anthony Perkins wrote: > Hi everyone, > > What is the best GNU/Linux distribution (or the most preferred) for > developing Python applications? Ideally I would like one with both > Python *and* IDLE included on the install media (neither Ubuntu nor SUSE > have IDLE on the CDs), so that I can use

Re: Static variable vs Class variable

2007-10-17 Thread Paul Melis
On Oct 17, 3:20 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 17 Oct 2007 05:57:50 -0700, Paul Melis wrote: > > On Oct 17, 2:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > >> >>> class C(object): > > >> def setx(self, value): > >> if len(value)>2: > >>

Re: Static variable vs Class variable

2007-10-17 Thread Paul Melis
On Oct 17, 3:41 pm, Paul Melis <[EMAIL PROTECTED]> wrote: > On Oct 17, 3:20 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > On Wed, 17 Oct 2007 05:57:50 -0700, Paul Melis wrote: > > > On Oct 17, 2:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > > >> >>> class C(object): > > > >>

Order by value in dictionary

2007-10-17 Thread Abandoned
Hi.. I have a dictionary like these: a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 element I want to sort this by value and i want to first 100 element.. Result must be: [b, a, d, c .] ( first 100 element) I done this using FOR and ITERATOR but it tooks 1 second and this i

Write by logging.FileHandler to one file by many processess

2007-10-17 Thread Rafał Zawadzki
Hello. As I saw in logging source - there is no lock per file during making emit() (only lock per thread). So, my question is - is it safe to log into one file using many processess uses logging logger? Cheers, -- bluszcz http://vegan-planet.net -- http://mail.python.org/mailman/listinfo/pytho

Re: Static variable vs Class variable

2007-10-17 Thread Marc 'BlackJack' Rintsch
On Wed, 17 Oct 2007 05:57:50 -0700, Paul Melis wrote: > On Oct 17, 2:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: >> >>> class C(object): >> >> def setx(self, value): >> if len(value)>2: >> raise ValueError >> self._x = value >>

Re: Best Python Linux distribution

2007-10-17 Thread Joe Riopel
On 10/17/07, Anthony Perkins <[EMAIL PROTECTED]> wrote: > Hi everyone, > > What is the best GNU/Linux distribution (or the most preferred) for > developing Python applications? Ideally I would like one with both > Python *and* IDLE included on the install media (neither Ubuntu nor SUSE > have IDLE

Re: Dynamic and lazy import

2007-10-17 Thread Diez B. Roggisch
Alexandre Badez wrote: > Thanks for all your advices, but it's not really what I would like to > do. > > I'm going to be more clearer for what I really want to do. > > Here we have got many library for different applications. All those > library have a version and between a version and an other,

Re: Order by value in dictionary

2007-10-17 Thread Diez B. Roggisch
Abandoned wrote: > Hi.. > I have a dictionary like these: > a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 > element > I want to sort this by value and i want to first 100 element.. > Result must be: > [b, a, d, c .] ( first 100 element) > > I done this using FOR and ITERA

Re: Static variable vs Class variable

2007-10-17 Thread Hrvoje Niksic
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > Simply not to introduce special cases I guess. If you write ``x.a > += b`` then `x.a` will be rebound whether an `a.__iadd__()` exists > or not. Otherwise one would get interesting subtle differences with > properties for example. If `x.a`

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Just to clarify what I'm after: > If you plot (-3)^n where n is a set of negative real numbers between 0 I still can't figure out for certain what you're asking, but you might look at the article http://en.wikipedia.org/wiki/De_Moivre%27s_formula -- http://mail.python

Re: Order by value in dictionary

2007-10-17 Thread cokofreedom
On Oct 17, 3:39 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I have a dictionary like these: > a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 > element > I want to sort this by value and i want to first 100 element.. > Result must be: > [b, a, d, c .] ( first 100 elemen

Re: Write by logging.FileHandler to one file by many processess

2007-10-17 Thread Alexandre Badez
On Oct 17, 3:33 pm, Rafa Zawadzki <[EMAIL PROTECTED]> wrote: > Hello. > > As I saw in logging source - there is no lock per file during making emit() > (only lock per thread). > > So, my question is - is it safe to log into one file using many processess > uses logging logger? > > Cheers, > -- > b

Re: Best Python Linux distribution

2007-10-17 Thread Joe Riopel
On 10/17/07, Joe Riopel <[EMAIL PROTECTED]> wrote: > IDLE and Python came installed on Slackware 12, I am not 100% sure > about previous versions. Also, I am sure a lot of it (with most distributions) depends on the packages you select during the installation. -- http://mail.python.org/mailman

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread schaefer . mp
Just to clarify what I'm after: If you plot (-3)^n where n is a set of negative real numbers between 0 and -20 for example, then you get a discontinuos line due to the problem mentioned above with fractional exponents. However, you can compute what the correct absolute value of the the missing poi

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Just to clarify what I'm after: > > If you plot (-3)^n where n is a set of negative real numbers between 0 > and -20 for example, then you get a discontinuos line due to the > problem mentioned above with fractional exponents. However, y

readline support on openSuSE

2007-10-17 Thread Milos Prudek
This question concerns compilation of Python from sources. Specifically Python 2.3.6. On Kubuntu 7.04, ./configure outputs these lines about readline: checking for rl_pre_input_hook in -lreadline... yes checking for rl_completion_matches in -lreadline... yes On openSuSE 10.3, ./configure outputs

Re: Order by value in dictionary

2007-10-17 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > Abandoned wrote: > >> Hi.. >> I have a dictionary like these: >> a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 >> element >> I want to sort this by value and i want to first 100 element.. >> Result must be: >> [b, a, d, c .] ( first 100 element)

Re: Write by logging.FileHandler to one file by many processess

2007-10-17 Thread Diez B. Roggisch
Alexandre Badez wrote: > On Oct 17, 3:33 pm, Rafa Zawadzki <[EMAIL PROTECTED]> wrote: >> Hello. >> >> As I saw in logging source - there is no lock per file during making >> emit() (only lock per thread). >> >> So, my question is - is it safe to log into one file using many >> processess uses log

Re: Dynamic and lazy import

2007-10-17 Thread Alexandre Badez
On Oct 17, 3:56 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Alexandre Badez wrote: > > Thanks for all your advices, but it's not really what I would like to > > do. > > > I'm going to be more clearer for what I really want to do. > > > Here we have got many library for different application

Re: negative base raised to fractional exponent

2007-10-17 Thread Ken Schutte
[EMAIL PROTECTED] wrote: > On Oct 17, 4:05 am, Ken Schutte <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> Does anyone know of an approximation to raising a negative base to a >>> fractional exponent? For example, (-3)^-4.1 since this cannot be >>> computed without using imaginary nu

Re: Dynamic and lazy import

2007-10-17 Thread Diez B. Roggisch
>> Diez > > Well, I would like to be able to use "setuptools", but the problem is > that I can't. > Cause the administrator do not want us to be able to add lib in python > dir. > So we have to create our own library directory... That doesn't matter, setuptools is capable of installing anywhere -

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread J. Robertson
[EMAIL PROTECTED] wrote: > Just to clarify what I'm after: > > If you plot (-3)^n where n is a set of negative real numbers between 0 > and -20 for example, then you get a discontinuos line due to the > problem mentioned above with fractional exponents. > > .. > It looks like you crash-landed

Re: Order by value in dictionary

2007-10-17 Thread George Sakkis
On Oct 17, 10:06 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: > > Abandoned wrote: > > >> Hi.. > >> I have a dictionary like these: > >> a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 > >> element > >> I want to sort this by value and i want to fir

Re: Order by value in dictionary

2007-10-17 Thread Diez B. Roggisch
George Sakkis wrote: > On Oct 17, 10:06 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Diez B. Roggisch wrote: >> > Abandoned wrote: >> >> >> Hi.. >> >> I have a dictionary like these: >> >> a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 >> >> element >> >> I want to sort

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread Gerard Flanagan
On Oct 17, 3:17 pm, [EMAIL PROTECTED] wrote: > To compute the absolute value of a negative base raised to a > fractional exponent such as: > > z = (-3)^4.5 > > you can compute the real and imaginary parts and then convert to the > polar form to get the correct value: > > real_part = ( 3^-4.5 ) * co

Re: Order by value in dictionary

2007-10-17 Thread cokofreedom
On Oct 17, 4:06 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: > > Abandoned wrote: > > >> Hi.. > >> I have a dictionary like these: > >> a={'a': '1000', 'b': '18000', 'c':'40', 'd': '600'} .. 100.000 > >> element > >> I want to sort this by value and i want to firs

Re: Static variable vs Class variable

2007-10-17 Thread Hrvoje Niksic
Duncan Booth <[EMAIL PROTECTED]> writes: > Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > >> The current implementation of += uses __add__ for addition and >> __iadd__ for addition that may or may not be in-place. I'd like to >> know the rationale for that design. >> > > Apart from the obvious short

Stopping a fucntion from printing its output on screen

2007-10-17 Thread sophie_newbie
Hi, in my program i need to call a couple of functions that do some stuff but they always print their output on screen. But I don't want them to print anything on the screen. Is there any way I can disable it from doing this, like redirect the output to somewhere else? But later on in the program i

Re: Stopping a fucntion from printing its output on screen

2007-10-17 Thread Jeremy Sanders
sophie_newbie wrote: > Hi, in my program i need to call a couple of functions that do some > stuff but they always print their output on screen. But I don't want > them to print anything on the screen. Is there any way I can disable > it from doing this, like redirect the output to somewhere else?

Re: Order by value in dictionary

2007-10-17 Thread Abandoned
Very very thanks everbody.. These are some method.. Now the fastest method is second.. 1 === def sortt(d): items=d.items() backitems=[ [v[1],v[0]] for v in items] backitems.sort() #boyut=len(backitems) #backitems=backitems[boyut-500:] a=[ backitems[i][1] for i in rang

Re: Inheriting automatic attributes initializer considered harmful?

2007-10-17 Thread Alex Martelli
Andrew Durdin <[EMAIL PROTECTED]> wrote: > On 10/17/07, Thomas Wittek <[EMAIL PROTECTED]> wrote: > > > > Writing such constructors for all classes is very tedious. > > So I subclass them from this base class to avoid writing these constructors: > > > > class AutoInitAttributes(object): > >

HTML Parser for Jython

2007-10-17 Thread Falcolas
Does anybody know of a decent HTML parser for Jython? I have to do some screen scraping, and would rather use a tested module instead of rolling my own. Thanks! GP -- http://mail.python.org/mailman/listinfo/python-list

Re: Order by value in dictionary

2007-10-17 Thread Marc 'BlackJack' Rintsch
On Wed, 17 Oct 2007 08:09:50 -0700, Abandoned wrote: > Very very thanks everbody.. > > These are some method.. > Now the fastest method is second.. Maybe because the second seems to be the only one that's not processing the whole dictionary but just 500 items less!? You are building way too muc

Re: HTML Parser for Jython

2007-10-17 Thread Stefan Behnel
Falcolas wrote: > Does anybody know of a decent HTML parser for Jython? I have to do > some screen scraping, and would rather use a tested module instead of > rolling my own. Not sure if it works, but have you tried BeautifulSoup? Or maybe an older version of it? Stefan -- http://mail.python.org

linear programming in Python

2007-10-17 Thread jivelasquezt
Hi all, I'm new to this group so I don't know if this question has been posted before, but does anyone knows about linear/integer programming routines in Python that are available on the web, more specifically of the branch and bound method. Thanks, Jorge Velasquez PhD Student, Department of Eco

pymssql - insert NULL to int

2007-10-17 Thread rc
How to insert NULL values in to int field using params. I'm trying to use pymssql.execute, passing the operation and list of params. One of the values in the params is a NULL value going to int field. The pymssql._quote() puts ' around the NULL which causes an exception to be thrown, is there a

Re: HTML Parser for Jython

2007-10-17 Thread Carsten Haese
On Wed, 2007-10-17 at 17:36 +0200, Stefan Behnel wrote: > Falcolas wrote: > > Does anybody know of a decent HTML parser for Jython? I have to do > > some screen scraping, and would rather use a tested module instead of > > rolling my own. > > Not sure if it works, but have you tried BeautifulSoup?

Re: Order by value in dictionary

2007-10-17 Thread Peter Otten
Abandoned wrote: > These are some method.. > Now the fastest method is second.. Your four functions return three different results for the same input. First make sure it's correct, then make it faster (if necessary). Here are two candidates: def largest_sort(d, n): return sorted(d, key=d.__

ANN: Pyrex 0.9.6.3

2007-10-17 Thread Greg Ewing
Pyrex 0.9.6.3 is now available: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ Main features of this release: * The C API now uses just one name in the module namespace, instead of a name per C function. * The 'cdef' keyword and following extern/public/api qualifiers ca

Re: pymssql - insert NULL to int

2007-10-17 Thread Diez B. Roggisch
rc wrote: > How to insert NULL values in to int field using params. > > I'm trying to use pymssql.execute, passing the operation and list of > params. One of the values in the params is a NULL value going to int > field. The pymssql._quote() puts ' around the NULL which causes an > exception to

Re: linear programming in Python

2007-10-17 Thread Wayne Brehaut
Hi Jorge, On Wed, 17 Oct 2007 08:44:28 -0700, [EMAIL PROTECTED] wrote: >Hi all, > >I'm new to this group so I don't know if this question has been posted >before, but does anyone knows about linear/integer programming >routines in Python that are available on the web, more specifically of >the br

Re: Order by value in dictionary

2007-10-17 Thread Abandoned
I tried these: def largest_sort(d, n): return sorted(d, key=d.__getitem__, reverse=True)[:n] def largest_heap(d, n): return heapq.nlargest(n, d, d.__getitem__) def sortt(d): sorted_items = sorted((item[1], item[0]) for item in d.iteritems(), reverse=True)

Re: why doesn't have this list a "reply-to" ?

2007-10-17 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On 2007-10-16, Robert Kern <[EMAIL PROTECTED]> wrote: | | > It's not universal. Many people consider it harmful. Google "reply-to considered | > harmful" for a variety of opinions, for and against. | > | > I use GMane

Re: linear programming in Python

2007-10-17 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi all, | | I'm new to this group so I don't know if this question has been posted | before, Searching this group for 'linear programming' at http://groups.google.com/group/comp.lang.python/topics?lnk=srg gives 30 hits. | but does an

Re: Best Python Linux distribution

2007-10-17 Thread Rafael Sachetto
You could try this http://www.ibiblio.org/onebase/onebaselinux.com/About/features/developgo.php On 10/17/07, Joe Riopel <[EMAIL PROTECTED]> wrote: > > On 10/17/07, Joe Riopel <[EMAIL PROTECTED]> wrote: > > IDLE and Python came installed on Slackware 12, I am not 100% sure > > about previous versio

Re: HTML Parser for Jython

2007-10-17 Thread Tim Chase
> Does anybody know of a decent HTML parser for Jython? I have to do > some screen scraping, and would rather use a tested module instead of > rolling my own. GIYF[0][1] There are the batteries-included HTMLParser[2] and htmllib[3] modules, and the ever-popular (and more developer-friendly) Beau

Need recommendations on mock object packages

2007-10-17 Thread Matthew Wilson
What are the most popular, easiest to use, and most powerful mock object packages out there? Thanks in advance. Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: HTML Parser for Jython

2007-10-17 Thread Falcolas
On Oct 17, 9:50 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > Recent releases of BeautifulSoup need Python 2.3+, so they won't work on > current Jython, but BeatifulSoup 1.x will work. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread Matimus
On Oct 17, 6:51 am, [EMAIL PROTECTED] wrote: > Just to clarify what I'm after: > > If you plot (-3)^n where n is a set of negative real numbers between 0 > and -20 for example, then you get a discontinuos line due to the > problem mentioned above with fractional exponents. However, you can > comput

Re: Stopping a fucntion from printing its output on screen

2007-10-17 Thread Steven D'Aprano
On Wed, 17 Oct 2007 07:57:04 -0700, sophie_newbie wrote: > Hi, in my program i need to call a couple of functions that do some > stuff but they always print their output on screen. But I don't want > them to print anything on the screen. Is there any way I can disable it > from doing this, like re

Re: readline support on openSuSE

2007-10-17 Thread gardsted
Milos Prudek wrote: > This question concerns compilation of Python from sources. Specifically > Python > 2.3.6. > > On Kubuntu 7.04, ./configure outputs these lines about readline: > checking for rl_pre_input_hook in -lreadline... yes > checking for rl_completion_matches in -lreadline... yes >

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Need help in updating a global variable by a thread

2007-10-17 Thread dedalusenator
Hello Folks, My first posting here and I am a stuck in figuring out the exact way to update a global variable from within a function that doesnt return any value (because the function is a target of the thread and I dont know how exactly return would work in such a case). I am sure I am missing so

Re: Problem of Readability of Python

2007-10-17 Thread kiilerix
On Oct 7, 10:24 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > $ python -mtimeit -s'class A(object):pass' -s'a=A()' 'a.zop=23' When I know that all instances of classes inheriting from object have a namespace, then I would expect either that all objects have a namespace or that it was inherited fr

* Pedophile Al-Qaida Brown Muslim Kills 6 Devout Christian Policement for Enjoying a Party - Atom Bomb his country to stone age *

2007-10-17 Thread thermate
www.nkusa.org 911blogger.com www.st911.org www.stj911.org http://www.cnn.com/2007/US/10/08/wisconsin.shooting/?iref=mpstoryview updated 8:39 p.m. EDT, Mon October 8, 2007 Deputy fired 30 shots from rifle in killing 6, officials say CRANDON, Wisconsin (CNN) -- An off-duty sheriff's deputy used a

* Pedophile Al-Qaida Brown Muslim Kills 6 Devout Christian Policement for Enjoying a Party - Atom Bomb his country to stone age *

2007-10-17 Thread thermate2
www.nkusa.org 911blogger.com www.st911.org www.stj911.org http://www.cnn.com/2007/US/10/08/wisconsin.shooting/?iref=mpstoryview updated 8:39 p.m. EDT, Mon October 8, 2007 Deputy fired 30 shots from rifle in killing 6, officials say CRANDON, Wisconsin (CNN) -- An off-duty sheriff's deputy used a

Re: Desperately need help for html to LaTeX conversion

2007-10-17 Thread Legend
On Oct 15, 1:24 pm, "ynotssor" <[EMAIL PROTECTED]> wrote: > Innews:[EMAIL PROTECTED], > > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > The perl one does not run due to path problems. > > Nothing could be easier to fix than that. I don't know if this could solve your problem atleast to a little

* Pedophile Al-Qaida Brown Muslim Kills 6 Devout Christian Policement for Enjoying a Party - Atom Bomb his country to stone age *

2007-10-17 Thread lemnitzer
Need to typeset this article for discussion www.nkusa.org 911blogger.com www.st911.org www.stj911.org http://www.cnn.com/2007/US/10/08/wisconsin.shooting/?iref=mpstoryview updated 8:39 p.m. EDT, Mon October 8, 2007 Deputy fired 30 shots from rifle in killing 6, officials say CRANDON, Wisconsin

Re: Problem of Readability of Python

2007-10-17 Thread Chris Mellon
On 10/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Oct 7, 10:24 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > $ python -mtimeit -s'class A(object):pass' -s'a=A()' 'a.zop=23' > > When I know that all instances of classes inheriting from object have > a namespace, then I would expect e

  1   2   3   >