Re: Python Challenge ahead [NEW] for riddle lovers

2005-04-29 Thread David Murmann
Shane Hathaway wrote: That was pretty fun. Good for a Friday. Too bad it comes to an abrupt "temporary end". Shane P.S. I hope I didn't hammer your server on step 3. I was missing the mark. :-) Interestingly step 3 is actually wrong... there is an additional solution, which looks like cqqmsxk.

Re: Statement orders

2005-10-02 Thread David Murmann
Fredrik Lundh wrote: > Monu Agrawal wrote: > >> Hi I am making a gui based tool. When user preses a perticular button I >> am running a heavy command, before this I want to say user to wait with >> a image showing infront of her. >> >> My code is like: >> >> def loadData(self): >>top=Toplevel(

Re: Statement orders

2005-10-02 Thread David Murmann
[EMAIL PROTECTED] wrote: > Here's one case where it's bad to call update. > > def perform_longrunning_calculation(): > time.sleep(1) > app.update() > time.sleep(1) > would it be advisable to guard against this with something like this? def perform

Re: semi-newbie module namespace confusion

2005-10-04 Thread David Murmann
Fredrik Lundh wrote: > running a piece of python code as a script isn't the same thing as > importing it as a module: I ran into the same problem some time ago and even wanted to post here about it, but found out that it had been reported as a bug three times at sourceforge (if i remember correctl

Re: semi-newbie module namespace confusion

2005-10-04 Thread David Murmann
Fredrik Lundh wrote: > David Murmann wrote: > >> I ran into the same problem some time ago and even wanted to post here >> about it, but found out that it had been reported as a bug three times >> at sourceforge (if i remember correctly). The comments there explained >

build curiosities of svn head (on WinXP)

2005-12-25 Thread David Murmann
hi all! i just built revision 41809 under winxp using a rather uncommon setup (at least i think so). since i have no visual studio here, i only used freely available tools: cygwin to get the source, the microsoft compiler/linker and NAnt (nant.sf.net) as the build tool to interpret the .vcproj-fil

Re: build curiosities of svn head (on WinXP)

2005-12-26 Thread David Murmann
Tim Peters schrieb: > [David Murmann] > ... >>> second, the build order in "pcbuild.sln" for elementtree seems to be >>> wrong, nant tried to build elementtree before pythoncore (which failed). >>> i fixed this by building elementtree separately. > &

Re: build curiosities of svn head (on WinXP)

2005-12-26 Thread David Murmann
Fredrik Lundh schrieb: > try setting the locale (via the locale module) from the interactive prompt, > and see if Python still handles floating point values correctly. > well, it does not: >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'German_Germany.1252' >>> 3.141592 3.0 so this i

Re: build curiosities of svn head (on WinXP)

2005-12-26 Thread David Murmann
David Murmann schrieb: > i will try building 2.4.2 with nant later and see what that does... > FYI i did this now and it worked fine, all tests passed. -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.izip brokeness

2006-01-03 Thread David Murmann
[EMAIL PROTECTED] schrieb: > [izip() eats one line] as far as i can see the current implementation cannot be changed to do the Right Thing in your case. pythons iterators don't allow to "look ahead", so izip can only get the next element. if this fails for an iterator, everything up to that point

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread David Murmann
Claudio Grondi schrieb: > Stuart D. Gathman wrote: >> for (_idx = 0; _idx < NLST; ++_idx) { >> int *i = lst[_idx]; >> if (*i == *_i2) > ^-- I have trouble with this line. Is it as is should be? I suppose > it is not. > i think he meant if (*i == _i2) but i think python does if (i

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread David Murmann
Ich schrieb: > but i think python does > > if (i == &_i2) > > because there is only one integer object holding the value 2, so > it is sufficient to compare the addresses (i'm not sure about this, > perhaps someone smarter can clarify?). well, as far as i can see the relevant function is stat

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread David Murmann
Ich schrieb: > well, as far as i can see the relevant function is > in Objects/intobject.c, which does compare by value. so, this is > either special-cased elsewhere or not optimized (should/can it be?). it is special-cased, but still compares by value. the relevant parts from "Python/ceval.c": c

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread David Murmann
Dan Sommers schrieb: > int **_idx; > for( _idx = lst; _idx < lst + NLST; ++_idx ) { > int *i; > i = *_idx; > > /* compare "the item to which i is bound" to "a constant" */ > if( *i == *(&_i2) ) > /* rebind i to _i4 */ > i = &_i4; > } > > for( _idx = lst; _idx < lst

Re: build curiosities of svn head (on WinXP)

2006-01-09 Thread David Murmann
Paul Moore schrieb: >> btw, if anyone is interested in the (rather small) build-script for >> nant, just ask, > > I haven't seen anyone ask, so can I? I'd love to see the build script. sorry it took me so long, i have been busy the last couple of days, but here it is: "PCBuild/nant-sln.build": -

The effbot does not exist!

2006-01-11 Thread David Murmann
http://effbot.org/F ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading from input file.

2006-01-11 Thread David Murmann
hi! i find it rather hard to understand your problem, but i'll try anyway: [EMAIL PROTECTED] schrieb: > So.. for my future Python script, the input data are in form of: > 1 > 1233.2E-3 2123.2323 2E+2 3453.3E+1 > 1233.2E-3 2123.2323 2E+2 3453.3E+1 > 1233.2E-3 2123.2323 2E+2 3453.

Re: How can I determine an HTTPMessage ?

2006-01-11 Thread David Murmann
Steve Holden schrieb: > Kevin wrote: >> Can you tell me what to look for in an HTTPMessage that is an error? I >> have looked at the header objects and I cannot determine an error >> message. >> > I was thinking of a number between one and a thousand, and I forgot it. > Could someone please remin

Re: how to improve this simple block of code (str.partition?)

2006-01-11 Thread David Murmann
Peter Hansen schrieb: > Matt's answer is still the only one that passes the tests. well, here's another one: - def mysplit(s, sep): x = s.rsplit(sep, 1) return x + ['']*(2-len(x)) def stripZeros(x): intpart, frac = mysplit(x, '.') frac = frac.rstrip('0

Re: flatten a level one list

2006-01-11 Thread David Murmann
Robin Becker schrieb: > Is there some smart/fast way to flatten a level one list using the > latest iterator/generator idioms. > > The problem arises in coneverting lists of (x,y) coordinates into a > single list of coordinates eg > > f([(x0,y0),(x1,y1),]) --> [x0,y0,x1,y1,] or > > g([

Re: Real-world use cases for map's None fill-in feature?

2006-01-11 Thread David Murmann
[EMAIL PROTECTED] schrieb: > I am still left with a difficult to express feeling of > dissatifaction at this process. > > Plese try to see it from the point of view of > someone who it not a expert at Python: > > ... [explains his POV] i more or less completely agree with you, IOW i'd like izip

Re: flatten a level one list

2006-01-12 Thread David Murmann
x, y): > '''D Murman''' > return list(_flatten(zip(x, y))) well, i would really like to take credit for these, but they're not mine ;) (credit goes to Michael Spencer). i especially like flatten4, even if its not as fast as the phenomenally faster flatten7. -- David Murmann (NN!) ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending & Embedding Python

2006-01-12 Thread David Murmann
Marco Meoni schrieb: > Hi all! I've a problem with a C++ class that has to be included in a > python application. One way to do it is Extending and Embedding the > Python Interpreter > Now i have 2 questions > 1) Is there a one-file version of this tutorial? i'm not sure what tutorial you mean. ar

Re: Is 'everything' a refrence or isn't it?

2006-01-12 Thread David Murmann
[EMAIL PROTECTED] schrieb: > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message >> *what* the value is is defined by the operations that the object supports >> (via its >> type). > > Well, that is already better than what is in the Lang Ref. > But there must be more to it than that. int(1) and

Re: Collecting IP range

2006-01-30 Thread David Murmann
yawgmoth7 schrieb: > Hello, I'm sure that this has been discussed before, but I have a > question. I have written a few port scanners, banner grabbers in the > past and have never found a good way to get a range of IP's. > Obviously, in my opinion the best and simplest way to do somethign > like an

Re: Collecting IP range

2006-01-30 Thread David Murmann
yawgmoth7 schrieb: > Well, I seem to have a bit of a problem: > >>>import IPy > >>>ip =IP('127.0.0.1/30') > Traceback (Most recent call last): > File "". line `, in ? > NameError: name 'IP' is not defined > >>> to make this work with "import IPy" you need to use "ip = IPy.IP('127.0.0.1/30')". > I

Re: IPy module

2006-02-03 Thread David Murmann
yawgmoth7 schrieb: > I was discussing this in another email, sadly I have misplaced the > email. I got the module IPy, and I am taking a variable from the > user(An IP) and doing something like this: > > startip = raw_input("Enter start IP: ") > ip = IPy.IP(startip\255) > for x in ip(): > > >

Feature Proposal: Sequence .join method

2005-09-29 Thread David Murmann
Hi all! I could not find out whether this has been proposed before (there are too many discussion on join as a sequence method with different semantics). So, i propose a generalized .join method on all sequences with these semantics: def join(self, seq): T = type(self) result = T()

Re: Feature Proposal: Sequence .join method

2005-09-29 Thread David Murmann
David Murmann wrote: > replace the line > result = result + self + T(item) > with > result = result + self + item and of course the line result = T(seq[0]) with result = seq[0] -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature Proposal: Sequence .join method

2005-09-29 Thread David Murmann
Steven Bethard wrote: > David Murmann wrote: >> Hi all! >> >> I could not find out whether this has been proposed before (there are >> too many discussion on join as a sequence method with different >> semantics). So, i propose a generalized .join method on all s

Re: Feature Proposal: Sequence .join method

2005-09-29 Thread David Murmann
> def join(sep, seq): > return reduce(lambda x, y: x + sep + y, seq, type(sep)()) damn, i wanted too much. Proper implementation: def join(sep, seq): if len(seq): return reduce(lambda x, y: x + sep + y, seq) return type(sep)() but still short enough see you, David. -- ht

Re: Feature Proposal: Sequence .join method

2005-09-30 Thread David Murmann
Michael Spencer wrote: > Terry Reedy wrote: >> "David Murmann" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>>> def join(sep, seq): >>>>return reduce(lambda x, y: x + sep + y, seq, type(sep)()) >>> &g

add keyword argument to itertools.chain [was Feature Proposal: Sequence .join method]

2005-09-30 Thread David Murmann
Hi again, i wrote a small patch that changes itertools.chain to take a "link" keyword argument. If given, it is iterated between the normal arguments, otherwise the behavior is unchanged. I'd like to hear your opinion on both, the functionality and the actual implementation (as this is one of th

Anaglyph 3D Stereo Imaging with PIL and numpy

2006-05-02 Thread David Murmann
Hi all! i just found some colored glass and experimented a bit with these red/green 3d images, so i thought i'd share this simple script i wrote to generate such images with anyone whos interested. i also wouldn't mind some comments on the code. see ya, David. *** anaglyph.py *** # uses PIL

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread David Murmann
[EMAIL PROTECTED] schrieb: > How can I shutdown Windows box from my Main (Linux) ? Have you seen this? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649 it probably won't work on linux (maybe with wine or similar?), but you can try to invoke this script on a windows machine somehow.

getting rid of pass

2006-05-12 Thread David Murmann
Hi all! i just had this crazy idea: instead of while cond(): pass write while cond(). or try: import xyz except ImportError: pass compared to try: import xyz except ImportError. i don't know whether this is syntactically unambiguous or replaces all uses of pass, but i find