Re: Some thoughts on garbage collection

2006-01-22 Thread Frank Millman
Paul Rubin wrote: > "Frank Millman" <[EMAIL PROTECTED]> writes: > > Is this a sensible approach, or are there easier ways to achieve this? > > In general you're supposed to just let gc do its thing. Doing your > own storage management defeats the purpose of gc. In principle I agree. My concern w

Re: Some thoughts on garbage collection

2006-01-22 Thread Paul Rubin
"Frank Millman" <[EMAIL PROTECTED]> writes: > Is this a sensible approach, or are there easier ways to achieve this? In general you're supposed to just let gc do its thing. Doing your own storage management defeats the purpose of gc. At most I'd say check for leaks by running some native extensi

Re: OpenGL

2006-01-22 Thread Mike C. Fletcher
[EMAIL PROTECTED] wrote: > Does that mean PyOpenGL is based on ctypes ? > PyOpenGL, the project with releases, binaries on most platforms, and lots of history is currently written in SWIG. It was originally written in pure Python C-extension code, then Tarn rewrote it using SWIG a few years

Some thoughts on garbage collection

2006-01-22 Thread Frank Millman
Hi all I don't know whether this will be of interest, but I have just carried out an exercise that I found useful, so I thought I would share it. I am writing a multi-user business app, with a multi-threaded server program to handle client connections. The server should 'serve forever'. Each clie

Re: Being unjust

2006-01-22 Thread Runsun Pan
On 22 Jan 2006 20:35:17 -0800, Ian Bicking <[EMAIL PROTECTED]> wrote: understandably slow release schedule of Python itself.  I think thestandard library is only appropriate for solved problems, where the area is well understood.  Just look at how much time it took to getdecimal and datetime in, bo

Dr. Dobb's Python-URL! - weekly Python news and links (Jan 23)

2006-01-22 Thread Magnus Lycka
QOTW: "The IEEE-754 standard doesn't wholly define output conversions, and explicitly allows that a conforming implementation may produce any digits whatsoever at and after the 18th signficant digit, when converting a 754 double to string. In practice, all implementations I know of that exploit t

Re: OT: introduction to computing clusters?

2006-01-22 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, I asked: >In article <[EMAIL PROTECTED]>, > <[EMAIL PROTECTED]> wrote: . . . >The first step I recommend is to be clear on the benefits >you're targetting. For you, is clustering about >A. HPC

Cross-module imports?

2006-01-22 Thread Matthias Kaeppler
Hi, I am getting strange errors when I am importing modules cross-wise, like this: # module A import B var1 = "x" B.var2 = "y" # module B import A var2 = "z" print A.var1 The error messages are not even sane, for example the interpreter complains about not finding 'var1' in module A. Is ther

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

2006-01-22 Thread Andrae Muys
[EMAIL PROTECTED] wrote: > 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: > > Here is izip(). > My conception is it takes two sequence generators > and matches up the

Re: Who is www.python.org for? (was Re: New Python.org website ?)

2006-01-22 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > For all the commercial value in Python (and there is plenty, > I am sure), it's not Java, and I don't want it to be. I'm > cool with suits loving it too, but I don't want to have to > put on a suit to play. Python is an absolutely top-notch > free softwar

Re: Who is www.python.org for? (was Re: New Python.org website ?)

2006-01-22 Thread Bryan
Aahz wrote: > The idea is that we make www.python.org even more minimal than the > current beta.python.org; it becomes a portal similar in simplicity to > google.com (with a bit more explanation). It would lead off to > subdomains such as business.python.org, tech.python.org, help.python.org, > a

Re: Being unjust

2006-01-22 Thread Ian Bicking
Kay Schluehr wrote: > I'd be interested in what people think about bundling one of the > diverse Python webframeworks with the Python distribution which will be > "just there" as like Tcl/Tk+Tkinter for GUI-programming. Its not that I > don't trust people to make qualified decisions on their own or

Re: Who is www.python.org for? (was Re: New Python.org website ?)

2006-01-22 Thread Terry Hancock
On 22 Jan 2006 14:18:18 -0800 [EMAIL PROTECTED] (Aahz) wrote: > The idea is that we make www.python.org even more minimal > than the current beta.python.org; it becomes a portal > similar in simplicity to google.com (with a bit more > explanation). It would lead off to subdomains such as > busines

Re: Dominant color & PIL

2006-01-22 Thread Terry Hancock
On Sun, 22 Jan 2006 21:07:45 +0100 Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > I was wondering is it possible to find out which colour is > dominant in an image using PIL? > It would be very easy to create interesting mozaic images > with that :) Shrink it to one pixel, and get that pixel's valu

Re: OpenGL

2006-01-22 Thread seb . haase
Does that mean PyOpenGL is based on ctypes ? I thought is was using SWIG ? And on that note: I have some (old) SWIG typemaps for numarray arrays that I'm using for many years. I was always wondering how difficult it would be for me to add them into PyOpenGL ? So far I'm just using my own (one !)

Re: Arithmetic sequences in Python

2006-01-22 Thread Christoph Zwerschke
Alex Martelli wrote: > Yep, using {} for both sets and dicts wouldn't be a good idea. I > suspect most core Python developers think of dicts as more fundamental > than sets, so... (I may disagree, but I just don't care enough about > such syntax sugar to consider even starting a debate about it on

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Jean-Paul Calderone wrote: > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >> >> BTW: What is the shortest way to get the binary representation of a >> number in Python? Is there really not something like itoa() anywhere in >> the standard libs? > > I'm somewhat partial to this implementation: >

Re: Making dir's

2006-01-22 Thread I V
Klaus Alexander Seistrup wrote: > Or os.makedirs(): Although that may or may not do what the OP wants. I was assuming she was trying to produce a directory structure like: /dir/C/ /dir/ASM/ /dir/Python/ os.makedirs() produces a directory hierarchy, like: /dir/C/ASM/Python/ -- http://mail.pyth

The question in source code about of funciton--PyObject_CallFunction (in file abstract.c)

2006-01-22 Thread yy x
hi,all.  I have remarked the statement of question with blue color in the following funcition, Counld someone answer me?   thanks       PyObject *PyObject_CallFunction(PyObject *callable, char *format, ...){ va_list va; PyObject *args, *retval;  if (callable == NULL)  return null_error();  if (form

Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Carl Cerecke
Petr Jakes wrote: > Sorry, I can't get in. Can you please show me, how to use your approach > on the simple push/push ON/OFF button for example please? > > PS: seriously it is not a homework :) and I feel it like a shame I am > asking such a simple questions :( > > States: ON, OFF > Transition ev

Re: Returning a tuple-struct

2006-01-22 Thread James Stroud
Tom Anderson wrote: > On Thu, 18 Jan 2006 [EMAIL PROTECTED] wrote: > >> Is there a better way? Thoughts? > > > I was thinking along these lines: > > class NamedTuple(tuple): > def __init__(self, indices, values): > "indices should be a map from name to index" > tuple.__init

Re: Some thougts on cartesian products

2006-01-22 Thread Jean-Paul Calderone
On Mon, 23 Jan 2006 03:21:59 +0100, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >BTW: What is the shortest way to get the binary representation of a >number in Python? Is there really not something like itoa() anywhere in >the standard libs? I'm somewhat partial to this implementation: bina

Re: OpenGL

2006-01-22 Thread Mike C. Fletcher
NaeRey wrote: > If you notice the project died, being latest release Jan2 2005. Thats > over a year old. > Died, no. We have a rather small developer community, basically myself and a few people who contribute a module here or there. Most (really, all) of the time being spent on PyOpenGL the

Re: how to run python scripts on a website

2006-01-22 Thread Christoph Zwerschke
py schrieb: > i have a website which runs apache on linux. it supports python (i > think via cginot sure how else). anyway how can I go to a web page > and run a python script or something like that? for example say i make > a script which prints out all the links on another URLhow can i

Numeric Entry in Tkinter

2006-01-22 Thread Dustan
Earlier I asked about limitting what a user can enter in an Entry. I got a few greatly appreciated replies, but I was hoping it would be possible to take a more direct approach, that is, is there a method I can override, when creating a class that inherits the Entry methods, that is called whenever

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Bryan Olson wrote: > What you seem to want is easy enough: > [a + b for a in 'hello' for b in 'world'] Yes, but 'hello'*'world' is easier. And how would you write '01'**8 ? This should give you all bytes in binary code. > And maybe you want the result to be a generator: > (a + b for a in

Re: another docs problem - imp

2006-01-22 Thread Christoph Zwerschke
I assume one cause of the misunderstanding was the name "path" for the search path. If it had been named "paths" it would have been more obvious. But Python is only following a common standard here. Since environment variables are called PATH, CLASSPATH etc. it was only logical to use PYTHONPAT

Re: Some thougts on cartesian products

2006-01-22 Thread Bryan Olson
Christoph Zwerschke wrote: > In Python, it is possible to multiply a string with a number: > > >>> "hello"*3 > 'hellohellohello' Which is really useful. > However, you can't multiply a string with another string: > > >>> 'hello'*'world' > Traceback (most recent call last): > File "", line 1

Re: Making dir's

2006-01-22 Thread Klaus Alexander Seistrup
Or os.makedirs(): #v+ >>> import os >>> print os.makedirs.__doc__ makedirs(path [, mode=0777]) Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segment (not just the rightmost) will be created if it does not exist. T

Re: [ANNOUNCE] MyHDL 0.5 released

2006-01-22 Thread Jan Decaluwe
Michael wrote: > Practical examples are great, I'd seen that you'd introduced conversion to > verilog some time back, but it wasn't clear how much was synthesisable. I'll try to clarify. Hardware synthesis is a rather "closed" technology, with several competing, expensive tools and relatively few

Re: Arithmetic sequences in Python

2006-01-22 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: ... > These are valid points, but they lead me to the opposite conclusion: Why > not let {a,b,c} stand for set([a,b,c])? That would be very intuitive As syntax sugar goes, that would be on a par with the current "dict display" notation, at least.

Re: Arithmetic sequences in Python

2006-01-22 Thread Alex Martelli
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > > The current list function is supposed to be something like a > > > typecast: > > > > > list() isn't a function, it's a type. > > I'm not sure what the distinction is supposed to be. "list" is anyway Yo

Re: Arithmetic sequences in Python

2006-01-22 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > The current list function is supposed to be something like a > > typecast: > > > list() isn't a function, it's a type. I'm not sure what the distinction is supposed to be. "list" is anyway callable, and lambda a:list(a) is certainly a function. > > x

Re: Arithmetic sequences in Python

2006-01-22 Thread Christoph Zwerschke
Alex Martelli wrote: print set([1,2,3]) > set([1, 2, 3]) > > input and output could be identical. Do YOU have any good reason why > sets should print out as set(...) and lists should NOT print out as > list(...)? Is 'list' somehow "deeper" than 'set', to deserve a special > display-form syn

Re: another docs problem - imp

2006-01-22 Thread rurpy
Steve Holden wrote: > [EMAIL PROTECTED] wrote: [...snip...] > Well, perhaps if you'd read the intro to the documentation (more > carefully), or if you were more used to reading programming manuals, > you'd quickly have recognised > > [, path] > > as meaning precisely that the path argument is

Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Petr Jakes
Sorry for the typo in my previous posting. Of course it has to be: simple liftt/push ON/OFF button -- http://mail.python.org/mailman/listinfo/python-list

Re: Making dir's

2006-01-22 Thread Christoph Zwerschke
yawgmoth7 wrote: > os.mkdir("C") > os.mkdir("Python") > os.mkdir("ASM") > > And so on. That is not very practical, and I wish to change it. I was > wondering if there were any other methods to which I could do this, I > was thinking maybe I could put the dir names in a dictionary then have > somet

converting wiki markup to html (or xml)

2006-01-22 Thread Tim Parkin
I'm trying to convert fragments of wiki markup into fragments of html (specifically using moinmoin markup). I've managed to do this with MoinMoin but I've had to create a data directory, config file and underlay. Does anybody know if there a sane way of doing this without the extra baggage? Tim Pa

Re: Making dir's

2006-01-22 Thread James Stroud
yawgmoth7 wrote: > Hello, I am writing a script that will organize all the code in the > given directory. Well, currently I have it make dir's with something > like: > > os.mkdir("C") > os.mkdir("Python") > os.mkdir("ASM") > > And so on. That is not very practical, and I wish to change it. I was

Re: Making dir's

2006-01-22 Thread James Stroud
yawgmoth7 wrote: > Hello, I am writing a script that will organize all the code in the > given directory. Well, currently I have it make dir's with something > like: > > os.mkdir("C") > os.mkdir("Python") > os.mkdir("ASM") > > And so on. That is not very practical, and I wish to change it. I was

Re: Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
Reasons why it still won't work: * Firewall * Unknown-modes-operating-systems-get-into Yeah, I dont think these things can be avoided. Nonetheless, if I can come up with some way (via help from this group--thank God!) to find if the node is up (barring the two aforementioned reasons), I am doing

Re: yet another list compr. suggestion

2006-01-22 Thread Christoph Zwerschke
palo wrote: > ... what would you think about this: > as a substitute for filter, people often use > [x for x in y if z(x)] > The suggestion is that the same result could be achieved by > [x in y if z(x)] In the original syntax, if z(x) is always true, you can leave the "if z(x)" part away, wh

Re: More than you ever wanted to know about objects [was: Is everything a refrence or isn't it]

2006-01-22 Thread rurpy
Steve Holden wrote: [...snipped a long and very helpful post addressing some questions I had regarding the nature of an object's value in python...] Sorry for the belated reply Steve (I had some access problems) but did want to let you know I found that post very informative, and wanted to thank

Re: Making dir's

2006-01-22 Thread [EMAIL PROTECTED]
yawgmoth7 wrote: > And so on. That is not very practical, and I wish to change it. I was > wondering if there were any other methods to which I could do this, I > was thinking maybe I could put the dir names in a dictionary then have > something like: > os.mkdir(thedictname) Why not use a loop? d

Re: Concatinating PDF files

2006-01-22 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, sophie_newbie wrote: > I am converting TIFF images of patents to PDF files. Each patent comes > in about 20 seperate TIFF images and I want to put them all in the one > PDF file. Is there a way to do this? Using the Image library I think > you can only convert individual TI

Re: "Dynamic" website content

2006-01-22 Thread Peter Maas
sophie_newbie schrieb: > Flushing to stdout doesn't seem to work anyway. > > Honestly have no idea how you'd implement it in Javascript so might > have an ask on one of their forums... > I think you need HTTP push to update the client page. See http://wp.netscape.com/assist/net_sites/pushpull.ht

Re: Concatinating PDF files

2006-01-22 Thread avishay
sophie_newbie wrote: > I am converting TIFF images of patents to PDF files. Each patent comes > in about 20 seperate TIFF images and I want to put them all in the one > PDF file. Is there a way to do this? Using the Image library I think > you can only convert individual TIFF images to PDF? > > Ma

Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
Fredrik Lundh wrote: >Tim Parkin wrote: > > > >>It sounds very similar to what we have already built!! What we have also >>parses yaml files, rest files, inline rest content, has special >>renderers for navigation and breadcrumbs and handles cacheing of built >>data to speed generation. >> >

Making dir's

2006-01-22 Thread yawgmoth7
Hello, I am writing a script that will organize all the code in the given directory. Well, currently I have it make dir's with something like: os.mkdir("C") os.mkdir("Python") os.mkdir("ASM") And so on. That is not very practical, and I wish to change it. I was wondering if there were any other m

Re: LocaWapp: localhost web applications (v.03 - 2005 Dec 31)

2006-01-22 Thread Runsun Pan
On 1 Jan 2006 08:15:42 -0800, LocaWapp <[EMAIL PROTECTED]> wrote: http://cheeseshop.python.org/packages/source/L/LocaWapp/locawapp-03.tar.gz     Not Found The requested URL /packages/source/L/LocaWapp/locawapp-03.tar.gz was not found on this server.   -- ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~Runsun

Re: calling python from C#...

2006-01-22 Thread Mr BigSmoke
I use python for .NET in some applications... I've always used it for using c# code from python (but i had some problems using it with py2exe and win2000). I'll try using it the other way (c# calling python). I also thought about trying ironpython, but it's too young for my work projects... The CO

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Tim Hochberg
Szabolcs Nagy wrote: >>Basically all I need is vectors and 3x3 matrices. > > > hmm > is numpy really efficient for 3x3 (or 4x4) matrices and vectors? > > IMHO an optimized matrix4x4 class can be much faster (i'm just guessing > here) > > eg cgtypes is a simple c++ implementation with boost-pyth

Re: New Python.org website ?

2006-01-22 Thread Aahz
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >for the curious, I've found a few more spare 15-minute slots, and a more >extensive (but still rough) translation is available here: > >http://effbot.org/pydotorg/ > >the sample site contains ~600 pages. each page has

Who is www.python.org for? (was Re: New Python.org website ?)

2006-01-22 Thread Aahz
In article <[EMAIL PROTECTED]>, JW <[EMAIL PROTECTED]> wrote: > >Agreed. The main page should be like a slick book cover. It should grab >you and leave you wanting more. I think the beta page does that pretty >well. > > [...] > >Of course, I'm a minimalist. I understand techy types want the d

Re: Catching very specific exceptions

2006-01-22 Thread Roy Smith
"Harlin Seritt" <[EMAIL PROTECTED]> wrote: > I am finding that with the many quirks (and really bad foundation for > Win32 APIs) that I am having to write a lot of voodoo code so to speak. Yeah, tell me about it. My current project at work is porting our IPv6 management package (including ICMP p

Re: OT: excellent book on information theory

2006-01-22 Thread val bykoski
Anton Vredegoor wrote: > Paul Rubin wrote(>>): [...] > All of the books writers seem to have not caught up with the idea of > hyperlinks and continue to dwell in neolithical paper dreams :-) > > If they only woke up and let someone like me write some Visual Python > code to illustrate the algori

Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Petr Jakes
Sorry, I can't get in. Can you please show me, how to use your approach on the simple push/push ON/OFF button for example please? PS: seriously it is not a homework :) and I feel it like a shame I am asking such a simple questions :( States: ON, OFF Transition event: "push", "lift" transition di

Re: calling python from C#...

2006-01-22 Thread Ravi Teja
Writing COM Servers is not hard http://www.python.org/windows/win32com/QuickStartServerCom.html IronPython is the other way. Choose COM Server approach if you are using the a lot of standard library functions (as I recall IronPython is not complete here, yet). Definitely choose this approach if y

Re: New Python.org website ?

2006-01-22 Thread Paul Boddie
Fredrik Lundh wrote: > > for the curious, I've found a few more spare 15-minute slots, and a more > extensive (but still rough) translation is available here: > > http://effbot.org/pydotorg/ I've also been messing around with different content sources, and the results can be viewed here: http

Re: yet another list compr. suggestion

2006-01-22 Thread palo
you'd save more in [not_very_convenient_name for not_very_convenient_name in y if z] (just kidding) -- http://mail.python.org/mailman/listinfo/python-list

Re: yet another list compr. suggestion

2006-01-22 Thread palo
you'd save more characters in [not_very_convenient_name for not_very_convenient_name in y if z] (just kidding) -- http://mail.python.org/mailman/listinfo/python-list

calling python from C#...

2006-01-22 Thread Mr BigSmoke
Hi everybody, I need write an application in c#, but i wnat to use some functions that i have already written in python. Is there an "easy" way to call my python code from c#? I must use COM or there are other ways? And, if COM is the only way, where can i find some tutorials or examples? I've neve

Re: yet another list compr. suggestion

2006-01-22 Thread Alan Franzoni
palo on comp.lang.python said: > The suggestion is that the same result could be achieved by > [x in y if z(x)] It's just a special case... and it saves very few carachters... I don't think it would justify an update to the parser. What if you want to do something like: [str(x) for x in y if z(

Re: Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
Thanks for the effort on this last post, Roy. You asked what I was hoping to do differently on these two very minutely different error messages. What I have been trying to do for some time is to write a ping client (for Win32 platform -- Yes, I develop almost exclusively for Win32 environment, unfo

yet another list compr. suggestion

2006-01-22 Thread palo
I appologize for suggesting (though very humbly) a syntax extension (maybe particularly idiotic) but just as a wild fantasy, what would you think about this: as a substitute for filter, people often use [x for x in y if z(x)] The suggestion is that the same result could be achieved by [x in y if z(

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Szabolcs Nagy
> Basically all I need is vectors and 3x3 matrices. hmm is numpy really efficient for 3x3 (or 4x4) matrices and vectors? IMHO an optimized matrix4x4 class can be much faster (i'm just guessing here) eg cgtypes is a simple c++ implementation with boost-python wrapper: http://cgkit.sourceforge.ne

Multiplication Station (wxPython/PyGame/OpenSource GPL)

2006-01-22 Thread ccosse
Hello, just to announce a new version of Multiplication Station available at http://www.asymptopia.org. Multiplication Station is an OpenSource math education game. It will teach your child basic maths, guaranteed. It is multi-user, has a countdown timer and tracks high scores. All parameters are

Re: New Python.org website?

2006-01-22 Thread Tony Meyer
>> But sheesh, if I objected to every picture of the moon I >> see (or pictures that vaguely resemble a moon), I would be >> in a very sad state. > > But you see Terry, the point is not that it is just a picture. And > let's not forget that as far as we know the moon has always been a > natural par

Re: [XML-SIG] Howto create this XML string?

2006-01-22 Thread Sbaush
Thanks all, i've perfectly undestand the way. Thanks again.2006/1/19, Luis Miguel Morillas <[EMAIL PROTECTED]>: 2006/1/19, Sbaush <[EMAIL PROTECTED]>: Hi all.I've this XML:                127.0.0.1"/>            How can i write this in a Python String? I would l

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Steven D'Aprano wrote: > If you are happy to always return a list of tuples regardless of what the > two operands are, generators make it so easy it is shameful. Even if you > want a special case of two string arguments returning a string, it is > hardly any more difficult: > > def cartprod(A, B):

Dominant color & PIL

2006-01-22 Thread Sebastjan Trepca
Hi!I was wondering is it possible to find out which colour is dominant in an image using PIL? It would be very easy to create interesting mozaic images with that :)Thanks, Sebastjan -- http://mail.python.org/mailman/listinfo/python-list

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Robert Kern
Sébastien Boisgérault wrote: > By the way, I tried numpy 0.9.4 10 minutes ago and guess > what ? 'eigenvalue' is broken too ... (hangs forever) On what platform? Are you linking against an optimized BLAS? We can't fix anything without details. I'll be happy to work with you on this bug over on th

Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Carl Cerecke
Bengt Richter wrote: > On Thu, 19 Jan 2006 23:16:57 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > How about something like > > >>> actions = dict( > ...a=compile('print "A"; state="b"','','exec'), > ...b=compile('print "B"; state="c"','','exec'), > ...c=compile('print "C"; stat

Re: Some thougts on cartesian products

2006-01-22 Thread Steven D'Aprano
On Sun, 22 Jan 2006 19:12:49 +0100, Christoph Zwerschke wrote: > Steven D'Aprano wrote: >> On Sun, 22 Jan 2006 18:29:45 +0100, Christoph Zwerschke wrote: >>> For doing such things I would use a vector subtype of list. >> >> Not everything needs to be a separate class! Why create a magic class for

Re: Catching very specific exceptions

2006-01-22 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: > Harlin Seritt <[EMAIL PROTECTED]> wrote: > > > except socket.error: > > code goes here... > > > > Of course, though, these are two separate error messages under the same > > error handler though. I've tried: > > > >

Re: New Python.org website ?

2006-01-22 Thread Fredrik Lundh
Tim Parkin wrote: > It sounds very similar to what we have already built!! What we have also > parses yaml files, rest files, inline rest content, has special > renderers for navigation and breadcrumbs and handles cacheing of built > data to speed generation. except that it isn't: you're talking

Re: Tkinter Mouse Cursor

2006-01-22 Thread gregarican
Please disregard. I just issued an update() method call to refresh the GUI. This in turn displayed the proper mouse cursor that was being set with the config(cursor=xxx) method. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Steven D'Aprano wrote: > I beg to differ: Python *allows* people to create classes if they're keen > on the syntax (and I can sympathise with that like), but Python > *encourages* by example generic tools that operate on as many different > types as makes sense. But these generic tools (say the "p

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Alex Martelli schrieb: >> s = set(range(49)).powerset(6) >> for x in range(10): >> print s.pop() > > This is very systematic, not random;-). Still, using random.sample on s > would indeed produce 12 random different tips!-) Right, that would be systematic. What I wanted to write was: s = s

Re: Some thougts on cartesian products

2006-01-22 Thread Steven D'Aprano
On Sun, 22 Jan 2006 10:41:39 -0800, Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >... >> What advantage is there to creating a "list with cartesian product" >> subclass of list? > > Essentially, syntax sugar -- for some people, being able to code a*b > rather than product

Re: Catching very specific exceptions

2006-01-22 Thread Peter Hansen
Alex Martelli wrote: > what I've done in such situations is > > except socket.error, e: > if e.errno == 10061: > ... > elif e.errno == 10060: > ... > else: > raise > > Not sure the code in a socket.error has attributename 'errno', but I > hope you get the general idea. If it

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Generally, if you could multiply strings in the above fashion, you could spare one more more sub loops, as in this example: for f in ('index', 'default')*('.html', '.htm', '.shtml'): if exists(f): break In this case, it would be not really be better than that: for f in '

Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
Gerhard Häring wrote: > > The other part of my experiment was a stupid build system that > recursively looks for KID files in a directory tree and renders them to > HTML. > > My idea is that for each KID file there would be a corresponding > content.xml file that would come from the MoinMoin dump-

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Alex Martelli schrieb: > > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >... > >> given length. You could get a 6/49 lotto tip with something like: > >> > >> choice(set(range(49)).powerset(6)) > > > And that would be better than the current

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... > What advantage is there to creating a "list with cartesian product" > subclass of list? Essentially, syntax sugar -- for some people, being able to code a*b rather than product(a,b) takes on a huge significance; Python chooses to support this syn

Tkinter Mouse Cursor

2006-01-22 Thread gregarican
Checking a couple of examples I tried changing the Tkinter mouse cursor to indicate a busy state while my app is pushing/pulling xmlrpc data. It doesn't seem to make a difference as I don't notice the cursor actually change in the span of the 3-5 second transaction. I tried changing the cursor of t

Re: New Python.org website ?

2006-01-22 Thread Shalabh Chaturvedi
Fredrik Lundh wrote: If I see this correctly, Fredrik would volonteer to (help) implement something that imports the current python.org content into a Wiki. >>> Exactly. >> I don't really have time for this tonight, and I've spent more time copying >> and pasting stuff than working on the

Re: Some thougts on cartesian products

2006-01-22 Thread Paul Rubin
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > No, the elements of the powerset would be sets with 6 elements each, > not tuples. So technically, it would be correct. Just horribly > inefficient. Oh I see, not the Cartesian product. Yeah, it would be silly in practice. -- http://mail.python.o

Re: New Python.org website ?

2006-01-22 Thread Adrian Holovaty
Fredrik Lundh wrote: > (or maybe the entire site should be a run via a web framework with good > support for caching, such as > > http://www.djangoproject.com/documentation/cache/ > > any django hackers around with some cycles to spare ? ) Yeah, I or other Django folks would be quite happy to

Re: Background/foreground on disabled Tkinter.Entry

2006-01-22 Thread Martyn Quick
Thanks v. much. I'd missed that in the documentation I have access to. Martyn -- http://mail.python.org/mailman/listinfo/python-list

Re: Concatinating PDF files

2006-01-22 Thread [EMAIL PROTECTED]
ReportLab maybe? http://www.reportlab.org/rl_toolkit.html -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser: writes a list but reads a string?

2006-01-22 Thread Jeffrey Barish
funkyj wrote: > making the config file XML and using xml.dom is another option, > although XML is a bit ugly to edit by hand. > --jfc > I am seriously intrigued by ConfigObj. I am currently using an crude improvisation involving tab-delimited fields to store metadata for recordings -- not conf

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Paul Rubin schrieb: > [EMAIL PROTECTED] (Alex Martelli) writes: >>> given length. You could get a 6/49 lotto tip with something like: >>> choice(set(range(49)).powerset(6)) >> And that would be better than the current random.sample(range(49),6) in >> WHAT ways, exactly...? > > I think the first on

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Steven D'Aprano wrote: > On Sun, 22 Jan 2006 18:29:45 +0100, Christoph Zwerschke wrote: >> For doing such things I would use a vector subtype of list. > > Not everything needs to be a separate class! Why create a magic class for > every piece of functionality you want? Just create functions that o

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Alex Martelli schrieb: > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >... >> given length. You could get a 6/49 lotto tip with something like: >> >> choice(set(range(49)).powerset(6)) > And that would be better than the current random.sample(range(49),6) in > WHAT ways, exactly...? You're

Re: Some thougts on cartesian products

2006-01-22 Thread Steven D'Aprano
On Sun, 22 Jan 2006 18:29:45 +0100, Christoph Zwerschke wrote: > Alex Martelli wrote: >> Kay Schluehr <[EMAIL PROTECTED]> wrote: >>> range(3)**2 >>> But why isn't this interpreted as [0, 1, 4] like it is in Mathematica? >> >> Since range(3)*2 is [0, 1, 2, 0, 1, 2], it would be horribly, painfully

Re: Some thougts on cartesian products

2006-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > given length. You could get a 6/49 lotto tip with something like: > > choice(set(range(49)).powerset(6)) > > And that would be better than the current random.sample(range(49),6) in > WHAT ways, exactly...? I think the first one would be incorrect sinc

Re: timeout a process

2006-01-22 Thread iapain
Thanks Tim, Yeah win32api is working normally. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: ... > given length. You could get a 6/49 lotto tip with something like: > > choice(set(range(49)).powerset(6)) And that would be better than the current random.sample(range(49),6) in WHAT ways, exactly...? Alex -- http://mail.python.org/mailman

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Alex Martelli wrote: > Kay Schluehr <[EMAIL PROTECTED]> wrote: >> range(3)**2 >> But why isn't this interpreted as [0, 1, 4] like it is in Mathematica? > > Since range(3)*2 is [0, 1, 2, 0, 1, 2], it would be horribly, painfully > inconsistent if **2 was interpreted as "square each item". Yes. Pyt

  1   2   >