Re: Python 3000 deat !? Is true division ever coming ?

2006-02-18 Thread Dan Bishop
Magnus Lycka wrote: Gregory Piñero wrote: I knew about that approach. I just wanted less typing :-( It's enough to introduce one float in the mix. 1.*a/b or float(a)/b if you don't want one more multiplication. That doesn't work if either a or b is a Decimal. What *could* work is def

Re: Does Plone support distinct sets of users in subgroups?

2006-02-18 Thread Rene Pijlman
wheel: I'm not sure if this is the right venue for Plone questions, if not, could someone ref me to a better one? The plone-users mailing list. Highly recommended. The discussion groups on the plone site are mailing lists and I'd rather not subscribe quite yet. Why not? It's free, takes 1

Re: How many web framework for python ?

2006-02-18 Thread Rene Pijlman
Bo Yang: There are very good web framework for java and ruby , Is there one for python ? Yes. http://wiki.python.org/moin/WebProgramming I want to write a web framework for python based on mod_python as my course homework , could you give some advise ? Write Zope3. -- René Pijlman --

jython socket sendall

2006-02-18 Thread Mark Fink
Hi there, I am about to port a server application from Java to Jython. For the socket part I found some examples written in Python. I have problems to figure out the socket part of the application. In Jython 2.1 the sendall function is missing? def establishConnection(self):

Re: How many web framework for python ?

2006-02-18 Thread Ville Vainio
Bo Yang wrote: There are very good web framework for java and ruby , Is there one for python ? There are many good ones. I want to write a web framework for python based on mod_python as my course homework , could you give some advise ? Implement yet another web framework? It needs to be

Re: embedding python in HTML

2006-02-18 Thread Steve Holden
bruno at modulix wrote: John Salerno wrote: Rene Pijlman wrote: John Salerno: [Python alternative for PHP] So to do this with Python, do I simply integrate it into the HTML as above, with no extra steps? You'd need something like the PHP engine, that understands Python rather than PHP.

Re: python spawn new process, rout stdin/out

2006-02-18 Thread Steve Holden
kmkz wrote: ok solved that by using the call() method I now have a bigger problem: the executable always wants to open in its own window. how do I stop this? Call pythonw instead of python. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC

Re: Does Plone support distinct sets of users in subgroups?

2006-02-18 Thread Duncan Booth
wheel wrote: I'm not sure if this is the right venue for Plone questions, if not, could someone ref me to a better one? The discussion groups on the plone site are mailing lists and I'd rather not subscribe quite yet. Use gmane.org: you get NNTP access to all the plone mailing lists (and

Re: GDI in python?

2006-02-18 Thread Claudio Grondi
al pacino wrote: hi, is it possible to address the 'screen pixels' using python , like analogous to older dos( functions that graphics.h provides') or win api calls for gdi. what i want is to display clusters (in differetn colours) on screen using python. thanks. Sure. The problem

Re: GDI in python?

2006-02-18 Thread Diez B. Roggisch
al pacino schrieb: hi, is it possible to address the 'screen pixels' using python , like analogous to older dos( functions that graphics.h provides') or win api calls for gdi. Use one of the available GUI-Toolkits - Tkinter is included already. Or pygame. Diez --

Re: commenting out blocks of code

2006-02-18 Thread Duncan Booth
Steven D'Aprano wrote: Scite, for example, lets me selected a block and hit Ctrl-Q to either comment or uncomment the block. I see the developers of Scite are either newbies to GUI programming, or they operate in a world of their own. Ctrl-Q is reserved for Quit (or Exit) in every GUI API

Re: embedding python in HTML

2006-02-18 Thread Christoph Zwerschke
Rene Pijlman wrote: There's also PSP: http://www.ciobriefings.com/psp/ Another incarnation of PSP can be used as part of Webware for Python (http://www.w4py.org). And one of the more modern solutions that should be mentioned is Kid (http://kid.lesscode.org). -- Christoph --

[ANN] Movable python Trial Version

2006-02-18 Thread Fuzzyman
Hot on the heels of `Movable Python 1.0.1 http://www.voidspace.org.uk/python/movpy/`_, is the release of a free trial version of **Movable Python**. This is the full distribution for Python 2.3.5. To download (and play with it), visit `Movable python Demo

Photo Management Python Application

2006-02-18 Thread Bill
Does anyone know of a Python program that will re-name digital photo files in a date-time format based on the date stamp of the file? -- http://mail.python.org/mailman/listinfo/python-list

Should we still be learning this?

2006-02-18 Thread Max
On monday I start a semester course in Python (the alternative was Java). I was looking through the course outline and noticed the following: 1) UserDict is used. This is deprecated, right? 2) There is no mention of list comprehensions, but map and filter are taught early and then revisited

Re: [ANN] Movable python Trial Version

2006-02-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-18 às 04:24 -0800, Fuzzyman escreveu: It is set to expire on the 22nd May, and displays a nag screen on startup. Other than that, it is the full version. Have fun. Attached is the cracked version with no expiration limit and my own bitmap on the startup. Enjoy! Fuzzyman

Re: Should we still be learning this?

2006-02-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-18 às 14:38 +0200, Max escreveu: On monday I start a semester course in Python (the alternative was Java). I was looking through the course outline and noticed the following: 1) UserDict is used. This is deprecated, right? LOL... it's the first time I see someone talking

strange error I can't figure out...

2006-02-18 Thread Brian Blais
Hello, I have an odd kind of Heisenbug in what looks like a pretty simple program. The program is a progress bar code I got at the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/168639 (including the code below) If you uncomment the one print statement I added in

Re: strange error I can't figure out...

2006-02-18 Thread Fabrizio Milo
Is well indented ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Should we still be learning this?

2006-02-18 Thread Max
Felipe Almeida Lessa wrote: Em Sáb, 2006-02-18 às 14:38 +0200, Max escreveu: Urgh. This sucks. Did they mention generators, at least? Sometimes list comprehensions are even faster (I didn't check, but I think this one can be an example of this: [i*2+2 for i in iterator] vs. map(lambda x: x*2

Re: Movable python Trial Version

2006-02-18 Thread Fuzzyman
Felipe Almeida Lessa wrote: Em Sáb, 2006-02-18 às 04:24 -0800, Fuzzyman escreveu: It is set to expire on the 22nd May, and displays a nag screen on startup. Other than that, it is the full version. Have fun. Attached is the cracked version with no expiration limit and my own bitmap on the

Re: strange error I can't figure out...

2006-02-18 Thread John Zenger
It works fine for me. You must be having an indentation problem. Also, get rid of the comma at the end of that last print statement. Brian Blais wrote: Hello, I have an odd kind of Heisenbug in what looks like a pretty simple program. The program is a progress bar code I got at the

Re: [ANN] Movable python Trial Version

2006-02-18 Thread Claudio Grondi
Felipe Almeida Lessa wrote: Em Sáb, 2006-02-18 às 04:24 -0800, Fuzzyman escreveu: It is set to expire on the 22nd May, and displays a nag screen on startup. Other than that, it is the full version. Have fun. Attached is the cracked version with no expiration limit and my own bitmap on the

Re: GDI in python?

2006-02-18 Thread F. Petitjean
Le 17 Feb 2006 22:02:23 -0800, al pacino a écrit : hi, is it possible to address the 'screen pixels' using python , like analogous to older dos( functions that graphics.h provides') or win api calls for gdi. Some possibilities (all on Win32 only): ctypes by Thomas Heller venster (uses

Re: Should we still be learning this?

2006-02-18 Thread John Zenger
Don't overly concern yourself with your course being 100% up to date. When learning programming, the concepts are what is important, not the syntax or libraries you happen to be using. Even if they were to teach you the latest and greatest features of 2.4.2, that would be out of date in a few

Re: How many web framework for python ?

2006-02-18 Thread Bo Yang
Thank you very much ! -- http://mail.python.org/mailman/listinfo/python-list

general coding issues - coding style...

2006-02-18 Thread calmar
Hi all, since I'm just a 'handicraft'/beginner or so, could anybody provide me with some (rough) hints, about how to enhance the code here: http://calmar.ws/tmp/cal.html Cheers and thanks a lot calmar -- calmar (o_ It rocks: LINUX + Command-Line-Interface //\

Re: Activestate python installation

2006-02-18 Thread Chris Smith
mik3 == mik3 [EMAIL PROTECTED] writes: mik3 hi this is a question regarding installing Activestate mik3 python whenever i try to install the latest Activestate mik3 Python on WinXP SP2, it gives me error saying The wizard mik3 was interrupted before Activestate 2.4.2 could be

Re: general coding issues - coding style...

2006-02-18 Thread Diez B. Roggisch
calmar schrieb: Hi all, since I'm just a 'handicraft'/beginner or so, could anybody provide me with some (rough) hints, about how to enhance the code here: - why are these {{{ thingies there? - use string interpolation like Foo %s %i % (bar, 1) instead of concatenating strings.

Re: Komodo - Will it Lock Me In?

2006-02-18 Thread F. Petitjean
Le Fri, 17 Feb 2006 18:14:26 -0800, Trent Mick a écrit : Nope. Komodo adds no goo to your code (TM). TM's my name, not a trademark on Komodo adds no goo to your code -- but I'm thinking about it. :) +1 JOTW (Joke of the week) Cheers, Trent --

Re: Difference: __iadd__ and __add__

2006-02-18 Thread Peter Hansen
Jonathan Gardner wrote: I would like to point out that it isn't entirely obvious where to find documentation for this particular thing. I know from experience where to go, but I remember spending a long time trying to hunt this down. I'd like to point out it should be obvious, at least as far

Numpy for PythonCE

2006-02-18 Thread G�nter Reusing
Hi, is there a version of Numpy (or Numarray) available that is compatible to PythonCE 2.3? -- http://mail.python.org/mailman/listinfo/python-list

Re: GDI in python?

2006-02-18 Thread Peter Hansen
al pacino wrote: is it possible to address the 'screen pixels' using python , like analogous to older dos( functions that graphics.h provides') or win api calls for gdi. what i want is to display clusters (in differetn colours) on screen using python. Almost any (or just any) GUI toolkit

Re: commenting out blocks of code

2006-02-18 Thread Steven D'Aprano
On Sat, 18 Feb 2006 03:14:49 +, Neil Hodgson wrote: I am the developer responsible for SciTE and the Ctrl+Q decision. Ctrl+Q is not reserved for Quit on every platform. [snip] Thank you for your thoughtful response. Although I'm not convinced by your reasoning, I will concede that

Difference between CPython, Python for .NET and IronPython?

2006-02-18 Thread Carl Johan Rehn
What is the difference between CPython, Python for .NET, and IronPython? For example, if I'm running IronPython, can I access modules such as Numeric and numarray? As I understand it, interoperability with C# and .NET works in both directions with IronPython, but CPython modules cannot be

Re: Photo Management Python Application

2006-02-18 Thread Peter Hansen
Bill wrote: Does anyone know of a Python program that will re-name digital photo files in a date-time format based on the date stamp of the file? Not entirely sure since I can't parse the above sentence fully. Could you please reread it and consider rephrasing it? It really doesn't look

Re: Multi-threaded SSL

2006-02-18 Thread Jean-Paul Calderone
On 17 Feb 2006 23:37:22 -0800, [EMAIL PROTECTED] wrote: Thanks Alex. I hadn't noticed that example. I gave it a shot and still have the synchronization problems. While this may be because of a lack of understanding of twisted threads (again, perhaps I'm just not looking in the right places, but

Re: Difference between CPython, Python for .NET and IronPython?

2006-02-18 Thread Claudio Grondi
Carl Johan Rehn wrote: What is the difference between CPython, Python for .NET, and IronPython? For example, if I'm running IronPython, can I access modules such as Numeric and numarray? As I understand it, interoperability with C# and .NET works in both directions with IronPython, but

2-3 Tree Implementation

2006-02-18 Thread timw07
Hi Group: I am looking for some reference material to implement a 2-3 Tree in Python... Can anyone lead me in the right direction? thanks.. -- http://mail.python.org/mailman/listinfo/python-list

Re: strange error I can't figure out...

2006-02-18 Thread Brian Blais
John Zenger wrote: It works fine for me. You must be having an indentation problem. Also, get rid of the comma at the end of that last print statement. Brian Blais wrote: Hello, I have an odd kind of Heisenbug in what looks like a pretty simple If you uncomment the one print

Re: Difference between CPython, Python for .NET and IronPython?

2006-02-18 Thread Diez B. Roggisch
For example, if I'm running IronPython, can I access modules such as Numeric and numarray? AFAIK not. You can run pure python modules, but not extensions containing native code. As I understand it, interoperability with C# and .NET works in both directions with IronPython, but CPython

Re: GDI in python?

2006-02-18 Thread al pacino
Thanks claudio, that should work out fine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Photo Management Python Application

2006-02-18 Thread [EMAIL PROTECTED]
You can play around with Pil, http://effbot.org/imagingbook/ I found this as being the date for a picture import Image i = Image.open('/media/hda8/Pictures/Elvis/dscn0178.jpg') i._getexif()[36867] '2006:02:18 14:07:55' -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Plone support distinct sets of users in subgroups?

2006-02-18 Thread wheel
I was shy of setting up to recieve a bunch of emails, but I'll scope out the nttp option. Thanks to both of you. In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... wheel: I'm not sure if this is the right venue for Plone questions, if not, could someone ref me to a better one? The

share function argument between subsequent calls but not between class instances!

2006-02-18 Thread K. Jansma
Hi, given the following example class class Test: def f(self,a, L=[]): L.append(a) return L and the following statements a = Test() a.f(0) a.f(0) a.f(0) b = Test() b.f(0) this is the output I would like to have (i.e., expect) a = Test() a.f(0) [0] a.f(0) [0, 0] a.f(0)

Re: share function argument between subsequent calls but not between class instances!

2006-02-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-18 às 17:42 +0100, K. Jansma escreveu: How can I avoid this without using eg. self.L in an __init__? Why not use it? That's how it's meant to be done! Thanks in advance, Karel. Cya, Felipe. -- Quem excele em empregar a força militar subjulga os exércitos dos outros povos

Re: share function argument between subsequent calls but not between class instances!

2006-02-18 Thread Duncan Booth
K. Jansma wrote: as you can see, the b.f method shares L with a.f. How can I avoid this without using eg. self.L in an __init__? You cannot. If a method argument has a default value then the same default is used whenever the method is called. If you want each instance to have its own

Re: share function argument between subsequent calls but not between class instances!

2006-02-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-18 às 16:50 +, Duncan Booth escreveu: marker = object() class Test(object): def __init__(self): self.L = [] def f(self,a, L=marker): if L is marker: L = self.L L.append(a) return L As hasattr(None, append) ==

[DICTIONARY] - Copy dictionary entries to attributes

2006-02-18 Thread Ilias Lazaridis
remark: not sure if the term dictionary is correct here. I have the following situation: within a setup.cfg, settings are passed this way: settings=project_page=theProjectPage.com myVar=myValue those are accessible later like this: settings['project_page'] / settings['myValue'] -

Re: general coding issues - coding style...

2006-02-18 Thread calmar
On 2006-02-18, Diez B. Roggisch [EMAIL PROTECTED] wrote: Hi Diez, - why are these {{{ thingies there? markers for folding for vim http://www.calmar.ws/tmp/sc.png - use string interpolation like Foo %s %i % (bar, 1) instead of concatenating strings. I see, get's shorter and so, and I

Re: [DICTIONARY] - Copy dictionary entries to attributes

2006-02-18 Thread Diez B. Roggisch
Ilias Lazaridis schrieb: remark: not sure if the term dictionary is correct here. I have the following situation: within a setup.cfg, settings are passed this way: settings=project_page=theProjectPage.com myVar=myValue those are accessible later like this:

Get parameters from URL using CGI

2006-02-18 Thread abcd
i want to create a CGI script which simply prints out values given via the URL (such as when a GET is performed). So if I have a script named, foo.cgi and I access it by going to: http://www.somesite.com/cgi-bin/foo.cgi?name=johnage=90 I want foo.cgi to print out: name: john age: 90 how

Re: Another stupid newbie question

2006-02-18 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 17 Feb 2006 11:51:08 -0800, Byte wrote: Great, thanks all. Now, how come if x == mx: print x break Dosnt work? Do yourself a HUGE favour and read this before posting any more questions to comp.lang.python. Trust me, you really

Re: commenting out blocks of code

2006-02-18 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 17 Feb 2006 19:12:01 -0500, Peter Hansen wrote: john peter wrote: is there a similar mechanism in python, other than prefixing the '#' character to the start of each statement i do not want to execute (which gets old very quickly if one needs to comment and

Making mouse wheel work with pmw ScrolledCanvas widget

2006-02-18 Thread dan . gass
Hi, I am using the pmw tkinter package and having trouble getting the ScrolledCanvas widget to respond to the mouse wheel. I am running Windows XP. I've Googled it and came up empty. I believe it should be possible because Idle's editor window supports scrolling with a mouse wheel. Thanks in

Re: Twisted book opinions?

2006-02-18 Thread Jacob Hallen
In article [EMAIL PROTECTED], Andrew Gwozdziewycz [EMAIL PROTECTED] wrote: It's really more of an example based tutorial book than cookbook. What it does do really well is 'networking programming essentials'. I found it quite a good book and managed to write a distributed ssh cron tool in an

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-18 Thread Steve Holden
[EMAIL PROTECTED] wrote: Thank you very much, Magnus ! This is the answer I had been waiting for: A problem as I see it today, is that this behaviour is not actively encouraged. The tutorial, which is maintained and updated, still describes old style classes, and the old division behaviour.

Re: PyProtocols, Components, and Inheritance

2006-02-18 Thread Terry Hancock
On Thu, 16 Feb 2006 23:53:51 -0600 Terry Hancock [EMAIL PROTECTED] wrote: I've been discussing PyProtocols with a a friend collaborating with me on a SF game project, about the benefits and design concept of component architecture, and I'm a little confused by what I'm learning. [...]

Re: Numpy for PythonCE

2006-02-18 Thread Robert Kern
G��� wrote: Hi, is there a version of Numpy (or Numarray) available that is compatible to PythonCE 2.3? I haven't heard of anyone trying. Perhaps you could try compiling the latest SVN of numpy and tell us how it goes on [EMAIL PROTECTED] . -- Robert Kern

Re: Should we still be learning this?

2006-02-18 Thread B Mahoney
I was initally annoyed that Dive into Python has the UserDict, but it was so easy to discover it was deprecated http://docs.python.org/lib/module-UserDict.html (althought the term 'deprecated' is not specifically used), that anyone on the ball (the OP seemed to know) would not based their next big

Re: define loop statement?

2006-02-18 Thread Jeffrey Schwab
David Isaac wrote: I would like to be able to define a loop statement (nevermind why) so that I can write something like loop 10: do_something instead of for i in range(10): do_something Possible? If so, how? Ruby and Smalltalk are both good at this kind of thing, since

Re: define loop statement?

2006-02-18 Thread Georg Brandl
Jeffrey Schwab wrote: class Loop: def __init__(self, n): self.n = n def __call__(self): self.n = self.n - 1 return self.n != 0 if __name__ == '__main__': loop = Loop(10) while loop: print OK Seems you

Tkinter / Aqua (OS X) question (canvas borders)

2006-02-18 Thread [EMAIL PROTECTED]
This is a beginner question. I am using a Mac running OS X. I have TclTkAqua installed. If I type: import Tkinter r = Tkinter.Tk() c = Tkinter.Canvas(r) c.pack() c.create_line(0,0,100,0) the line is not visible. If I type: c.create_line(3,4,100,4) the line is visiable. There appears to

Re: Get parameters from URL using CGI

2006-02-18 Thread Ian Leitch
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 abcd wrote: i want to create a CGI script which simply prints out values given via the URL (such as when a GET is performed). So if I have a script named, foo.cgi and I access it by going to:

Tab Character?

2006-02-18 Thread [EMAIL PROTECTED]
How do I make a tab character in code to split a line read with tabs in it? Thanks. Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: Tab Character?

2006-02-18 Thread John Zenger
Tab is \t . As in: print coke\tpepsi tsvline.split(\t) [EMAIL PROTECTED] wrote: How do I make a tab character in code to split a line read with tabs in it? Thanks. Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: 2-dimensional data structures

2006-02-18 Thread anthonyberet
Tim Chase wrote: I want to work on a sudoku brute-forcer, just for fun. Well, as everybody seems to be doing these (self included...), the sudoku solver may become the hello world of the new world :) What is the equivalent way to store data in python? - It isn't obvious to me how to

Re: share function argument between subsequent calls but not between class instances!

2006-02-18 Thread Ben Finney
Duncan Booth [EMAIL PROTECTED] writes: If you intend to only use the default some of the time, and at other times pass in a different list, then save the 'default' in the instance and use a special marker value to indicate when you intend the default to be used: The most common idiom for such

Re: Tab Character?

2006-02-18 Thread Ben Finney
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: How do I make a tab character in code to split a line read with tabs in it? For such non-printing characters it's best not to have them literally in your code, but to use an escape sequence to generate them at run-time:: foo = \t print foo

Re: 2-dimensional data structures

2006-02-18 Thread Kermit Rose
From: anthonyberet Date: 02/18/06 17:11:01 To: python-list@python.org Subject: Re: 2-dimensional data structures I am not sure how to most efficiently identify which region any given square on the grid is actually in - any thoughts, for those that have done this? - I don't want a

Re: define loop statement?

2006-02-18 Thread Jeffrey Schwab
Jeffrey Schwab wrote: class Loop: def __init__(self, n): self.n = n def __call__(self): self.n = self.n - 1 return self.n != 0 if __name__ == '__main__': loop = Loop(10) while loop: Whoops. Should be while loop(). print OK --

Re: Pyserial never read

2006-02-18 Thread luca72
Thanks for your help, but it don't solve the problem. I receive only the echo and full stop. Many Thanks Best Regards Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: 2-dimensional data structures

2006-02-18 Thread Diez B. Roggisch
However, I wondering how to approach the search of the nine regions of the grid. I am thinking of producing another nested list, again 9x9 to store the contents of each region, and to update this after each pass through -and update of- the main grid (row and column). I am not sure how to

Re: 2-dimensional data structures

2006-02-18 Thread Diez B. Roggisch
Diez B. Roggisch schrieb: The question is not so much which region a give square is in, but more which square contains which fields. If we assume that you number your squares row-wise (top-left zero, top-right 3, bottom-right 9), this function computes the field indices that a given square

Re: define loop statement?

2006-02-18 Thread David Isaac
Alan Isaac wrote: I would like to be able to define a loop statement (nevermind why) so that I can write something like loop 10: do_something instead of for i in range(10): do_something Possible? If so, how? Jeffrey Schwab [EMAIL PROTECTED] wrote in message

Re: define loop statement?

2006-02-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-18 às 20:04 +, Jeffrey Schwab escreveu: if __name__ == '__main__': loop = Loop(10) while loop: print OK Maybe: while Loop(10)(): print OK Looks rather ugly but requires one less line ;-). -- Quem excele em empregar a força militar

Re: general coding issues - coding style...

2006-02-18 Thread plahey
Hi, 1585 if sys.path[0][-12:] == \library.zip: #for py2exe how about if sys.path[0].endswith( \\library.zip ): (did you really mean one back-slash there?) 499 tuple = os.path.split(filename) bad variable name... tuple(x) converts a sequence to a tuple. You have a number of places

Re: general coding issues - coding style...

2006-02-18 Thread Dylan Moreland
calmar wrote: On 2006-02-18, Diez B. Roggisch [EMAIL PROTECTED] wrote: - why are these {{{ thingies there? markers for folding for vim http://www.calmar.ws/tmp/sc.png I would look into one of the many Vim scripts which automatically fold most large blocks without the ugly {{{. --

Re: 2-dimensional data structures

2006-02-18 Thread [EMAIL PROTECTED]
anthonyberet wrote: Tim Chase wrote: I want to work on a sudoku brute-forcer, just for fun. Well, as everybody seems to be doing these (self included...), the sudoku solver may become the hello world of the new world :) What is the equivalent way to store data in python? - It isn't

Re: general coding issues - coding style...

2006-02-18 Thread Justin Azoff
Dylan Moreland wrote: I would look into one of the many Vim scripts which automatically fold most large blocks without the ugly {{{. Who needs a script? set foldmethod=indent works pretty well for most python programs. -- http://mail.python.org/mailman/listinfo/python-list

Re: define loop statement?

2006-02-18 Thread Nigel Rowe
Felipe Almeida Lessa wrote: Em Sáb, 2006-02-18 às 20:04 +, Jeffrey Schwab escreveu: if __name__ == '__main__': loop = Loop(10) while loop: print OK Maybe: while Loop(10)(): print OK Looks rather ugly but requires one less line ;-). Doesn't work. You get a

Re: define loop statement?

2006-02-18 Thread Felipe Almeida Lessa
Em Dom, 2006-02-19 às 11:08 +1100, Nigel Rowe escreveu: Felipe Almeida Lessa wrote: Em Sáb, 2006-02-18 às 20:04 +, Jeffrey Schwab escreveu: if __name__ == '__main__': loop = Loop(10) while loop: print OK Maybe: while Loop(10)(): print OK Looks

Multiplication optimization

2006-02-18 Thread Paul McGuire
Does Python's run-time do any optimization of multiplication operations, like it does for boolean short-cutting? That is, for a product a*b, is there any shortcutting of (potentially expensive) multiplication operations as in: if a == 0 return 0 if a == 1 return b

Re: ANN: Release of NumPy 0.9.5

2006-02-18 Thread Travis E. Oliphant
vinjvinj wrote: I read some of the earlier threads which essentially said that numpy is about 3-4 times slower then Numeric for smaller arrays. I'm assuming that applies only to operations that apply to the whole arrays. I was curious how the performance of the following operations would

Re: 2-dimensional data structures

2006-02-18 Thread Kirk McDonald
anthonyberet wrote: Thanks for the advice (to everyone in the thread). I think I will go with nested lists. However, I am running into a conceptual problem. My approach will be firstly to remove all the impossible digits for a square by searching the row and column for other occurances.

Re: Multiplication optimization

2006-02-18 Thread Steven D'Aprano
On Sat, 18 Feb 2006 16:48:38 -0800, Paul McGuire wrote: Does Python's run-time do any optimization of multiplication operations, like it does for boolean short-cutting? Do you know that these shortcuts are optimizations, or are you just assuming it takes less time to do the comparison than it

Re: Multiplication optimization

2006-02-18 Thread Raymond Hettinger
[Paul McGuire] Does Python's run-time do any optimization of multiplication operations, like it does for boolean short-cutting? Usually, it is safest (and typically true) to assume that Python performs no optimizations. To go beyond making assumptions, it is easy to run a few timings: from

Re: define loop statement?

2006-02-18 Thread Benji York
David Isaac wrote: I would like to be able to define a loop statement (nevermind why) so that I can write something like loop 10: do_something Here's a flagrant hack: import sys VAR_NAME = '__repeat_counter' def set_repeat_counter(value): frame = sys._getframe(2)

Re: Get parameters from URL using CGI

2006-02-18 Thread abcd
Ian Leitch wrote: from urlparse import urlparse dict([n for n in [i.split('=') for i in urlparse('http://www.somesite.com/cgi-bin/foo.cgi?name=johnage=90')[4].split('')]]) {'age': '90', 'name': 'john'} Ian, thanks for the reply, but that is not what I need to do. Inside foo.cgi how can I

Re: - Copy dictionary entries to attributes

2006-02-18 Thread Ben Wilson
Perhaps: def dictionary_make_attributes(self, settings): for k,v in settings: setattr(self, k, v) http://ftp.python.org/doc/lib/built-in-funcs.html#l2h-64 -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiplication optimization

2006-02-18 Thread Jean-Paul Calderone
On 18 Feb 2006 16:48:38 -0800, Paul McGuire [EMAIL PROTECTED] wrote: Does Python's run-time do any optimization of multiplication operations, like it does for boolean short-cutting? Here's the beginning of int_mul from Objects/intobject.c: static PyObject * int_mul(PyObject *v, PyObject

aborting without killing the python interpreter

2006-02-18 Thread Russ
I wrote a simple little function for exiting with an error message: def error ( message ): print_stack(); exit (\nERROR: + message + \n) It works fine for executing as a script, but when I run it interactively in the python interpreter it kills the interpreter. That's not what I want. Is there

Python vs. Lisp -- please explain

2006-02-18 Thread 63q2o4i02
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely hated it, having learned C++ a few years prior. They didn't teach Lisp at all and instead expected us

Re: strange error I can't figure out...

2006-02-18 Thread Brian Beck
John Zenger wrote: Also, get rid of the comma at the end of that last print statement. This would break the progress bar functionality I think, which is meant to update a single line. -- Brian Beck Adventurer of the First Order -- http://mail.python.org/mailman/listinfo/python-list

Re: aborting without killing the python interpreter

2006-02-18 Thread Terry Reedy
Russ [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I wrote a simple little function for exiting with an error message: def error ( message ): print_stack(); exit (\nERROR: + message + \n) It works fine for executing as a script, How? In the standard interpreter, 'exit' is

Re: Seaching Active Directory via ADO

2006-02-18 Thread LittlePython
With help I have been able to put together a little example. It illustrates several different ways.. import win32com.client c = win32com.client.Dispatch(ADODB.Connection) c.Open(Provider=ADSDSOObject) ##Check if connected to AD if bool(c.state): print Connected to AD ## This uses sql dialect

Re: Python vs. Lisp -- please explain

2006-02-18 Thread DH
[EMAIL PROTECTED] wrote: A few years ago I had an AI class where we had to use Lisp, and I absolutely hated it, having learned C++ a few years prior. They didn't teach Lisp at all and instead expected us to learn on our own. CS classes haven't changed, I see. In learning Python I've read

Re: Python vs. Lisp -- please explain

2006-02-18 Thread Terry Reedy
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In learning Python I've read more about Lisp than when I was actually trying to learn it, and it seems that the two languages have lots of similarities: http://www.norvig.com/python-lisp.html I'm wondering if someone can explain to

Re: aborting without killing the python interpreter

2006-02-18 Thread Terry Reedy
correction Terry Reedy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How? In the standard interpreter, 'exit' is bound to the string 'Use Ctrl-Z plus Return to exit.' This is, of course, Windows specific. Other systems have other strings. --

Any Tkinker bases rich text widget?

2006-02-18 Thread sullivanz . pku
Hi all I am using the standard python GUI Tkinter as my program's main interface. Although I know wxPython has some widget to support rich text widget, but I do not have time to shift to wx series. Does anyone know any Tkinter based widget that support: 1. Blod, Italic, Underline and their

  1   2   >