Good use for Jython

2005-03-16 Thread Mike Wimpe
Other than being used to wrap Java classes, what other real use is there for Jython being that Python has many other GUI toolkits available? Also, these toolkits like Tkinter are so much better for client usage (and faster) than Swing, so what would be the advantage for using Jython? or Is Jython r

Re: Why tuple with one item is no tuple

2005-03-16 Thread Tim Roberts
Gregor Horvath <[EMAIL PROTECTED]> wrote: > > >>>type(['1']) > > > >>>type(('1')) > > >I wonder why ('1') is no tuple There were lots of answers, but I'm not sure I saw the "why" addressed. Consider this: a = (3 + 5) * 5 You really, really want (3 + 5) to be an integer, not a one-item t

Re: Python becoming less Lisp-like

2005-03-16 Thread Peter Maas
Fernando schrieb: The real problem with Python is that it has been very successful as a scripting language in the static-typing/C/C++ world. Those programmers, instead of adapting their evil ways to Python, and realizing the advantages of a dynamic language, are influencing Python's design and forc

iterable terminology (for language lawyers)

2005-03-16 Thread Michele Simionato
According to the standand library (http://docs.python.org/lib/typeiter.html) an *iterable* is something with an __iter__ method. This means that strings are *not* iterable. However I can loop over a string without problem and I would say that an iterable is anything I can iterate over. Of course I

Re: SAX parsing problem

2005-03-16 Thread gh
In article <[EMAIL PROTECTED]>, David M. Cooke <[EMAIL PROTECTED]> wrote: > anon <[EMAIL PROTECTED]> writes: > > > So I've encountered a strange behavior that I'm hoping someone can fill > > me in on. i've written a simple handler that works with one small > > exception, when the parser encounte

Re: __getitem__ method on (meta)classes

2005-03-16 Thread Steven Bethard
Ron Garret wrote: In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: Yeah, except I actually left out one thing: I also want type(v)==e1. Why? In Python usually you rely on duck-typing and not explicit type checks. What is it that you're trying to gain by asserting type(

Re: __getitem__ method on (meta)classes

2005-03-16 Thread Steven Bethard
Steven Bethard wrote: py> class enum(object): ... class item(object): ... def __init__(self, val): ... self.val = val ... def __repr__(self): ... return 'enum.item(%r)' % self.val ... def __init__(self, vals): ... self.items = [type(self).item

Re: Itertools wishlists

2005-03-16 Thread TZOTZIOY
On Sun, 13 Mar 2005 06:52:40 GMT, rumours say that "Raymond Hettinger" <[EMAIL PROTECTED]> might have written: [snip of lots of stuff] >itertools.window() with n=2 got rejected. Almost all proposed uses had better >solutions (such as an accumulator variable or fibonacci sequence style logic: >a,

Re: code for Computer Language Shootout

2005-03-16 Thread F. Petitjean
Le Tue, 15 Mar 2005 23:21:02 -0800, Michael Spencer a écrit : > Jacob Lee wrote: >> On Tue, 15 Mar 2005 21:38:48 -0800, Michael Spencer wrote: >> >> Good call. >> >> > > How about this then: > > basetable = string.maketrans('ACBDGHKMNSRUTWVYacbdghkmnsrutwvy', > 'T

Re: Minidom empty script element bug

2005-03-16 Thread "Martin v. Löwis"
Derek Basch wrote: maybe you meant createTextNode? Yes, that's what I meant :-) However, it seems proper that XHTMLPrinter (or some other module) should allow the developer to use either normative or non-normative XHTML design guidlines to achieve some sane degree of HTML user agent compatablilty.

RE: Good use for Jython

2005-03-16 Thread Tertius Cronje
> Other than being used to wrap Java classes, what other real use is > there for Jython being that Python has many other GUI toolkits > available? Also, these toolkits like Tkinter are so much better for > client usage (and faster) than Swing, so what would be the advantage > for using Jython? or I

Re: unicode converting

2005-03-16 Thread Maxim Kasimov
Christos TZOTZIOY Georgiou wrote: If unicode_data references your unicode data, all you have to send is: unicode_data.encode('utf-16') # maybe utf-16be for network order is utf-16 string the same ucs-2? my question is how to get string encoded as UCS-2 -- Best regards, Maxim -- http://mail.python.

Re: Python becoming less Lisp-like

2005-03-16 Thread Paul Boddie
Steven Bethard <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > Certainly descriptors in the "wrong hands" could lead to confusing, > unreadable code. But Python is a "we're all adults here" language, and > so we have to trust other coders to be responsible. The problem is

Super job openings for Python users with MNC in B'LORE with onsite opportunities

2005-03-16 Thread nid2000kick
Hi all , I am Nidhi Shetty representing Quadrangle, Bangalore, a recruitment firm in Bangalore and this mail is to inform you guys of a very good job opening with one of my MNC clients . About the client : They are one of the biggest software company's in the world .Their products are of worldwi

Re: iterable terminology (for language lawyers)

2005-03-16 Thread Leif K-Brooks
Michele Simionato wrote: According to the standand library (http://docs.python.org/lib/typeiter.html) an *iterable* is something with an __iter__ method. This means that strings are *not* iterable. In general, the definitions people in the Python community tend to use are: Iterable: An object whic

{SPAM} Remote debugging

2005-03-16 Thread Gijs Korremans
Hi, For developing Python 2.3 applications I use Boa Constructor for debugging the application. This is working fine but now I want to debug an application on a remote PC (win 2003 server) installed as a NT Service. I know it is possible with Boa Constructor and HAP debugger but it doesn’t work

Re: Lisp-likeness

2005-03-16 Thread Peter Lewerin
Fred Gilham <[EMAIL PROTECTED]> wrote > > And Lisp's "macro language" isn't involved at all here. > Also, #' is a read-macro. A read-macro and a macro aren't the same thing. > Then there's the "defun" macro . . . . There is IMHO a difference between using a macro and using the "macro language

Re: Python becoming less Lisp-like

2005-03-16 Thread Torsten Bronger
HallÃchen! "news.sydney.pipenetworks.com" <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > >> [...] >> >> I have exactly the same impression, but for me it's the reason >> why I feel uncomfortable with them. For example, I fear that a >> skilled package writer could create a module with su

Re: About Databases...

2005-03-16 Thread Ola Natvig
Dennis Lee Bieber wrote: Firebird -- developed from Interbase 6, released last summer. Maybe "MaxDB by MySQL", developed from SAS DB (and likely available with similar licenses as MySQL -- I don't know if MySQL AB plan to merge SAS DB features into MySQL or the other way around ) It was cal

Re: iterable terminology (for language lawyers)

2005-03-16 Thread Raymond Hettinger
Michele Simionato] > According to the standand library > (http://docs.python.org/lib/typeiter.html) > an *iterable* is something with an __iter__ method. This means that > strings are *not* iterable. The referenced section also says, "Sequences, described below in more detail, always support the i

Re: iterable terminology (for language lawyers)

2005-03-16 Thread Michele Simionato
R. Hettinger wrote: > You're best bet is to quote the tutorial's glossary, > http://docs.python.org/tut/node18.html : Aha! That glossary looks like a nice new addition to the tutorial. Maybe the standard library and the language reference should link to it somewhere? (maybe there already such link

Re: Lisp-likeness

2005-03-16 Thread Fernando
On Wed, 16 Mar 2005 00:36:40 +0100, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote: > > >BTW, the fact that a closure refers to a variable itself rather to its >current value can be used to check the true attitude of languages with >respect to functional programming, by observing how they un

Re: Good use for Jython

2005-03-16 Thread Michael Hoffman
Mike Wimpe wrote: Other than being used to wrap Java classes, what other real use is there for Jython being that Python has many other GUI toolkits available? Also, these toolkits like Tkinter are so much better for client usage (and faster) than Swing, so what would be the advantage for using Jyth

Re: Accessing the contents of a 'cell' object from Python

2005-03-16 Thread Duncan Booth
Jeff Epler wrote: > Here's an old thread I contributed to which had a similar function > (called 'cell_get' in this case) > > http://groups-beta.google.com/group/comp.lang.python/browse_thread/thre > ad/baba3b943524a92c/71b57a32b311ffc8?q=func_closure#71b57a32b311ffc8 > http://groups-beta.google

Re: unicode study with unicodedata module

2005-03-16 Thread Xah Lee
here's a snippet of code that prints a range of unicode chars, along with their ordinal in hex, and name. chars without a name are skipped. (some of such are undefined code points.) On Microsoft Windows the encoding might need to be changed to utf-16. Change the range to see different unicode ch

Re: [perl-python] unicode study with unicodedata module

2005-03-16 Thread Xah Lee
Fuck google incorporated for editing my subject name without permission. and fuck google incorporated for editing my message content without permission. http://xahlee.org/UnixResource_dir/writ/responsible_license.html Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://

multiple import of a load of variables

2005-03-16 Thread Torsten Bronger
HallÃchen! I have a file that looks a little bit like a C header file with a long list of variables (actually constants) definitions, e.g. VI_ATTR_TIMO = 0x54378 ... Actually I need this in a couple of low-level modules that are imported into the main module, and in the main module itself. They

Re: multiple import of a load of variables

2005-03-16 Thread Fuzzyman
Torsten Bronger wrote: > Hallöchen! > > I have a file that looks a little bit like a C header file with a > long list of variables (actually constants) definitions, e.g. > > VI_ATTR_TIMO = 0x54378 > ... > > Actually I need this in a couple of low-level modules that are > imported into the main mod

Re: Turning String into Numerical Equation

2005-03-16 Thread Giovanni Bajo
Steven Bethard wrote: >> When __builtin__ is not the standard __builtin__, Python is in >> restricted execution mode. > > Do you know where this is documented? I looked around, but couldn't > find anything. I found some documentation in the reference of the (now disabled) modules for Restricted

Re: Lisp-likeness

2005-03-16 Thread Michele Simionato
Or, just to impress Lispers, >>> def add(x,y): ... return x + y >>> closures = [] >>> for i in range(10): ...closures.append(add.__get__(i)) ... >>> closures[5](1000) 1005 Remember, in Python do not have functions, we have descriptors! ;) Michele Simionato -- http:/

Re: code for Computer Language Shootout

2005-03-16 Thread Raymond Hettinger
Consider keeping the alias for append because it occurs in the innermost loop. For maximum readability, write: addline = seq.append Move the ''.join() to the show() function. That eliminates a little redundancy. The test dataset doesn't use the semi-colon comment field. So, consider reversin

Re: unicode converting

2005-03-16 Thread Serge Orlov
Maxim Kasimov wrote: > Christos TZOTZIOY Georgiou wrote: > > > > If unicode_data references your unicode data, all you have to send is: > > > > unicode_data.encode('utf-16') # maybe utf-16be for network order > > > is utf-16 string the same ucs-2? my question is how to get string > encoded as UCS-2

Re: getting data with proper encoding to the finish

2005-03-16 Thread Ksenia Marasanova
John, Serge, thanks for your help! utf-16le encoding didn't help. I had however to solve it yesterday, so I used csv module to create CSV file and then import it in Excel. Excel still had troubles with accented characters, but this is another story: it seems that Office 2004 Excel (for Mac, but I

Re: Python becoming less Lisp-like

2005-03-16 Thread news.sydney.pipenetworks.com
Torsten Bronger wrote: HallÃchen! "news.sydney.pipenetworks.com" <[EMAIL PROTECTED]> writes: Torsten Bronger wrote: [...] I have exactly the same impression, but for me it's the reason why I feel uncomfortable with them. For example, I fear that a skilled package writer could create a module wit

Mod_python installation: apache Warning

2005-03-16 Thread Andrea Fiore
Hello, i have compiled mod_python 2.7.10 on a Linux box with Apache 1.3.31, but after i restarted the web server, i had a strange warning that i did non understand ** bash-2.05b# apachectl configtest [Wed Mar 16 11:50:26 2005] [warn] Loaded DSO /usr/libexec/apache/mod_python.so uses plain Apac

Re: multiple import of a load of variables

2005-03-16 Thread Torsten Bronger
HallÃchen! "Fuzzyman" <[EMAIL PROTECTED]> writes: > [...] > > I'm not entirely clear what you are trying to do The following: "variables.py" looks like this a = 1 b = 2 Then I have helper_a.py, helper_b.py, and helper_c.py which begin with from variables import * And finally, my_module.py st

Re: multiple import of a load of variables

2005-03-16 Thread Fuzzyman
Torsten Bronger wrote: > Hallöchen! > > "Fuzzyman" <[EMAIL PROTECTED]> writes: > > > [...] > > > > I'm not entirely clear what you are trying to do > > The following: "variables.py" looks like this > > a = 1 > b = 2 > > Then I have helper_a.py, helper_b.py, and helper_c.py which begin > with > > f

Re: [Pmw] reusing a graph after deleting a curve

2005-03-16 Thread giacomo boffi
giacomo boffi <[EMAIL PROTECTED]> writes: > my question: is it possible to erase a graph, and reuse it? > > like in > > # x -> compute -> y > g=Pmw.Blt.Graph(); g.pack() > g.line_create(name,x,y) > # other computing -> a better y > # do something to g, erasing the previous plot > #[the above i

Re: getting data with proper encoding to the finish

2005-03-16 Thread Serge Orlov
Ksenia Marasanova wrote: > John, Serge, thanks for your help! > > utf-16le encoding didn't help. I had however to solve it yesterday, > so I used csv module to create CSV file and then import it in Excel. > Excel still had troubles with accented characters, but this is another > story: it seems t

Re: compiled open source Windows lisp (was Re: Python becoming less Lisp-like)

2005-03-16 Thread Carl Shapiro
"Brandon J. Van Every" <[EMAIL PROTECTED]> writes: > Last I looked, 2 years ago?, there were no compiled, open source lisps that > ran on Windows. Has this changed? I have a virtually completed port of CMUCL to Win32. And, if I was not busy organizing a Lisp conference, it would be publicly ava

Re: Turning String into Numerical Equation

2005-03-16 Thread Giovanni Bajo
Michael Spencer wrote: >> In fact, I believe my solution to be totally safe, > > That's a bold claim! I'll readily concede that I can't access > func_globals from restricted mode eval (others may know better). But > your interpreter is still be vulnerable to DOS-style attack from > rogue calcula

Re: unicode converting

2005-03-16 Thread TZOTZIOY
On 16 Mar 2005 02:53:12 -0800, rumours say that "Serge Orlov" <[EMAIL PROTECTED]> might have written: >3) There is a note in README: To compile >Python2.3 with Tkinter, you will need to pass --enable-unicode=ucs4 >flag to ./configure I thought this applied to Tkinter as pre-built on recent RedHat

Re: RotatingFileHandler and logging config file

2005-03-16 Thread news.sydney.pipenetworks.com
Rob Cranfill wrote: Kent Johnson wrote: It is in the latest docs. Kent No, it isn't. (But thanks for replying anyway!) http://docs.python.org/lib/logging-config-fileformat.html You're looking in the wrong place. Try http://docs.python.org/lib/node333.html Huy -- http://mail.python.org/mailman/

Re: About Databases...

2005-03-16 Thread Leif B. Kristensen
Peter A. Schott wrote: > PostGreSQL - good feature set, open source. Not sure on speed, but it > should run natively on Unix, Linux, and Win32 (not sure about BSD or > others). A lot of the core developers of PostgreSQL are apparently running *BSD. On the PostgreSQL-General mailing list, I've no

Re: Lisp-likeness

2005-03-16 Thread Michele Simionato
Carl Banks: > Python might lose when it comes to functional programming, > but it wins when it comes to nested functions like this (where a,b,c,d > are in the enclosing scope and presumably changing): > def print_variables(): >print a,b,c,d Yes, clearly if I have def toplevel(): a

Re: unicode converting

2005-03-16 Thread Maxim Kasimov
Serge Orlov wrote: utf-16 is basically a superset of ucs-2. See here for more detail: http://www.azillionmonkeys.com/qed/unicode.html If you ensure that ord() of each output character is < 0x1 you'll get valid ucs-2 output if you use utf-16 encoding. If you build python with --enable-unicode=uc

Re: About Databases...

2005-03-16 Thread PA
On Mar 16, 2005, at 12:59, Leif B. Kristensen wrote: Anyway, I'd recommend a closer study of PostgreSQL for anyone interested in a good RDBMS. Talking of which, I would recommend to take a serious look at FrontBase: http://www.frontbase.com/ Excellent database, running on pretty much anything. Whi

Re: Listbox fill=BOTH expand=YES (Tkinter)

2005-03-16 Thread TZOTZIOY
On Tue, 15 Mar 2005 16:48:17 +0300, rumours say that "Raseliarison nirinA" <[EMAIL PROTECTED]> might have written: >yes, indeed. import Tkconstants 'True' and 'YES' in dir(Tkconstants) >True > >thanks Harlin, I hope you also know that .>> 'inexistent keyword' and 'YES' in dir(Tkconsta

Re: unicode converting

2005-03-16 Thread Serge Orlov
Christos TZOTZIOY Georgiou wrote: > On 16 Mar 2005 02:53:12 -0800, rumours say that "Serge Orlov" > <[EMAIL PROTECTED]> might have written: > > >3) There is a note in README: To compile > >Python2.3 with Tkinter, you will need to pass --enable-unicode=ucs4 > >flag to ./configure > > I thought this

Re: Lisp-likeness

2005-03-16 Thread Pascal Bourguignon
[EMAIL PROTECTED] (Peter Lewerin) writes: > Fred Gilham <[EMAIL PROTECTED]> wrote > > > > And Lisp's "macro language" isn't involved at all here. > > > Also, #' is a read-macro. > > A read-macro and a macro aren't the same thing. > > > Then there's the "defun" macro . . . . > > There is IMHO

Re: Lisp-likeness

2005-03-16 Thread Marcin 'Qrczak' Kowalczyk
"Carl Banks" <[EMAIL PROTECTED]> writes: >> BTW, the fact that a closure refers to a variable itself rather to >> its current value can be used to check the true attitude of >> languages with respect to functional programming, by observing how >> they understand their basic loops :-) > Closing on

Re: unicode converting

2005-03-16 Thread TZOTZIOY
On 16 Mar 2005 04:21:16 -0800, rumours say that "Serge Orlov" <[EMAIL PROTECTED]> might have written: >> On Windoze, Mandrake and SuSE python has UCS-2 >> unicode and Tkinter is working just fine. > >Did you build python on Mandrake and SuSE yourself? I had an impression >that ucs-4 builds are pre

Re: Lisp-likeness

2005-03-16 Thread Carl Banks
Michele Simionato wrote: > Carl Banks: > > If Python did it the way Scheme did, this would be pretty useless. > > But notice that Scheme has no problems whatsoever: > > (define (toplevel) > (define a 1) > (define (f) > (display a)) > (set! a 2) > (f)) > > (toplevel) > > prints 2 the sa

Re: Why tuple with one item is no tuple

2005-03-16 Thread Antoon Pardon
Op 2005-03-16, Tim Roberts schreef <[EMAIL PROTECTED]>: > Gregor Horvath <[EMAIL PROTECTED]> wrote: >> >> >>>type(['1']) >> >> >> >>>type(('1')) >> >> >>I wonder why ('1') is no tuple > > There were lots of answers, but I'm not sure I saw the "why" addressed. > > Consider this: > > a = (3 +

Re: Lisp-likeness

2005-03-16 Thread Carl Banks
Marcin 'Qrczak' Kowalczyk wrote: > The issue is about the semantics of loops: whether they introduce > a new variable for each iteration, or change the value of a single > variable. Yes, I see what you are saying now. Good point. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/pyth

Re: Why tuple with one item is no tuple

2005-03-16 Thread Diez B. Roggisch
>> Consider this: >> a = (3 + 5) * 5 >> You really, really want (3 + 5) to be an integer, not a one-item tuple. > > I sometimes do wonder if some impliciteness wouldn't be better here, > so that any item could be treated as if it was a one-item tuple. > > A bit like every char being a string

Re: ElementTree/DTD question

2005-03-16 Thread Fredrik Lundh
Greg Wilson wrote: > My first attempt was this XML file: > > -- > > > > ]> > > > > Write an introduction&ldots; > > > > > -- > > Running "python valida

Re: Lisp-likeness

2005-03-16 Thread Jacek Generowicz
"Carl Banks" <[EMAIL PROTECTED]> writes: > Michele Simionato wrote: > > Carl Banks: > > > If Python did it the way Scheme did, this would be pretty useless. > > > > But notice that Scheme has no problems whatsoever: > > > > (define (toplevel) > > (define a 1) > > (define (f) > > (display a

Re: Downloading all files older than 3 hours from a ftp-server.

2005-03-16 Thread Fredrik Lundh
Christos TZOTZIOY Georgiou wrote: > ISTR seeing a parsedate (or similar) for ftp sites by the effbot, but I am not > sure. you can get bindings for http://cr.yp.to/ftpparse.html from http://c0re.23.nu/c0de/ftpparsemodule/ or http://effbot.org/downloads/#ftpparse -- http://

Re: why this error?

2005-03-16 Thread Fredrik Lundh
"spencer" <[EMAIL PROTECTED]> wrote: > I'm not sure why I can't concatenate dirname() with basename(). > > Traceback (most recent call last): > File "showDir.py", line 50, in ? >print 'somthing new...', os.path.join(os.path.dirname(os.getcwd)) + > os.path.basename(os.getcwd()) > File "/usr/l

Getting current variable name

2005-03-16 Thread pl
Hi all, I followed the mails entitled 'How to turn a variable name into a string?' in march 2005 posts as I have a similar problem. I have to get some list variable names at some point in my program. So I ended up looking into globals() to get them with a small function like this: #!/usr/bin/pyth

pyXPCOM with mozilla 1.7 + python 2.4

2005-03-16 Thread Ola Natvig
Hi all Lately I've been trying to compile pyXPCOM on my windows machine. But I've successfully compiled mozilla without pyXPCOM but when I adds the pyXPCOM module the build fails with this message: Error message: d:/test\moz\mozilla\extensions\python\xpcom\src\VariantUtils.cpp(1151) : error C266

Re: Lisp-likeness

2005-03-16 Thread Michele Simionato
> I'm surprised that Michele >hasn't yet referenced the thread where we exposed the gory details, as >was his custom for a while :-) >Message-ID: <[EMAIL PROTECTED]>, for >this particular >aspect, in case anyone gives a monkey's left testicle. I had forgot the title of that thread and also I wante

Re: Why tuple with one item is no tuple

2005-03-16 Thread Antoon Pardon
Op 2005-03-16, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >>> Consider this: >>> a = (3 + 5) * 5 >>> You really, really want (3 + 5) to be an integer, not a one-item tuple. >> >> I sometimes do wonder if some impliciteness wouldn't be better here, >> so that any item could be treated as if

computing a weighted sum

2005-03-16 Thread andreif
Suppose I have a list of n floats x and a list of n floats w and I want to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. Is there some elegant expression (perhaps using lambda) to have it done in one statement ? As in : y = lambda x,w : ... I ask because the way I am doing it now : y = 0

Re: computing a weighted sum

2005-03-16 Thread Will McGugan
[EMAIL PROTECTED] wrote: Suppose I have a list of n floats x and a list of n floats w and I want to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. Is there some elegant expression (perhaps using lambda) to have it done in one statement ? As in : y = lambda x,w : ... I ask because the way I am doing i

Re: computing a weighted sum

2005-03-16 Thread Duncan Booth
wrote: > Suppose I have a list of n floats x and a list of n floats w and I want > to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. > > Is there some elegant expression (perhaps using lambda) to have it done > in one statement ? As in : > y = lambda x,w : ... >>> x = [1, 2, 3] >>> w = [4, 5, 6]

Re: Getting current variable name

2005-03-16 Thread Daniel Dittmar
pl wrote: I have to get some list variable names at some point in my program. So I ended up looking into globals() to get them with a small function like this: [...] var = globals().keys() for i in var : if globdict[i] == obj: print i Use 'is'

Re: Why tuple with one item is no tuple

2005-03-16 Thread Diez B. Roggisch
> That ambiguity is only caused because python uses the same characters > for very different operations and to be honest I don't like that. As I said: show me which parentheses to use - and keep in mind that: - < and > are for comparisions and the same ambiguity troubles arise - unicode surely

Re: Good use for Jython

2005-03-16 Thread Tom Willis
On 15 Mar 2005 23:54:16 -0800, Mike Wimpe <[EMAIL PROTECTED]> wrote: > Other than being used to wrap Java classes, what other real use is > there for Jython being that Python has many other GUI toolkits > available? Also, these toolkits like Tkinter are so much better for > client usage (and faster

Re: computing a weighted sum

2005-03-16 Thread andreif
Thanks Will, the 2.4 expression looks really nice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Turning String into Numerical Equation

2005-03-16 Thread Steven Bethard
Giovanni Bajo wrote: In fact, the documentation for eval() could be improved to explain the benefits of setting __builtins__ in the globals. Well, if you think you're pretty clear on what's happening, a patch is always appreciated. =) I have a feeling that the docs are at least partially vague b

Re: computing a weighted sum

2005-03-16 Thread TZOTZIOY
On 16 Mar 2005 06:49:09 -0800, rumours say that [EMAIL PROTECTED] might have written: >Suppose I have a list of n floats x and a list of n floats w and I want >to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. > >Is there some elegant expression (perhaps using lambda) to have it done >in one statement ?

Re: Why tuple with one item is no tuple

2005-03-16 Thread Daniel Dittmar
Diez B. Roggisch wrote: for instance I have written once somekind of vector class where it was natural for these vectors to be added as well as te be concatenated. Unfortunately python uses "+" for both so I had no way to have both operators in a natural way in python. And no way in mathematics or

Re: Getting current variable name

2005-03-16 Thread Steven Bethard
pl wrote: I followed the mails entitled 'How to turn a variable name into a string?' in march 2005 posts as I have a similar problem. I have to get some list variable names at some point in my program. So I ended up looking into globals() to get them with a small function like this: #!/usr/bin/pyth

Re: computing a weighted sum

2005-03-16 Thread Steven Bethard
Will McGugan wrote: In Python 2.3 sum( [ _x * _w for _x, _w in zip( x, w ) ] ) or in 2.4 sum( _x * _w for _x, _w in zip( x, w ) ) Any reason for the leading underscores? If you're trying to avoid polluting your namespace, you should note that generator expressions don't leak their loop variables

Re: Why tuple with one item is no tuple

2005-03-16 Thread Steven Bethard
Daniel Dittmar wrote: But what the heck, I find list comprehension rather awful. Sacrilege! ;) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-16 Thread Diez B. Roggisch
> I think he meant that Python should have introduced different operators > for addition and sequence concatenation. I reread his example and have to admit I'm confused: He complains about having written his _own_ vector class - and concatenation and addition had to use both + ? He could have use

Writing C readable bitfield structs?

2005-03-16 Thread phark52
How would I go about writing a bitfield that can be read by my C app? I want to pack a few bools into one int. I know an extended module exists (npstruct) which helps you do this but I want to do it manually or using one of the standard modules. -- http://mail.python.org/mailman/listinfo/python-

Mark attribute as read-only

2005-03-16 Thread Florian Lindner
Hello, how can I mark a attribute of a class as read-only (for non classmembers)? Yes, stupid question, but the docu gave me no help. Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

[OT] Re: Python becoming less Lisp-like

2005-03-16 Thread Brian van den Broek
news.sydney.pipenetworks.com said unto the world upon 2005-03-16 05:57: trust the guy to do a good job. If you don't, then you can write it yourself which means you can do exactly how you want it which again makes the whole argument mute. Anyone else having images of mimes engaged in street figh

Re: computing a weighted sum

2005-03-16 Thread andreif
Even if language permits sum(x*w for x, w in zip(x, w)) would seem confusing for anyone watching the code Maybe sum(xi*wi for xi, wi in zip(x, w)) would be more appropiate Andrei -- http://mail.python.org/mailman/listinfo/python-list

How to add a shapefile to an existing ArcMap 9.x project using Python?

2005-03-16 Thread syed_saqib_ali
Hi. I have an Instance of ArcMap 9.0 running. I also have a shapefile named myShape (actually corresponding to 4 files on the disk: myShape.dbf, myShape.shp, myShape.pnt and myShape.shx) I would like to write some Python code that inserts myShape into the running instance of ArcMap9.0 as

Re: Minidom empty script element bug

2005-03-16 Thread Derek Basch
Cross post from XML-SIG: --- Walter Dörwald <[EMAIL PROTECTED]> wrote: > Martin v. Löwis sagte: > > Derek Basch wrote: > > >[...] > >> How do I get minidom to NOT render an empty script element? Should I > submit a bug report? > > > > That said, I think there is a simple solution: add an empty Tex

Re: Mark attribute as read-only

2005-03-16 Thread Steven Bethard
Florian Lindner wrote: how can I mark a attribute of a class as read-only (for non classmembers)? Yes, stupid question, but the docu gave me no help. Declare it as such in the documentation. ;) If you want to provide error messages, you could alternatively define a property: py> class C(object):

Re: __getitem__ method on (meta)classes

2005-03-16 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Steven Bethard <[EMAIL PROTECTED]> wrote: > > > >>>Yeah, except I actually left out one thing: I also want type(v)==e1. > >> > >>Why? In Python usually you rel

Re: Writing C readable bitfield structs?

2005-03-16 Thread Larry Bates
[EMAIL PROTECTED] wrote: > How would I go about writing a bitfield that can be read by my C app? I > want to pack a few bools into one int. > > I know an extended module exists (npstruct) which helps you do this but > I want to do it manually or using one of the standard modules. > struct.pack is

_conditionally_ returning to point where exception was raised?

2005-03-16 Thread MackS
Hi I'm new to Python and would like to know if the following is possible. Say I have one lower-level object A and one user-interface object B. Suppose B.CallingMethod() calls A.CalledMethod(), the latter method stumbles upon an IO error and raises an exception. The calling method detects the exce

Re: will it cause any problems to open a read-only file & not close it?

2005-03-16 Thread Jeff Shannon
Tim Roberts wrote: Sara Khalatbari <[EMAIL PROTECTED]> wrote: Dear friends In a code, I'm opening a file to read. Like : lines = open(filename).readlines() & I'm never closing it. I'm not writing in that file, I just read it. Will it cause any problems if you open a file to read & never close it

Re: [OT] Who Knows of a Good Computational Physics Textbook?

2005-03-16 Thread Dan Sommers
Thank you beliavsky, Sean, and Scott for the pointers. Regards, Dan -- Dan Sommers Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: code for Computer Language Shootout

2005-03-16 Thread Michael Spencer
F. Petitjean wrote: Le Tue, 15 Mar 2005 23:21:02 -0800, Michael Spencer a écrit : def output(seq, linelength = 60): if seq: iterseq = iter(seq) while iterseq: print "".join(islice(iterseq,linelength)) I suppose you mean : print "".join( str(item) for item

Re: Python becoming less Lisp-like

2005-03-16 Thread Kay Schluehr
Torsten Bronger wrote: > Hallöchen! Moin! > [First, I wanted to say "descriptors" instead of "decorators" (I > superseded my post).] > > The goal is to trigger function calls when attributes are accessed. > This is called properties in C# (and maybe in Ruby, too). Python > now also has this conc

importerror all 3rd party modules

2005-03-16 Thread nyiann
Hi, Brand new to python. I am trying to install the py2exe modeule, and when I run scripts (simple ones I've made, and examples) I get an importerror. At the python command line I type: import py2exe and get: 'ImportError: no module named py2exe So installed everything on my laptop (windows me)

Re: compiled open source Windows lisp (was Re: Python becoming less Lisp-like)

2005-03-16 Thread Brandon J. Van Every
Carl Shapiro wrote: > "Brandon J. Van Every" <[EMAIL PROTECTED]> > writes: > >> Last I looked, 2 years ago?, there were no compiled, open source >> lisps that ran on Windows. Has this changed? > > I have a virtually completed port of CMUCL to Win32. [etc] Ah, so you're the brave lad I heard abou

Access denied calling FireEvent in Python

2005-03-16 Thread calfdog
Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an "access denied" error in Python when called. Here is what I am trying to do: Set the "campus" listbox value and theb call fire event, such as in the code below. I

Re: _conditionally_ returning to point where exception was raised?

2005-03-16 Thread infidel
There's no "Resume Next" in python. Once you catch an exception, the only way you can go is forward from that point. So if B.CallingMethod catches an exception that was raised in A.CalledMethod, all it could do is try calling A.CalledMethod again, it can't jump back to the point where the excepti

Re: _conditionally_ returning to point where exception was raised?

2005-03-16 Thread Bengt Richter
On 16 Mar 2005 09:53:11 -0800, "MackS" <[EMAIL PROTECTED]> wrote: >Hi > >I'm new to Python and would like to know if the following is possible. > >Say I have one lower-level object A and one user-interface object B. >Suppose B.CallingMethod() calls A.CalledMethod(), the latter method >stumbles upo

When is a thread garbage collected?

2005-03-16 Thread Kent Johnson
If I create and start a thread without keeping a reference to the thread, when is the thread garbage collected? What I would like is for the thread to run to completion, then be GCed. I can't find anything in the docs that specifies this behavior; nor can I think of any other behaviour that seem

Re: Writing C readable bitfield structs?

2005-03-16 Thread Cappy2112
there is a bitfiled mainpulator class inthe Cookbook, but I don't understand his explanation, and the example given doesn't really show off the features of the class. I too need bit-level manipulation, and will probably have to write my own class to do it. -- http://mail.python.org/mailman/listi

Re: Writing C readable bitfield structs?

2005-03-16 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Cappy2112 <[EMAIL PROTECTED]> wrote: >there is a bitfiled mainpulator class inthe Cookbook, but I don't >understand his explanation, and the example given doesn't really show >off the features of the class. I assume you're talking about the struct module? If you gi

  1   2   >