Re: Numbers in python

2006-03-10 Thread neildunn
If your still worried by using floats for your values you may wish to look into the decimal module: http://docs.python.org/lib/module-decimal.html Example: >>> from decimal import Decimal >>> Decimal(2) + Decimal('1.47') Decimal("3.47") Regards, Neil -- http://mail.python.org/mailman/listinf

operator creation?

2006-03-10 Thread Gerardo Herzig
Hi all. Ill try to explain mi situation: Lets say i have an DB object, who implements the querys to the database trough a method called DBObject.doQuery. On the other hand, i have 50 sql functions stored in the database. So i can call DBObject.doQuery('select * from my_sql_function()')...Ok, what

Re: Python and C

2006-03-10 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I was a C Programmer for a while. Lately started to learn Python for > one small project at school. I joined a small company where they use > C++ for development. > > Can we use Python and C together ? I mean create some classes in Python > and some number crunching a

Re: Python Evangelism

2006-03-10 Thread Paul Boddie
John Pote wrote: > > Over this side of the pond the good old British Post Office changed its name > to 'Consignia' in 2001. I thought it was actually the Royal Mail, but the brand history can be found here: http://www.royalmailgroup.com/aboutus/aboutus8.asp The fact that people confuse "Royal Ma

Re: why use special config formats?

2006-03-10 Thread Steve Holden
[EMAIL PROTECTED] wrote: > if you are really so scared of letting others exploit your config > scripts, then use the second, pickled fashion. that way you can store > the file at $HOME/blah-config.pkl, and everybody's happy. > Except the user who wants to edit the config file. > still, my point i

Re: Numbers in python

2006-03-10 Thread Steve Holden
[EMAIL PROTECTED] wrote: > 'It certainoly does _not_ return 1.0 - it returns 1. And that is all it > can > return for being an integer that has by definition no fractional part. > ' > > For goodness sake, it was a typo, I'm so sorry! > Guess that's what you get for calling yourself "brainy_muppet

Re: processing the genetic code with python?

2006-03-10 Thread Steve Holden
[EMAIL PROTECTED] wrote: > >>I'm writing your name down and this is the last time I'm doing homework >>for you. >> >>James >> >> > > > Wow, you are really a pretentious asshole. If you don't want to provide > people with help, don't bother. > > And that code's incorrect anyway. > So a smiley

Excel Object Model

2006-03-10 Thread david brochu jr
Hello,   I am trying to automate Excel and I cant seem to find out much relating to it's object model (in relation to Python)..seems as if its mostly covered by C and VB. Can anyone point me in the right direction? I am able to open excel, add information to cells, and then save and close the book

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Diez B. Roggisch
> Those default values are not 0 and , you may have > only experience with situations where they behave as such but that > is not the same. Well, it might be - but the conceptual behavior is (usually) the same. > If you need to know these values then you will need to know them > just as much whe

Re: suse linux 10 and wx.listctrl display issues

2006-03-10 Thread Eric Davis
Put this in your main function before you instantiate your wx.App. if platform.system() == 'Linux': try: del os.environ['GTK_RC_FILES'] del os.environ['GTK2_RC_FILES'] except ValueError: pass This is a problem with Su

Re: Performance impact of using decorators

2006-03-10 Thread Steve Holden
vinjvinj wrote: > I'm building an application with cherrypy and have started using > decorators quite extensively. A lot of my exposed functions look like: > > @expose > @startTransactrionAndBuildPage > @partOfTabUi(tabId) > @convert(arg1=int, arg2=str) > def do_main_page(self, arg1, arg2): >s

[How to change redirect stderr?]

2006-03-10 Thread Moretti
Hello, I would like to be able to change the standard error path. How can I do this in a script if I want to send error messages to /dev/null by example ? Thanks -- Sebastien Moretti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and C

2006-03-10 Thread David Boddie
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: > C is the lowest, most fundamental level of extension, but there are many > other alternatives -- SWIG to wrap existing libraries, Boost or SCXX or > SIP to wrap specifically C++ with very different philosophies (template > heavy, minimal, Qt-base

Re: why use special config formats?

2006-03-10 Thread Joel Hedlund
I agree with Steve and I agree Sybren. Also: This is a Bad Idea, since you should never add more complexity than needed. Imports, computation, IO and so on are generally not needed for program configuration, so standard configfile syntax should therefore not allow it. Otherwise you may easily

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Roy Smith
Antoon Pardon <[EMAIL PROTECTED]> wrote: >Do you have trouble remembering that range(n) is actually providing the >second parameter to the function and what it does? Yes. I don't use range() everyday, and it's very rare that I use more than one argument. I do remember that there are additional

Re: Python Evangelism

2006-03-10 Thread Steve Holden
Paul Boddie wrote: > John Pote wrote: > >>Over this side of the pond the good old British Post Office changed its name >>to 'Consignia' in 2001. > > > I thought it was actually the Royal Mail, but the brand history can be > found here: > > http://www.royalmailgroup.com/aboutus/aboutus8.asp > >

Re: [How to change redirect stderr?]

2006-03-10 Thread JuHui
how about $ python test.py 2> /dev/null ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > but nobody seems to have > a problem with range(n) where n suddenly is the second parameter and > we use the default for the first. Actually, I consider the unique calling pattern for x/range to be something of a wart

Re: Does -U option really exist?

2006-03-10 Thread Fredrik Lundh
Petr Prikryl wrote: > > As for dropping the u prefix on string literals: > > Just try the -U option of the interpreter some time, > > which makes all string literals Unicode. If you manage > > to get the standard library working this way, you > > won't need a per-file decision anymore: just start

Re: Python Evangelism

2006-03-10 Thread Benny
Paul Boddie wrote: > Bizarre names may be cute (to some people) but they don't lend > themselves to guessing or searching. Consequently, people who want > answers yesterday aren't likely to be amused to eventually discover > that the name of the resource they've been looking for is some opaque, >

python 2.4 logging module

2006-03-10 Thread Pramod
Hi All, How can I remove an Instance of logger ? I need this feature in one of my script where I need to associate each time logger instance to different handler. Thanks in advance Pramod -- http://mail.python.org/mailman/listinfo/python-list

Re: [How to change redirect stderr?]

2006-03-10 Thread Fredrik Lundh
"Moretti" wrote: > I would like to be able to change the standard error path. (I'm not sure path is the right word here, really, but never mind...) > How can I do this in a script if I want to send error messages to /dev/null > by example ? if you're talking about things that Python prints to s

Re: Performance impact of using decorators

2006-03-10 Thread vinjvinj
>> solution. I'm not going to tell you that decorators aren't the answer to >>all programming problems, because you already know that in your heart :- I was fearing that. The expose decorator is the only one that comes with cherrypy. The other ones are mine and are of the format: def decorator(fu

pyc file usage in a multi OS environment ( newbe question)

2006-03-10 Thread HajoEhlers
Hi folks, i have an failover environment for a python application which can fail-over to a AIX, Sun or Linux Box. At the moment the python interpreter ( 2.4.2 on all platforms ) and the application are installed localy but all data and configuration are on a shared location ( NFS/GPFS) So far no pr

Re: why use special config formats?

2006-03-10 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > isn't python suitable enough to hold your configuration? that depends on the target application, and, more importantly, the target audience and what kind of configuration they're expected to do. there's no "one rule to rule them all" for configuration issues. (excep

Outlook Addin and py2exe: 2 problems

2006-03-10 Thread [EMAIL PROTECTED]
Hello, I'm trying to create an addin for Outlook 2002 using the one provided in the demo of win32com as a starting point. I've been able to do my addin and test it if I go the "standard" way (using the python interpreter). But now, I want other poeple to use it to I want to freeze it for windows u

Re: Performance impact of using decorators

2006-03-10 Thread Diez B. Roggisch
> @expose -> cherrypy decorator > @startTransactrionAndBuildPage -> starts a db transaction, populates > the user in the session. I guess that is ok - transaction handling is a "classic" for decorator-like concepts. After all, you don't want begin() try: pass commit() finally: if not comitt

Re: creating variable in root namespace from module

2006-03-10 Thread MakaMaka
Hi again, Steve- I'm trying to use python to model reliability. Basically, I want to read an XML file in that defines a bunch of variables, that are then accessible from the python interpreter. For example: import reliability reliability.read_xml("c:\\somefile.xml") #<== defines x1, x2, x3 resu

Re: Why property works only for objects?

2006-03-10 Thread Michal Kwiatkowski
Alex Martelli napisał(a): > Wrong! Of _course_ it's an option -- why do you think it matters at all > whether you're the creator of this object?! Statically typed languages background. Sorry. ;) >> Code below doesn't work, but shows my >> intention: >> >> # obj is instance of BaseClass >> def ge

Re: Performance impact of using decorators

2006-03-10 Thread Fredrik Lundh
"vinjvinj" wrote: > I'm building an application with cherrypy and have started using > decorators quite extensively. A lot of my exposed functions look like: > > @expose > @startTransactrionAndBuildPage > @partOfTabUi(tabId) > @convert(arg1=int, arg2=str) > def do_main_page(self, arg1, arg2): >

Re: why use special config formats?

2006-03-10 Thread tomerfiliba
i dont know about your experience with config files, but there thousands of formats. on the python side -- just in this conversation, we mentioned ConfigObj, ConfigParser and the Config module i linked to. when everybody writes his own config, you get loads of unique formats. anyway, for all the c

Re: pyc file usage in a multi OS environment ( newbe question)

2006-03-10 Thread Fredrik Lundh
"HajoEhlers" wrote: > Since the .py file are plain python scripts i assume that these are > not causing any trouble but what about the .pyc file ? ( Which i could > not figure out what they are acutelly for - My knowledge about python > is more or less a drop of water within the python ocean )

Use python to process XML file

2006-03-10 Thread silverburgh . meryl
Hi, Can you please tell me how Use python to process XML file? The example I find is build a DOM, but I just need to do it in SAX based, how can I do that? For example, I have a xml file like this: text text text text text text text For i want to process the node in the order they

Re: Performance impact of using decorators

2006-03-10 Thread vinjvinj
>>That sounds like something for the templating engine, and _certainly_ not >>for a decorator that otherwise deals with transactions. The actual code for the page layout is in a preppy template. But the calls to the template engine are made in the startTransactrionAndBuildPage decorator >>Templat

Re: Why property works only for objects?

2006-03-10 Thread Michal Kwiatkowski
Alex Martelli napisał(a): >> So another question arise. Is it possible to make function a method (so >> it will receive calling object as first argument)? > > Sure, impor types then call types.MethodType: > > f = types.MethodType(f, obj, someclass) > > (f.__get__ is also fine for Python-coded fu

Re: Performance impact of using decorators

2006-03-10 Thread Fredrik Lundh
"vinjvinj" wrote: > I was fearing that. The expose decorator is the only one that comes > with cherrypy. The other ones are mine and are of the format: > > def decorator(func): > def wrapper(self, *args, **kwargs) > some code > return wrapper what exactly made you think that Pyth

Re: operator creation?

2006-03-10 Thread Peter Otten
Gerardo Herzig wrote: > Lets say i have an DB object, who implements the querys to the database > trough a method called DBObject.doQuery. > > On the other hand, i have 50 sql functions stored in the database. So i > can call DBObject.doQuery('select * from my_sql_function()')...Ok, what > do i w

Re: Why property works only for objects?

2006-03-10 Thread Chris Mellon
On 3/10/06, Michal Kwiatkowski <[EMAIL PROTECTED]> wrote: > Alex Martelli napisał(a): > >> So another question arise. Is it possible to make function a method (so > >> it will receive calling object as first argument)? > > > > Sure, impor types then call types.MethodType: > > > > f = types.MethodTy

Re: Performance impact of using decorators

2006-03-10 Thread Terry Reedy
"vinjvinj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm building an application with cherrypy and have started using > decorators quite extensively. A lot of my exposed functions look like: > > @expose > @startTransactrionAndBuildPage > @partOfTabUi(tabId) > @convert(arg1=int

Re: StaticBoxSizer problems

2006-03-10 Thread Matthias Kluwe
Hi! Steve Holden wrote: > Did you actually try removing the line and running the program? I tried, of course :-) Removing the line box.Add(item=upper_box, flag=wx.GROW) yields the remaining program import wx app = wx.PySimpleApp() frame = wx.Frame(parent=None, title="Test") box = wx.BoxSizer(

time series calculation in list comprehension?

2006-03-10 Thread falcon
Is there a way I can do time series calculation, such as a moving average in list comprehension syntax? I'm new to python but it looks like list comprehension's 'head' can only work at a value at a time. I also tried using the reduce function and passed in my list and another function which calcu

Re: Speed of data structures in python

2006-03-10 Thread Mike C. Fletcher
Dave wrote: > Hi. I am learning PyOpenGL and I am working with a largish fixed scene > composed of several thousand GLtriangles. I plan to store the coords and > normals in a NumPy array. > > Is this the fastest solution in python? would i be significantly better > off (timewise or otherwise)

Re: creating variable in root namespace from module

2006-03-10 Thread Steve Holden
MakaMaka wrote: > Hi again, > Steve- > I'm trying to use python to model reliability. Basically, I want to > read an XML file in that defines a bunch of variables, that are then > accessible from the python interpreter. For example: > import reliability > > reliability.read_xml("c:\\somefile.xml

accessors and lazy initialization

2006-03-10 Thread Bill
Hello -- I'm a Java programmer who's slowly getting up to speed in Python. In general I try to initialize the state of my objects as late as possible, in the accessor. So if I have a member "_foo", my accessor is something like: public FooType getFoo() { if (_foo == null) { // initi

Re: How to pop random item from a list?

2006-03-10 Thread flamesrock
Thanks guys! :D -- http://mail.python.org/mailman/listinfo/python-list

MS Access db (mdb): viewing table attributes

2006-03-10 Thread gau . tai
I have an Access 2003 database, protected by a workgroup, that I am trying to view through python. Currently, I'm attempting dao with the win32 package, and I'm able to view all of the table names, but I don't know how to view the attributes of the tables. My code: import win32com.client from pp

Re: time series calculation in list comprehension?

2006-03-10 Thread beliavsky
falcon wrote: > Is there a way I can do time series calculation, such as a moving > average in list comprehension syntax? I'm new to python but it looks > like list comprehension's 'head' can only work at a value at a time. I > also tried using the reduce function and passed in my list and anothe

image letter recognition

2006-03-10 Thread gau . tai
Is there an existing package for python that will perform simple letter recognition from image files? I'm specifically looking for a way to read from a png file, but that can be changed. -- http://mail.python.org/mailman/listinfo/python-list

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread Felipe Almeida Lessa
Em Sex, 2006-03-10 às 09:53 -0800, [EMAIL PROTECTED] escreveu: > I have an Access 2003 database, protected by a workgroup, that I am > trying to view through python. Currently, I'm attempting dao with the > win32 package, and I'm able to view all of the table names, but I don't > know how to view

Python cleanup on exit

2006-03-10 Thread Jacob Kroon
Hi, I'm working on a library written in C using GObject, which i provide python bindings for using pygtk. When I checked the library for memory leaks using valgrind, I noticed that none of the objects I created in the script (that is they are global in the script) were deleted on exit. After some

Re: Use python to process XML file

2006-03-10 Thread Rene Pijlman
[EMAIL PROTECTED]: >Can you please tell me how Use python to process XML file? >The example I find is build a DOM, but I just need to do it in SAX >based, how can I do that? http://docs.python.org/lib/module-xml.sax.html http://pyxml.sourceforge.net/topics/howto/section-SAX.html -- René Pijlman

Re: creating variable in root namespace from module

2006-03-10 Thread MakaMaka
Steve, I think I actually need to get the caller's local namespace. How do I do that using sys? I read the documentation and can't find anything specific. For example, if I have module A and it imports module B, I want module B to add variables to A's global namespace. Python has to store this

Re: Use python to process XML file

2006-03-10 Thread Bruce
you can use function parse from xml.sax It takes your xml as the first argument and an xml.sax.handler.ContentHandler instance as the second. --- from xml.sax import parse from xml.sax.handler import ContentHandler class LogHandler(ContentHandler): def startElement(self,name): if na

Bear not false witness (was: Which GUI toolkit is THE best?)

2006-03-10 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Thomas Guettler <[EMAIL PROTECTED]> wrote: . . . >tkinter (or better TK) has no good table widget. . . . http://tkinter.un

Re: Numbers in python

2006-03-10 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >> However, I can't seem to get the program to treat the numbers as >> numbers. If I put them in the dictionary as 'THE' = int(0.965) the >> program returns 1.0 > >It certainoly does _not_ return 1.0 - it returns 1. And tha

Re: accessors and lazy initialization

2006-03-10 Thread Rene Pijlman
Bill: >In general I try to initialize the state of my objects as late as >possible, in the accessor. [...] >Is there a more Pythonic way of looking at this? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/131495 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/363602 -- René Pijlm

Re: accessors and lazy initialization

2006-03-10 Thread Neil Dunn
The second version seems the most sensible. Remeber this is python, properties are more sensible then getters and setters. -- http://mail.python.org/mailman/listinfo/python-list

Re: time series calculation in list comprehension?

2006-03-10 Thread Terry Reedy
"falcon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a way I can do time series calculation, such as a moving > average in list comprehension syntax? I'm new to python but it looks > like list comprehension's 'head' can only work at a value at a time. I > also tried u

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread gau . tai
Here is the full code I'm using now to try out your sample: import dbi, odbc import win32com.client from pprint import pprint #sample code to list all tables in the selected database daoEngine = win32com.client.Dispatch('DAO.DBEngine.36') dtbs = daoEngine.OpenDatabase('database.mdb') for table in

Re: First script, please comment and advise

2006-03-10 Thread Just
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > >1. The fact that one function calls the other doesn't mean they're > >"logically nested".< > > In this situation they were logically nested, because the scramble_word > is a function needed by another one only, in Java the scramble_wor

Re: Type Hinting vs Type Checking and Preconditions

2006-03-10 Thread Florian Diesch
"Tom Bradford" <[EMAIL PROTECTED]> writes: > Let me first say that I'm sure that this subject has come up before, > and so forgive me for beating a dead horse. Secondly, let me say that > Python's strength is its dynamic nature, and I don't believe that it > should ever require a precondition sca

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread gau . tai
ok, I know what I had wrong :) I was hoping that your code would return the column names for me, but it was expecting me to list the columns to use. I want to know how to retrieve that list of columns through python. -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.4 logging module

2006-03-10 Thread Vinay Sajip
Pramod wrote: > Hi All, > > How can I remove an Instance of logger ? > I need this feature in one of my script where I need to associate each > time logger instance to different handler. > > Thanks in advance > Pramod Are you sure you are using logging in the right way? What do you mean by "each

Re: time series calculation in list comprehension?

2006-03-10 Thread johnzenger
falcon wrote: > Is there a way I can do time series calculation, such as a moving > average in list comprehension syntax? I'm new to python but it looks > like list comprehension's 'head' can only work at a value at a time. I > also tried using the reduce function and passed in my list and anothe

Re: creating variable in root namespace from module

2006-03-10 Thread MakaMaka
Ok, I figured it out. Thanks for your help guys. If anybody else is searching this group looking for the answer, you want the sys._getframe() function. sys._getframe(1).f_locals['a'] = 1 if you put the above in a function in a module, it creates a variable 'a' in the namespace of whatever calls

Re: time series calculation in list comprehension?

2006-03-10 Thread Paul Rubin
"falcon" <[EMAIL PROTECTED]> writes: > Is there a way I can do time series calculation, such as a moving > average in list comprehension syntax? I'm new to python but it looks > like list comprehension's 'head' can only work at a value at a time. I > also tried using the reduce function and passe

Re: Performance impact of using decorators

2006-03-10 Thread vinjvinj
>>what exactly made you think that Python would be able to run your >>code *without* calling your function ? I was hoping that when the compiler finds decorators with wrapers that have the same signature it can some how "magically" combine them into one function (which gets called at run time) and

Re: Simple questions on use of objects (probably faq)

2006-03-10 Thread bruno at modulix
Steven D'Aprano wrote: > On Thu, 09 Mar 2006 13:44:25 +0100, bruno at modulix wrote: > > (snip) >>And it's not "self-referential" - it introduces a references cycle >>(class object -> instances -> class object), which may or may not be a >>problem. > > > Every instance knows about a list of ev

Re: StaticBoxSizer problems

2006-03-10 Thread Steve Holden
Matthias Kluwe wrote: > Hi! > > Steve Holden wrote: > >>Did you actually try removing the line and running the program? > > > I tried, of course :-) Removing the line > > box.Add(item=upper_box, flag=wx.GROW) > > yields the remaining program > > import wx > > app = wx.PySimpleApp() > frame

Re: Python Evangelism

2006-03-10 Thread Andrew Gwozdziewycz
> To emphasize the point as a newbie: I know what CPAN is. I would go to > the Vaults of Parnassus for Python stuff. But Cheese Shop? > Well, why don't we promote it as PyPI (Python Package Index)? The url _is_ python.org/pypi, and I'm pretty sure I read somewhere that PyPI was the intended name.

Re: Use python to process XML file

2006-03-10 Thread [EMAIL PROTECTED]
I have a little py module that implements the Composite pattern to represent xml file contents. My class is called ExtensionRegistry because that's what I use it for, you could rename it to whatever you wanted. After parsing, this allows me to access my xml file contents like this: xmlFile = Exten

McMillan installer on solaris - complains about missing .pkg file

2006-03-10 Thread mrstephengross
I'm trying to get the mcmillan installer utility to generate a standalone executable for me. I've gotten to work--almost!--but still have one problem. After running Installer's Build.py on my script/spec, it appears to work. I go into the directory generating by Build.py and run my program. It work

Re: Python Evangelism

2006-03-10 Thread Tim Parkin
Andrew Gwozdziewycz wrote: > > To emphasize the point as a newbie: I know what CPAN is. I would go to > >>the Vaults of Parnassus for Python stuff. But Cheese Shop? >> > > > Well, why don't we promote it as PyPI (Python Package Index)? The url > _is_ python.org/pypi, and I'm pretty sure I read

read/ edit line from stdin

2006-03-10 Thread Clemens Hepper
Hello, for my project confux (http://confux.sourceforge.net) I want to read a line from stdin. But I don't want the user to type a new line. I want so display a value which the user can edit. For example I want to ask the user for a hostname and I print "localhost", the user modified it to "locals

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Dmitry Anikin
Some example (from real life). def ChooseItems(StartDate, EndDate, Filter): #function returns a set of some items in chronological order #from required interval possibly using filter ChooseItems() #get everything ChooseItems('01.01.2000', ,SomeFilter) #get everything after a date using filter Choo

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Dmitry Anikin
Some example (from real life). def ChooseItems(StartDate, EndDate, Filter): #function returns a set of some items in chronological order #from required interval possibly using filter ChooseItems() #get everything ChooseItems('01.01.2000', ,SomeFilter) #get everything after a date using filter Choo

Re: Python cleanup on exit

2006-03-10 Thread Steve Juranich
Jacob Kroon wrote: > Is there another way to make python delete objects which were > created in the global scope upon exit ? Check out the `atexit' module. -- Steve Juranich Tucson, AZ USA -- http://mail.python.org/mailman/listinfo/python-list

Re: time series calculation in list comprehension?

2006-03-10 Thread Lonnie Princehouse
Well, you could iterate over an index into the list: from __future__ import division def moving_average(sequence, n): return [sum(sequence[i:i+n])/n for i in xrange(len(sequence)-n+1)] Of course, that's hardly efficient. You really want to use the value calculated for the i_th term in

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread BartlebyScrivener
Gau, I'm a beginner and had fits connecting to my Access 2003 DB of quotations. The best advice that finally worked for me was to use mxODBC. In fact, you might just search this forum for Access and mxODBC. I can't customize to fit your situation, but here is the connection part of a script I use

Re: read/ edit line from stdin

2006-03-10 Thread James Stroud
Clemens Hepper wrote: > Hello, > for my project confux (http://confux.sourceforge.net) I want to read > a line from stdin. > But I don't want the user to type a new line. I want so display a > value which the user can edit. > > For example I want to ask the user for a hostname and I print > "local

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread BartlebyScrivener
>> I was hoping that your code would >> return the column names for me, but it was expecting me to list the >> columns to use. I want to know how to retrieve that list of columns >> through python. I think once you establish connection to the database using Python and mxODBC, then your question

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread gau . tai
That would be fine for me to switch to mxodbc, I've used it before and it worked fine. But if I switch, do you know how I can get the column names from the table? Maybe I'm not being clear with my question here. I'm going to try again here's a table (it's in access): === tablename = mytabl

epydoc help (putting XML in docstrings)

2006-03-10 Thread [EMAIL PROTECTED]
Hi everyone! I'm documenting some functions that return XML strings. I'd like to have `sample' xml show up in my epydoc generated documentation. However, epydoc does not like the indentation of the XML and gives me this error -> L28: Error: Improper paragraph indentation. Here is a simple funct

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread gau . tai
BartlebyScrivener: Maybe you're right, and I'll try posting to another group. However, I have found resources for doing this using the same data structure: "TableDefs" which is in VB and python. I see how they are doing it in VB, but I don't know how this works in python. I was hoping someone c

Re: read/ edit line from stdin

2006-03-10 Thread Clemens Hepper
It's a bit more complicated. The field has a default and a preassigned Value. The default is p.e. 'localhost' and the value is 'www.gentoo.org'. Then localhost is chosen if the value is erased to ''. But i want to make it easy to keep the preassigned value! So if nothing is typed 'www.gentoo.org'

Re: Python Evangelism

2006-03-10 Thread Tim Churches
Benny wrote: > Paul Boddie wrote: > >> Bizarre names may be cute (to some people) but they don't lend >> themselves to guessing or searching. Consequently, people who want >> answers yesterday aren't likely to be amused to eventually discover >> that the name of the resource they've been looking f

Re: Simple questions on use of objects (probably faq)

2006-03-10 Thread Brian Elmegaard
bruno at modulix <[EMAIL PROTECTED]> writes: > I should just take some time and learn to read !-) Then I am better of than you. I just had to learn the syntax of a language :-) -- Brian (remove the sport for mail) http://www.et.web.mek.dtu.dk/Staff/be/be.html http://www.rugbyklubben-speed.dk --

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread gau . tai
For more reference, I got my information to start this from: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52267 When I try to run that code, it gives me this: File "C:\Python24\Lib\site-packages\win32com\client\util.py", line 83, in next return _get_good_object_(self._iter_.next()

Re: why use special config formats?

2006-03-10 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > i dont know about your experience with config files, but there > thousands of formats. All the config files I needed were either very easy to learn, or well documented in comments. > on the python side -- just in this conversation, we mentioned > ConfigObj

Re: epydoc help (putting XML in docstrings)

2006-03-10 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi everyone! I'm documenting some functions that return XML strings. > I'd like to have `sample' xml show up in my epydoc generated > documentation. However, epydoc does not like the indentation of the > XML and gives me this error -> > > L28: Error: Improper paragraph

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread BartlebyScrivener
>> How can I get the names of the columns for each table?? SELECT * FROM mytable -- http://mail.python.org/mailman/listinfo/python-list

Re: epydoc help (putting XML in docstrings)

2006-03-10 Thread Jean-Paul Calderone
On 10 Mar 2006 12:49:29 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >Hi everyone! I'm documenting some functions that return XML strings. >I'd like to have `sample' xml show up in my epydoc generated >documentation. However, epydoc does not like the indentation of the >XML and gives me

Setting permissions/ownership/destination in distutils?

2006-03-10 Thread [EMAIL PROTECTED]
Is there a recommended way to specify the permissions and ownership of scripts installed from distutils? Also, I'm currently just using this config in setup.cfg to control where the scripts go: [install] install-scripts = /opt/mcad/bin But it would be very helpful if I could install some of the

Re: epydoc help (putting XML in docstrings)

2006-03-10 Thread [EMAIL PROTECTED]
Doh. That was too easy. Thanks! jw -- http://mail.python.org/mailman/listinfo/python-list

Re: creating variable in root namespace from module

2006-03-10 Thread Duncan Booth
MakaMaka wrote: > Ok, I figured it out. Thanks for your help guys. If anybody else is > searching this group looking for the answer, you want the > sys._getframe() function. > > sys._getframe(1).f_locals['a'] = 1 > > if you put the above in a function in a module, it creates a variable > 'a' i

Re: MS Access db (mdb): viewing table attributes

2006-03-10 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I have an Access 2003 database, protected by a workgroup, that I am > trying to view through python. Currently, I'm attempting dao with the > win32 package, and I'm able to view all of the table names, but I don't > know how to view the attributes of the tables. > > My

Re: image letter recognition

2006-03-10 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Is there an existing package for python that will perform simple letter > recognition from image files? I'm specifically looking for a way to > read from a png file, but that can be changed. > "simple letter recognition from image file" now there's an oxymoron. I've su

Re: Python and C

2006-03-10 Thread P Boy
I have written some C extension before but it was pretty tedious. I have recently found another approach by using ctypes (http://starship.python.net/crew/theller/ctypes/). Which you develop your C module in dynamic library (DLL in Windows world), the from Python, you can call the C functions in the

XML international characters

2006-03-10 Thread Andreas R.
Hello, When parsing XML documents containing international characters, such as the Norwegian characters Æ, Ø, Å, I get an exception in Python's SAX module. What is the correct way to parse such characters in Python? I've searched for methods to somehow escape the characters, without any luck s

Re: XML international characters

2006-03-10 Thread Martin v. Löwis
Andreas R. wrote: > When parsing XML documents containing international characters, such as > the Norwegian characters Æ, Ø, Å, I get an exception in Python's SAX > module. What is the correct way to parse such characters in Python? I've > searched for methods to somehow escape the characters, with

<    1   2   3   >