Where to put the import command in the file?

2007-10-02 Thread wang frank
Hi, I am writing Python script now. The project will grow bigger in future. I need to import some packages for several functions, such as numpy. Where is the best plalce to put the import numpy command? Is it fine to put on the first line in the file? Is it better to put it into each function

logging module and trailing newlines

2007-10-02 Thread Russell Warren
I was just setting up some logging in a make script and decided to give the built-in logging module a go, but I just found out that the base StreamHandler always puts a newline at the end of each log. There is a comment in the code that says "The record is then written to the stream with a trailin

Re: List Question

2007-10-02 Thread Paul McGuire
On Oct 2, 4:20 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Oct 2, 10:06 pm, brad <[EMAIL PROTECTED]> wrote: > > > How is this expressed in Python? > > > If x is in y more than three times: > > print x > > > y is a Python list. > > Simple and readable: > if len([a for a in y if x == a]) > 3

global variables

2007-10-02 Thread TheFlyingDutchman
Does anyone know how the variables label and scale are recognized without a global statement or parameter, in the function resize() in this code: #!/usr/bin/env python from Tkinter import * def resize(ev=None): label.config(font='Helvetica -%d bold' % \ scale.get()) top = Tk(

Re: List Question

2007-10-02 Thread Paul McGuire
On Oct 2, 4:58 pm, Pablo Ziliani <[EMAIL PROTECTED]> wrote: > Paul Hankin wrote: > > On Oct 2, 10:06 pm, brad <[EMAIL PROTECTED]> wrote: > > >> How is this expressed in Python? > > >> If x is in y more than three times: > >> print x > > >> y is a Python list. > > > Simple and readable: > > if

Re: module confusion

2007-10-02 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Robert > Kern wrote: > >> Not all of the modules in a package are imported by importing the >> top-level package. > > You can't import packages, only modules. > >> os.path is a particularly weird case because it is just an alias to the

Re: Using fractions instead of floats

2007-10-02 Thread richyjsm
On Oct 2, 5:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > But it is still wrong to say "0.6 is definitely not the same as 3/5". Out of context, I'd certainly agree. But from the context, I assumed it was clear that the 0.6 was a Python float. I probably should have made this clearer.

Re: global variables

2007-10-02 Thread Carsten Haese
On Tue, 2007-10-02 at 15:20 -0700, TheFlyingDutchman wrote: > Does anyone know how the variables label and scale are recognized > without a global statement or parameter, in the function resize() in > this code: > [...] The answer to your question is "Yes." -- Carsten Haese http://informixdb.sou

Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)

2007-10-02 Thread Paul Boddie
On 2 Okt, 22:35, bramble <[EMAIL PROTECTED]> wrote: > > Ahh... Ok. Thanks, that explains it. At first, it hadn't ocurred to me > that anyone would want to provide a GUI toolkit binding along with a > popular general purpose programming language implementation. Moreover, > it *really* wouldn't occur

Re: readline() - problem

2007-10-02 Thread Ricardo Aráoz
Paul Hankin wrote: > On Oct 2, 12:25 pm, [EMAIL PROTECTED] wrote: >> Hi! >> I'm a new user of python, and have problem. >> I have a plain ascii file: >> 11..1 >> 12..1 >> 11..1 >> I want to create a new file which contains only lines with '1' on 15th

Re: Using fractions instead of floats

2007-10-02 Thread [EMAIL PROTECTED]
On Oct 2, 5:43 pm, [EMAIL PROTECTED] wrote: > On Oct 2, 5:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > But it is still wrong to say "0.6 is definitely not the same as 3/5". > > Out of context, I'd certainly agree. But from the context, I assumed > it was clear that the 0.6 was a Pyt

Re: global variables

2007-10-02 Thread Steven Bethard
TheFlyingDutchman wrote: > Does anyone know how the variables label and scale are recognized > without a global statement or parameter, in the function resize() in > this code: [snip] > def resize(ev=None): > label.config(font='Helvetica -%d bold' % \ > scale.get()) You're just cal

Re: Using fractions instead of floats

2007-10-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > On Oct 2, 1:12 am, Robert Kern <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> How does gmpy make the conversion from float to rational? >> gmpy has a configurable transformation between floats and the internal >> representation. I believe the default goes thr

Re: global variables

2007-10-02 Thread Erik Jones
On Oct 2, 2007, at 5:20 PM, TheFlyingDutchman wrote: > Does anyone know how the variables label and scale are recognized > without a global statement or parameter, in the function resize() in > this code: > > > > #!/usr/bin/env python > > from Tkinter import * > > def resize(ev=None): > lab

Re: global variables

2007-10-02 Thread Colin J. Williams
TheFlyingDutchman wrote: > Does anyone know how the variables label and scale are recognized > without a global statement or parameter, in the function resize() in > this code: > > > > #!/usr/bin/env python > > from Tkinter import * > > def resize(ev=None): > label.config(font='Helvetica

Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)

2007-10-02 Thread bramble
On Oct 2, 11:07 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > PyGtk has poor cross platform support, a very large footprint (the > largest of all these libraries) as well as a complicated runtime > environment. What's complicated about it? -- http://mail.python.org/mailman/listinfo/python-li

Django for database driven web application is OK?

2007-10-02 Thread cuongvt
Hello I'm new to both Django and Python. I'm mainly developing on PHP. I tend to move to Django. But I want to confirm as below: I heard that Django is mainly used for something like content management, CMS or something like that and Rails is mainly for web applications. So my question: is it

Re: Question about quoting style.

2007-10-02 Thread Steve Holden
James Stroud wrote: > Bruno Desthuilliers wrote: >> First point is that Python has no "variable interpolation". > > If you squint, it kind of does*: > > >>> print '%(language)s has %(#)03d quote types.' % \ > {'language': "Python", "#": 2} > Python has 002 quote types. > >

Re: Select as dictionary...

2007-10-02 Thread Steve Holden
Abandoned wrote: > Also if i need a list id what can i do ? > > aia.execute("SELECT id, w from list") > links=aia.fetchall() > > I want to.. > > idlist=[1, 2, 3] ( I don't want to use FOR and APPEND because the > query have 2 million result and i want to speed) > It may not be practical for you

hello! I am a spammer

2007-10-02 Thread panguohua
more information for making money with your blog www.space666.com goodwebsite for making money www.space666.com -- http://mail.python.org/mailman/listinfo/python-list

Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)

2007-10-02 Thread Grant Edwards
On 2007-10-02, Chris Mellon <[EMAIL PROTECTED]> wrote: > PyGtk has poor cross platform support, a very large footprint (the > largest of all these libraries) It's larger than wxWidgets on top of Gtk? > as well as a complicated runtime environment. It's probably > the closest to suitable for stan

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Kamen TOMOV wrote: > On Sun, Sep 30 2007, Klaus Schilling wrote: > >> private property is unethical > > How I craved to read that! > > Viva la revolution! Ewige Blumenkraft! French-Canadian bean soup! -- http://mail.python.org/mailman/listinfo/python-list

Can't seem to find a Python Key detector.

2007-10-02 Thread Lamonte Harris
I'm looking for a module that acts on the input of the keyboard. Something similar to pygame's key events, but something just easier to use not based on pygame stuff. If that makes any since. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using fractions instead of floats

2007-10-02 Thread Gabriel Genellina
En Tue, 02 Oct 2007 01:59:35 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribi�: > How does gmpy make the conversion from float to rational? Well, you know, these days valuable software usually comes with something people call "documentation". Incomprehensible documents in strange formats

Re: hello! I am a spammer

2007-10-02 Thread Nigel Rowe
On Wed, 3 Oct 2007 11:17, panguohua wrote in comp.lang.python > more information for making money with your blog Wow! Truth in advertising! -- Nigel Rowe A pox upon the spammers that make me write my address like.. rho (snail) fisheggs (stop) name -- http://mai

Re: LastWriteTime in windows registry

2007-10-02 Thread Gabriel Genellina
En Tue, 02 Oct 2007 04:20:47 -0300, Tim Golden <[EMAIL PROTECTED]> escribi�: > Peters, Matthew J. ET3 wrote: >> I'm looking for a way to read the lastwritetime property of >> a windows registry key. ... I found the function in perl > > So what does the Perl source say? It presumably

Re: setuptools without unexpected downloads

2007-10-02 Thread Gabriel Genellina
En Tue, 02 Oct 2007 10:11:24 -0300, <[EMAIL PROTECTED]> escribi�: > Holden indicates that VS2003 is the current compiler used for the > official Python distribution. Do you know how to use that program to > compile an exe? Open the program, press F1 and read the documentation provided by its ve

Re: win32com COMAdminCatalogObject Value method

2007-10-02 Thread Gabriel Genellina
En Tue, 02 Oct 2007 12:12:09 -0300, rc <[EMAIL PROTECTED]> escribi�: >> Try objCOMAdminCatalogObject.SetValue("ID", AppID). > When I try that I get exception: > AttributeError: Add.SetValue I think you would get more help asking in [EMAIL PROTECTED] -- Gabriel Genellina -- http://mail.python.

Re: Using fractions instead of floats

2007-10-02 Thread [EMAIL PROTECTED]
On Oct 2, 10:12?pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 02 Oct 2007 01:59:35 -0300, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> escribi : > > > How does gmpy make the conversion from float to rational? > > Well, you know, these days valuable software usually comes with something

Re: s.split() on multiple separators

2007-10-02 Thread [david]
Gabriel Genellina wrote: > En Sun, 30 Sep 2007 16:16:30 -0300, <[EMAIL PROTECTED]> escribi�: > >>> From my POV, if I want sequence from here to there, it should include >> both here and there. >> >> I do understand the consequences of making high bound exclusive, which >> is more elegant code: xra

Re: Where to put the import command in the file?

2007-10-02 Thread Gabriel Genellina
En Tue, 02 Oct 2007 19:01:27 -0300, wang frank <[EMAIL PROTECTED]> escribi�: > I am writing Python script now. The project will grow bigger in future. > I need to import some packages for several functions, such as numpy. > Where is the best plalce to put the import numpy command? Is it fine

Re: hello! I am a spammer

2007-10-02 Thread Danyelle Gragsone
Ok this is dead.. move along people.. nothing to see here.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and SSL

2007-10-02 Thread Johny
Thank you all for your replies. I am still a newbie with SSL issues but I found out that: a certificate that is signed by OpenSSL's own CA( certification authority), that is not recognized in the program's list of root CAs, causes an exception to be raised. (That is a different behaviour from the

Re: Can't seem to find a Python Key detector.

2007-10-02 Thread Gabriel Genellina
En Wed, 03 Oct 2007 00:02:03 -0300, Lamonte Harris <[EMAIL PROTECTED]> escribi�: > I'm looking for a module that acts on the input of the keyboard. > Something > similar to pygame's key events, but something just easier to use not > based > on pygame stuff. If that makes any since. This w

Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)

2007-10-02 Thread Martin v. Löwis
> So, that leaves me wondering, why is Tkinter still getting so much > focus in the Python standard library? > > Maybe a better question is, how has Tk managed to keep beating up the > newer, more modern, more featureful, better documented toolkits > encroaching on his territory? What's Tk's secre

Re: Python and SSL

2007-10-02 Thread Martin v. Löwis
> a certificate that is signed by OpenSSL's own CA( certification > authority), that is not recognized in the program's list of root CAs, > causes an exception to be raised. What is "the program"? What programming language is it written in? What library does it use to maintain a list of root CAs,

Re: List Question

2007-10-02 Thread Bruno Desthuilliers
brad a écrit : > How is this expressed in Python? > > If x is in y more than three times: > print x > > y is a Python list. if y.count(x) > 3: print x -- http://mail.python.org/mailman/listinfo/python-list

Re: global variables

2007-10-02 Thread Bruno Desthuilliers
Colin J. Williams a écrit : > TheFlyingDutchman wrote: >> Does anyone know how the variables label and scale are recognized >> without a global statement or parameter, in the function resize() in >> this code: >> >> >> >> #!/usr/bin/env python >> >> from Tkinter import * >> >> def resize(ev=None):

<    1   2