Re: Clearing the screen

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 22:26:08 -0800, mwt wrote: > I can't seem to get that to behave properly. It works fine in a python > shell, like you're demonstrating it, but not as a command in a module. Would you like to tell us how you are using it and what happens when you do, or would you like us to gue

Re: Clearing the screen

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 18:14:02 -0200, Felipe Almeida Lessa wrote: > Em Sáb, 2006-02-11 às 12:04 -0800, mwt escreveu: >> I'm doing some python programming for a linux terminal (just learning). >> When I want to completely redraw the screen, I've been using >> os.system("clear") >> This command works

Re: functional 0.5 released

2006-02-11 Thread bonono
Collin Winter wrote: > On 10 Feb 2006 19:57:48 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Collin Winter wrote: > > > As always, feedback welcome! > > > > Any specific reason flip only flip the first 2 arguments rather than > > the whole tuple ? > > > > That is, I would like to see

Re: Clearing the screen

2006-02-11 Thread mwt
I can't seem to get that to behave properly. It works fine in a python shell, like you're demonstrating it, but not as a command in a module. -- http://mail.python.org/mailman/listinfo/python-list

Re: functional 0.5 released

2006-02-11 Thread Collin Winter
On 10 Feb 2006 19:57:48 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Collin Winter wrote: > > As always, feedback welcome! > > Any specific reason flip only flip the first 2 arguments rather than > the whole tuple ? > > That is, I would like to see: > > assert(f(a,b,c, d) == flip(f)(d, c

Re: [ANN] functional 0.5 released

2006-02-11 Thread Collin Winter
On 2/11/06, Neal Becker <[EMAIL PROTECTED]> wrote: > I just installed from .tar.gz on fedora FC5 x86_64. I ran into 1 small > problem: > [snip] > Because this distribution was installed --multi-version or --install-dir, > before you can import modules from this package in an application, you > wil

Re: itertools examples

2006-02-11 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-11 às 20:16 -0800, Raymond Hettinger escreveu: > Both work just fine. It's a personal choice when to use map() and when > to use a list comprehension. Since many itertools have the flavor of > map/filter, its use is not out of place in the itertools docs. I know both work in the

Re: itertools examples

2006-02-11 Thread Raymond Hettinger
[Felipe Almeida Lessa] > IMHO, on http://www.python.org/doc/current/lib/itertools-example.html , > shouldn't the part > > >>> for k, g in groupby(enumerate(data), lambda (i,x):i-x): > ... print map(operator.itemgetter(1), g) > > be > > >>> for k, g in groupby(enumerate(data), lambda (i, x): i-x

Re: Inserting record with Microsoft Access

2006-02-11 Thread Chris Smith
> "Frank" == Frank Millman <[EMAIL PROTECTED]> writes: Frank> SELECT @@IDENTITY returns the most recent of all Frank> inserts. If you have a complex transaction which triggers Frank> inserts into other tables, it may not return the one you Frank> want. Frank> This one allo

Re: installing python on a server?

2006-02-11 Thread [EMAIL PROTECTED]
I'm wondering whether you couldnn't use MovPy for this purpose - a situation where you don't have root access. You can install the whole MovPy package in your home directory; it provides a self-contained environment. At the moment I think it only runs on Windows boxen, but that may change. --

Re: appending to a list via properties

2006-02-11 Thread Alex Martelli
Xavier Morel <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Carl Banks <[EMAIL PROTECTED]> wrote: > >... > >>> class better_list (list): > >>> tail = property(None, list.append) > >> This is an impressive, spiffy little class. > > > > Yes, nice use of property. > > > > Ale

Re: Yet another GUI toolkit question...

2006-02-11 Thread Neil Hodgson
Kevin Walzer: > Do these screenshots look "non-native" to you? > > http://www.wordtech-software.com/ireveal-mac.png Yes. I don't use a Mac much but the following are really obvious. The column header icons don't fit within the header. The scroll bar is squished up too thin. The icons are f

Re: Circe released to public domain!

2006-02-11 Thread Kyle Brooks
Diez B. Roggisch wrote: > Kyle Brooks schrieb: > >>Wednesday, February 8th, 2006. >> >>Dear all, >> >>I hereby release Circe to the public domain. >> >>Our repo is at http://kbrooks.ath.cx/repos/circe. > > > > This is the second post I read, followed the link, skimmed through some > sources an

Re: How to check...

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 04:48:33 -0800, augustus.kling wrote: > Hello, > > try using regular expressions. "Some people, when confronted with a problem, think 'I know, I'll use regular expressions'. Now they have two problems." -- Jamie Zawinski The original poster asked: "How can I check that a

Re: Is python very slow compared to C

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 13:52:03 -0800, bearophileHUGS wrote: > Yes this language is very slow, Very slow to do what, compared to what? The decay time of the tau meson? Slowness is not an absolute quantity. Slowness is relative, and comments like "Python is very slow" just reinforces the meme that

Re: Is python very slow compared to C

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 12:49:32 -0800, diffuser78 wrote: > I have just started to learn python. Some said that its slow. No, you can learn the basics of Python is only a few hours, and become very proficient at it in days or weeks. It is much faster to learn Python than to learn C. > Can somebody

Re: installing python on a server?

2006-02-11 Thread [EMAIL PROTECTED]
I'm wondering whether you couldnn't use MovPy for this purpose - a situation where you don't have root access. You can install the whole MovPy package in your home directory; it provides a self-contained environment. At the moment I think it only runs on Windows boxen, but that may change. --

Re: Is python very slow compared to C

2006-02-11 Thread Michael Tobis
Experienced programmers learning Python should read this: http://effbot.org/zone/python-objects.htm Try to understand the advantages of this approach, and understand its costs. Essentially, everything you do in Python (or related languages) involves resolving a name. Sometimes the number of dict

Re: installing python on a server?

2006-02-11 Thread John Salerno
Dennis Lee Bieber wrote: > On Sat, 11 Feb 2006 14:53:38 -0500, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> I guess it might be the latter. What I want is to add Python capability >> to the server where my website is running, so that I can write Python >>

Re: Pyserial handobook

2006-02-11 Thread Peter Hansen
Zarathustra wrote: > I have just saw this site... > There is no documetation, but only examples! That's not true. Just below the section entitled Examples (which merely refers to the repository, and doesn't include any examples at all!), there is a whole pile of documentation. It's certainly a

Re: Single-file executables

2006-02-11 Thread James Stroud
Kevin Walzer wrote: > Which of the Windows/Unix package builders for Python applications is > capable of creating single-file executables? I'm thinking of: > > 1. py2exe > 2. Mcmillan Installer/PyInstaller > 3. cxfreeze > > The apps I've seen created by py2exe aren't single-file at all, the > ins

Re: How to check...

2006-02-11 Thread Neil Hodgson
Lad: > How can I check that a string does NOT contain NON English characters? It depends on how you define the set of English characters which is as much a matter of opinion or authority as fact. The following may be regarded as English despite containing 9 (8 unique) non-ASCII charac

Re: Pyserial handobook

2006-02-11 Thread Zarathustra
I have just saw this site... There is no documetation, but only examples! -- http://mail.python.org/mailman/listinfo/python-list

Re: Single-file executables

2006-02-11 Thread Ravi Teja
Actually, py2exe (from version 0.6.1) onwards does create single file exes without ANY additional dependencies. -- http://mail.python.org/mailman/listinfo/python-list

Re: Single-file executables

2006-02-11 Thread Martin v. Löwis
Kevin Walzer wrote: > The apps I've seen created by py2exe aren't single-file at all, the > install folder is full of files besides the main program. I'm looking > for a solution that stuffs all libraries, scripts, and the Python > runtime into one file. For full control, and truly single-binary e

Re: Netstat in python. Does it's possible?

2006-02-11 Thread Martin v. Löwis
Jorgen Grahn wrote: > There might still be a problem for people doing things like this: netstat > might use unstable or non-public APIs to find the things it lists. This is > fine because it's typically your OS vendor who have to handle that (ship > another netstat when the /proc or /sys file syste

Re: appending to a list via properties

2006-02-11 Thread Xavier Morel
Alex Martelli wrote: > Carl Banks <[EMAIL PROTECTED]> wrote: >... >>> class better_list (list): >>> tail = property(None, list.append) >> This is an impressive, spiffy little class. > > Yes, nice use of property. > > Alex I don't know, I usually see people considering that proper

evangelizing python

2006-02-11 Thread jemptymethod
any k5'ers on here feel free to +1 the following pending article on k5: http://www.kuro5hin.org/story/2006/2/11/1454/36403 if you're not a k5 but want a overview of the material before perhaps creating a k5 account just to promote this article, it can be found here: http://htmatters.net/htm/1/20

Single-file executables

2006-02-11 Thread Kevin Walzer
Which of the Windows/Unix package builders for Python applications is capable of creating single-file executables? I'm thinking of: 1. py2exe 2. Mcmillan Installer/PyInstaller 3. cxfreeze The apps I've seen created by py2exe aren't single-file at all, the install folder is full of files besides t

Re: simple math question

2006-02-11 Thread Dan Bishop
Paul Rubin wrote: > John Salerno <[EMAIL PROTECTED]> writes: > > Can someone explain to me why the expression 5 / -2 evaluates to -3, > > especially considering that -2 * -3 evaluates to 6? > > > > I'm sure it has something to do with the negative number and the > > current way that the / operator

itertools examples

2006-02-11 Thread Felipe Almeida Lessa
Hi, IMHO, on http://www.python.org/doc/current/lib/itertools-example.html , shouldn't the part >>> for k, g in groupby(enumerate(data), lambda (i,x):i-x): ... print map(operator.itemgetter(1), g) be >>> for k, g in groupby(enumerate(data), lambda (i, x): i-x): ... print [i[1] for i in g

Re: Is python very slow compared to C

2006-02-11 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I have just started to learn python. Some said that its slow. Can > somebody pin point the issue. > > Thans > "Some" doesn't know what he/she/they are talking about. Generalizations like that upset me because it shows someone that has some predisposition to some other l

Re: Shortest prime number program

2006-02-11 Thread Ralf Muschall
Christoph Zwerschke wrote: > [EMAIL PROTECTED] schrieb: >> How about: >> [2]+[x for x in range(1,99) if 2**x%x==2] > If the range goes beyond 340, it also gives non-primes... [2,3]+[x for x in range(1,99) if 2**x%x==2 and 3**x%x==3] [2,3,5]+[x for x in range(1,99) if 2**x%x==2 and 3**x%x==3 and

Re: Jython socket typecasting problems

2006-02-11 Thread Donn Cave
Quoth "Diez B. Roggisch" <[EMAIL PROTECTED]>: | > This is the code section of my server class (I cut this from a Python | > example): | > def establishConnection(self): | > self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | > self.socket.connect((self.host, self.p

Re: Is python very slow compared to C

2006-02-11 Thread bearophileHUGS
Yes this language is very slow, but frequently this isn't a problem, because you are using fast functions/libraries written in C, or you are doing I/O bound operations. And Psyco, numeric/numarray, ShedSkin can help in some other cases (Pyrex and other solutions allow you to mix in lower level lang

Re: simple math question

2006-02-11 Thread John Salerno
John Salerno wrote: > Hi all. I'm just starting out with Python, so I'm a little slow right > now. :) > > Can someone explain to me why the expression 5 / -2 evaluates to -3, > especially considering that -2 * -3 evaluates to 6? > > I'm sure it has something to do with the negative number and t

Re: simple math question

2006-02-11 Thread John Salerno
Rinzwind wrote: > '/' is a floor division (1/2 == 0) unless validated by a from > __future__ import division. > > So: > 5/2=2.5 -> nearest lowest non-decimal number makes it 2. > 5/-2=-2.5 -> nearest lowest non-decilmal number makes it -3 > Ah, this makes the most sense to me. -2.5 rounded down

Re: simple math question

2006-02-11 Thread Terry Reedy
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can someone explain to me why the expression 5 / -2 evaluates to -3, > especially considering that -2 * -3 evaluates to 6? With same sign int division, one can think of the result as either being rounding down or round

Re: Is python very slow compared to C

2006-02-11 Thread Robert Hicks
Most languages are slow compared to "C". Python is fast enough for just about anything you want to do with it. Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonic exec* spawn*

2006-02-11 Thread Daniel Nogradi
> > >> os.fork() does that (on Mac and Unix). > > > > > >Okay, but how? > > > > Sorry, fork() is implemented strictly on a 'need to know' basis :-) > > > > >It seems to me that if the process which issued os.fork() ends, then > > >the forked process also ends. > > > > No, no, they're not a quantum

Re: "Is" is "is" [was: any way to customize the is operator?]

2006-02-11 Thread Terry Reedy
"> Lonnie Princehouse wrote: >> Calling the wrapped version of this function from Python will produce a >> Python wrapper which represents the same underlying C++ object, but is >> not actually the same Python object: What I think you need is a custom version of the .__eq__ (self,other) method t

Hi reliability files, writing,reading,maintaining

2006-02-11 Thread Lucabrocci
Who said you could have my name?   Get ur own ,I know it's a great name but u still cant have it!   So start practicing your new signature. Jokingly... John J. Pote    

Re: Is python very slow compared to C

2006-02-11 Thread rtilley
[EMAIL PROTECTED] wrote: > I have just started to learn python. Some said that its slow. Can > somebody pin point the issue. It depends on what you are doing. Much of Python is just wrapped C. So many things are very fast. -- http://mail.python.org/mailman/listinfo/python-list

Is python very slow compared to C

2006-02-11 Thread diffuser78
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.5 and hashlib

2006-02-11 Thread rtilley
Alex Martelli wrote: > http://python.org/peps/pep-0356.html -- but it's still a draft, being > discussed in the last few days on python-dev. Thank you, that's exactly what I was looking for! -- http://mail.python.org/mailman/listinfo/python-list

Re: Too Many if Statements?

2006-02-11 Thread Terry Reedy
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Clearly it would be a good idea to remove whatever problem is causing > the error, The problem (see my post of the com_backpatch code) is writing a compound statement (here a for loop) with a body so large as to requir

Re: simple math question

2006-02-11 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > Can someone explain to me why the expression 5 / -2 evaluates to -3, > especially considering that -2 * -3 evaluates to 6? > > I'm sure it has something to do with the negative number and the > current way that the / operator is implemented, but why doesn

Re: simple math question

2006-02-11 Thread Rinzwind
'/' is a floor division (1/2 == 0) unless validated by a from __future__ import division. So: 5/2=2.5 -> nearest lowest non-decimal number makes it 2. 5/-2=-2.5 -> nearest lowest non-decilmal number makes it -3 -- http://mail.python.org/mailman/listinfo/python-list

Re: simple math question

2006-02-11 Thread James Stroud
John Salerno wrote: > Hi all. I'm just starting out with Python, so I'm a little slow right > now. :) > > Can someone explain to me why the expression 5 / -2 evaluates to -3, > especially considering that -2 * -3 evaluates to 6? > > I'm sure it has something to do with the negative number and t

Re: python 2.5 and hashlib

2006-02-11 Thread Alex Martelli
rtilley <[EMAIL PROTECTED]> wrote: > Is there a road map for python a 2.5 releases yet? I'd like to begin > testing the new hashlib module with some old scripts I have that > currently use the md5 and sha modules. http://python.org/peps/pep-0356.html -- but it's still a draft, being discussed i

Re: simple math question

2006-02-11 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-11 às 14:52 -0500, John Salerno escreveu: > Hi all. I'm just starting out with Python, so I'm a little slow right > now. :) > > Can someone explain to me why the expression 5 / -2 evaluates to -3, > especially considering that -2 * -3 evaluates to 6? > > I'm sure it has somethin

Re: Clearing the screen

2006-02-11 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-11 às 12:04 -0800, mwt escreveu: > I'm doing some python programming for a linux terminal (just learning). > When I want to completely redraw the screen, I've been using > os.system("clear") > This command works when using python in terminal mode, and in IDLE. > However, when runnin

Re: Netstat in python. Does it's possible?

2006-02-11 Thread Jorgen Grahn
On Sat, 11 Feb 2006 16:28:06 +0100, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > billie wrote: >> Hi all. I don't know if Python is good for this kind of jobs but I'm >> wondering if it's possible emulate the "netstat" command in Python. > > As a general recommendation, use strace(1) to answer thi

Clearing the screen

2006-02-11 Thread mwt
I'm doing some python programming for a linux terminal (just learning). When I want to completely redraw the screen, I've been using os.system("clear") This command works when using python in terminal mode, and in IDLE. However, when running a little .py file containing that command, the screen doe

Re: Is there any books such as 'effective python' or else about the performance?

2006-02-11 Thread Jorgen Grahn
On Sat, 11 Feb 2006 07:54:46 -0600, Charles Krug <[EMAIL PROTECTED]> wrote: > On 2006-02-11, Kenneth Xie <[EMAIL PROTECTED]> wrote: >> att, thx. > > A lot of the ideas discussed in Effective C++ et al are things that > Python does for us already. C++ works at a much lower layer of > abstraction Y

Re: installing python on a server?

2006-02-11 Thread John Salerno
Dennis Lee Bieber wrote: > On Sat, 11 Feb 2006 01:02:46 -0500, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Yikes, that's all the stuff I don't know. Maybe this is over my head >> right now. > > Let's start with something simple then... Do you have a

simple math question

2006-02-11 Thread John Salerno
Hi all. I'm just starting out with Python, so I'm a little slow right now. :) Can someone explain to me why the expression 5 / -2 evaluates to -3, especially considering that -2 * -3 evaluates to 6? I'm sure it has something to do with the negative number and the current way that the / operato

Re: Determining an operating system's default browser

2006-02-11 Thread Paul Boddie
Jorgen Grahn wrote: > [desktop module] > Note that those do not, of course, work on all Unices. Correct: they work only for the stated desktop environments. > On my machines, there is One Correct Way of doing these things, and that's > to look in the MIME support/configuration files (~/.mailcap

python 2.5 and hashlib

2006-02-11 Thread rtilley
Is there a road map for python a 2.5 releases yet? I'd like to begin testing the new hashlib module with some old scripts I have that currently use the md5 and sha modules. Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Rethinking the Python tutorial

2006-02-11 Thread AdSR
I think you guys are up to something. We need some way to aggregate, update, and extend not just tutorials but all kinds of informatory material on Python. The Python Wiki is a good place for all that, although it hasn't become anything resembling a Wikipedia so far. AdSR -- http://mail.python.o

Re: Determining an operating system's default browser

2006-02-11 Thread Jorgen Grahn
On 10 Feb 2006 03:51:01 -0800, Paul Boddie <[EMAIL PROTECTED]> wrote: > John McMonagle wrote: >> On Thu, 2006-02-09 at 17:53 -0600, Larry Bates wrote: >> > You don't have to determine it. Just os.startfile('page1.html') >> > and let the OS figure it out. >> >> Works great for Windows - not availab

Re: Legality of using Fonts

2006-02-11 Thread Chris Mellon
On 2/11/06, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 10 Feb 2006 20:24:34 -0800, Ross Ridge wrote: > > > Steven D'Aprano wrote: > >> It is highly unlikely that any judge will be fooled by a mere change in > >> format ("but Your Honour, I converted the TTF file into a bitmap"). > > > > I

Re: only a simple xml reader value

2006-02-11 Thread uche . ogbuji
[EMAIL PROTECTED] wrote: > The only thing I must read is the response I get from a EPP server. > A response like this: > > > http://www.eurid.eu/xml/epp/epp-1.0"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:contact="http://www.eurid.eu/xml/epp/contact-1.0"; > xmlns:domain="htt

Re: ordered sets operations on lists..

2006-02-11 Thread Alex Martelli
Raymond Hettinger <[EMAIL PROTECTED]> wrote: ... > The intersection step is unnecessary, so the answer can be simplified a > bit: > > >>> filter(set(l2).__contains__, l1) > [5, 3] > >>> filter(set(l1).__contains__, l2) > [3, 5] ...and if one has time to waste, "setification" being only an opti

Re: Yet another GUI toolkit question...

2006-02-11 Thread Chris Mellon
On 2/11/06, Kevin Walzer <[EMAIL PROTECTED]> wrote: > Chris Mellon wrote: > > > > > If you're planning on selling an application, especially to OS X > > users, then Tk is absolutely out of the question. It doesn't have even > > the slightest resemblence to native behavior, and lacks the polish and

Re: PySizeof: almost useful

2006-02-11 Thread Alex Martelli
Ian Leitch <[EMAIL PROTECTED]> wrote: ... > 2. I'm at a loss as how to calculate the size of a long object -- any tips? #include "longintrepr.h" (from the Python sources). Then, given a PyLongObject *l, abs(l->ob_size) is the number of "digits", each taking SHIFT bits. > Many thanks to anyone

Re: Yet another GUI toolkit question...

2006-02-11 Thread Peter Decker
On 2/11/06, Kevin Walzer <[EMAIL PROTECTED]> wrote: > Also, it seems > very Windows/Linux-centric. Is anyone using it on OS X? I almost forgot: take a look at this screencast: http://leafe.com/screencasts/sizers2.html It's the second part of a demonstration on using sizers in the Dabo visual de

Re: Yet another GUI toolkit question...

2006-02-11 Thread Peter Decker
On 2/11/06, Kevin Walzer <[EMAIL PROTECTED]> wrote: > Dabo looks interesting, but isn't it mainly for database applications? > Has any other kind of application been developed with it? Also, it seems > very Windows/Linux-centric. Is anyone using it on OS X? The Dabo demo comes with several games

Re: by reference

2006-02-11 Thread dirvine
Many thanks I will do so in the future. David -- http://mail.python.org/mailman/listinfo/python-list

Re: Jython socket typecasting problems

2006-02-11 Thread Diez B. Roggisch
> This is the code section of my server class (I cut this from a Python > example): > def establishConnection(self): > self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > self.socket.connect((self.host, self.port)) > Do I have to use explicit typecasting? How can t

Re: any way to customize the is operator?

2006-02-11 Thread Aahz
In article <[EMAIL PROTECTED]>, Lonnie Princehouse <[EMAIL PROTECTED]> wrote: > >> Why did you want to customize "is"? > >Well, mostly out of principle ;-) > >But also because I'm wrapping a C library which passes around C structs >which are wrapped in shim C++ classes for a Boost.Python layer. Bo

Re: appending to a list via properties

2006-02-11 Thread Carl Banks
Alex Martelli wrote: > Carl Banks <[EMAIL PROTECTED]> wrote: >... > > > class better_list (list): > > > tail = property(None, list.append) > > > > This is an impressive, spiffy little class. > > Yes, nice use of property. > > > growing_lists = foo,qux > > while some_condition: > >

Re: Yet another GUI toolkit question...

2006-02-11 Thread Kevin Walzer
Peter Decker wrote: > On 2/10/06, Kevin Walzer <[EMAIL PROTECTED]> wrote: > >> I'm undertaking my first semi-substantial Python GUI application after a >> long time dabbling with the language. >> > ... >> So: my question is, would it be more productive for me to wrestle with >> these extensions wh

Jython socket typecasting problems

2006-02-11 Thread Mark Fink
I try to port a server application to Jython. At the moment I use Jython21\Lib\socket.py Currently I do face problems with casting the string "localhost" to the desired value: D:\AUT_TEST\workspace\JyFIT>jython fit/JyFitServer2.py localhost 1234 23 ['fit/JyFitServer2.py', 'localhost', '1234', '23']

Re: appending to a list via properties

2006-02-11 Thread Alex Martelli
Carl Banks <[EMAIL PROTECTED]> wrote: ... > > class better_list (list): > > tail = property(None, list.append) > > This is an impressive, spiffy little class. Yes, nice use of property. > growing_lists = foo,qux > while some_condition: > for (s,x) in zip(growing_list,calculate

Re: Shortest prime number program

2006-02-11 Thread swisscheese
> 42 Make that 41 and 40. -- http://mail.python.org/mailman/listinfo/python-list

Re: Yet another GUI toolkit question...

2006-02-11 Thread Kevin Walzer
Steve Holden wrote: > Robert Hicks wrote: >> Wow you are so wrong about Tk on OSX. Soon this is just not going to be >> the case at all for any of the system Tcl/Tk runs on. The Tcl folks >> have come out with a package called "Tile" that is going to be rolled >> in. It gives you native L&F on OSX,

Re: Yet another GUI toolkit question...

2006-02-11 Thread Kevin Walzer
Chris Mellon wrote: > > If you're planning on selling an application, especially to OS X > users, then Tk is absolutely out of the question. It doesn't have even > the slightest resemblence to native behavior, and lacks the polish and > flash that occasionally lets a non-native app get away with

Re: Shortest prime number program

2006-02-11 Thread bearophileHUGS
This is a little shorter :-) [2]+[x for x in range(2,99)if 2**x%x==2] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Shortest prime number program

2006-02-11 Thread swisscheese
> [2]+[x for x in range(1,99) if 2**x%x==2] 42 - brilliant! 41: [2]+[x for x in range(1,99)if 2**x%x==2] ... although it appears Christoph is right that it's not scalable. -- http://mail.python.org/mailman/listinfo/python-list

Re: Shortest prime number program

2006-02-11 Thread Jeffrey Schwab
[EMAIL PROTECTED] wrote: > swisscheese wrote: > >>r=range(2,99) >>m=[x*y for x in r for y in r] >>[x for x in r if not x in m] > > > How about: > > [2]+[x for x in range(1,99) if 2**x%x==2] 43. I'll be chewing on this one for a while. Thank you. :) -- http://mail.python.org/mailman/listinfo

Re: Yet another GUI toolkit question...

2006-02-11 Thread Steve Holden
Robert Hicks wrote: > Wow you are so wrong about Tk on OSX. Soon this is just not going to be > the case at all for any of the system Tcl/Tk runs on. The Tcl folks > have come out with a package called "Tile" that is going to be rolled > in. It gives you native L&F on OSX, Windows, Linux. > This i

Re: Shortest prime number program

2006-02-11 Thread Christoph Zwerschke
[EMAIL PROTECTED] schrieb: > How about: > > [2]+[x for x in range(1,99) if 2**x%x==2] If the range goes beyond 340, it also gives non-primes... -- Christoph -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a better way?

2006-02-11 Thread Alex Martelli
Charles Krug <[EMAIL PROTECTED]> wrote: > On 2006-02-11, Alex Martelli <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > >> Problem: > >> > >> You have a list of unknown length, such as this: list = > >> [X,X,X,O,O,O,O]. You want to extract all and only the X's.

Re: How to check...

2006-02-11 Thread John Zenger
This should be just a matter of determining how your string is encoded (ASCII, UTF, Unicode, etc.) and checking the ord of each character to see if it is in the contiguous range of English characters for that encoding. For example, if you know that the string is ASCII or UTF-8, you could check

Re: Yet another GUI toolkit question...

2006-02-11 Thread Robert Hicks
Wow you are so wrong about Tk on OSX. Soon this is just not going to be the case at all for any of the system Tcl/Tk runs on. The Tcl folks have come out with a package called "Tile" that is going to be rolled in. It gives you native L&F on OSX, Windows, Linux. Robert -- http://mail.python.org/m

Re: How to check...

2006-02-11 Thread Daniel Marcel Eichler
Lad wrote: >How can I check that a string does NOT contain NON English characters? try: foobar.encode('ascii') except: bla or use string.ascii_letters and enhance it. mfg Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] functional 0.5 released

2006-02-11 Thread Neal Becker
I just installed from .tar.gz on fedora FC5 x86_64. I ran into 1 small problem: sudo python setup.py install --verbose running install running bdist_egg running egg_info writing functional.egg-info/PKG-INFO writing top-level names to functional.egg-info/top_level.txt reading manifest file 'functi

Re: Shortest prime number program

2006-02-11 Thread dickinsm
swisscheese wrote: > > r=range(2,99) > m=[x*y for x in r for y in r] > [x for x in r if not x in m] How about: [2]+[x for x in range(1,99) if 2**x%x==2] Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Legality of using Fonts

2006-02-11 Thread Ross Ridge
Steven D'Aprano wrote: > In any case, even in the USA, hinted fonts are copyrightable, and merely > removing the hints (say, by converting to a bitmap) is no more legal than > whiting out the author's name from a book and claiming it as your own. That's an absurd comparison. By making a bitmap fo

Re: Netstat in python. Does it's possible?

2006-02-11 Thread Martin v. Löwis
billie wrote: > Hi all. I don't know if Python is good for this kind of jobs but I'm > wondering if it's possible emulate the "netstat" command in Python. As a general recommendation, use strace(1) to answer this kind of question. Run "strace -o tmp netstat", then inspect tmp to find out how nets

Re: How to invoke a tkinter menu *itself*

2006-02-11 Thread Edward K. Ream
> I've spent a pleasant hour or so trying to bring up a top-level Tk menu at > the same spot as it would appear if I had actually clicked the menu. That > is, I want to bring up a menu from the keyboard. I'm going to investigate how to locate the 'button' that forms the anchor for the menu. T

Re: Yet another GUI toolkit question...

2006-02-11 Thread Lawrence Oluyede
Kevin Walzer <[EMAIL PROTECTED]> writes: > Unfortunately, PyGTK does not run natively on the Mac (it's X11 only). There's some work in progress: http://developer.imendio.com/wiki/Gtk_Mac_OS_X -- Lawrence - http://www.oluyede.org/blog "Anyone can freely use whatever he wants but the light at the

Re: Yet another GUI toolkit question...

2006-02-11 Thread Peter Decker
On 2/10/06, Kevin Walzer <[EMAIL PROTECTED]> wrote: > I'm undertaking my first semi-substantial Python GUI application after a > long time dabbling with the language. > ... > So: my question is, would it be more productive for me to wrestle with > these extensions when there doesn't seem to be muc

Re: appending to a list via properties

2006-02-11 Thread Carl Banks
Lonnie Princehouse wrote: > Here's a curious hack I want to put up for discussion. I'm thinking of > writing a PEP for it. A minor library change wouldn' t need a PEP. > Observation > - > I found myself using this construct for assembling multiple lists: > > foo = [] > qu

Re: is there a better way?

2006-02-11 Thread Carl Friedrich Bolz
Hi! [EMAIL PROTECTED] wrote: > Problem: > > You have a list of unknown length, such as this: list = > [X,X,X,O,O,O,O]. You want to extract all and only the X's. You know > the X's are all up front and you know that the item after the last X is > an O, or that the list ends with an X. There are

Re: Martin Franklin's Tkinter/Tile wrapper--where'd it go?

2006-02-11 Thread Kevin Walzer
Kevin Walzer wrote: > I believe Martin Franklin wrote a Tile.py wrapper for the Tk/Tile > extension, which adds theming to the core Tk widget set. It used to > reside here: > > http://mfranklin.is-a-geek.org/docs/Tile/index.html > > That server seems to be down. Anyone know if the wrapper is avai

Re: Netstat in python. Does it's possible?

2006-02-11 Thread Sybren Stuvel
billie enlightened us with: > Hi all. I don't know if Python is good for this kind of jobs but I'm > wondering if it's possible emulate the "netstat" command in Python. On Linux, you can read /proc for that info, iirc. Sybren -- The problem with the world is stupidity. Not saying there should be

Re: Yet another GUI toolkit question...

2006-02-11 Thread Kevin Walzer
Florian Nykrin wrote: > Hi Kevin! > > I have no experience with Tkinter, but I did some small GUIs with > wxPython and PyGTK. > > wxPython works very well on Windows, but on Linux (Ubuntu/Debian in my > case) it is very difficult to work with and buggy. > PyGTK-Applications on the other hand mayb

Re: is there a better way?

2006-02-11 Thread Carl Friedrich Bolz
Alex Martelli wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>Problem: >> >>You have a list of unknown length, such as this: list = >>[X,X,X,O,O,O,O]. You want to extract all and only the X's. You know >>the X's are all up front and you know that the item after the last X is >>an O,

  1   2   >