Re: Calculate an age

2007-12-07 Thread Pierre Quentel
On Dec 7, 7:09 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > How many days in a year? 365.25 (J2000 epoch), 365.2422 [as I > recall](B1900 epoch), 365.0 (non-leap year), 366 (leap year)? Gregorian > or Julian calendar -- and depending upon one's country, the Gregorian > reform may tak

Re: sizers in wxpanels/notebooks

2007-12-07 Thread chaelon
On Dec 7, 9:52 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I have a wxNoteBook with a bunch of wxPanels attached to it as pages. > Every page has its own GUI items. > What Im trying to do is on a certain page, a certain GUI (wxTextCtrl) to > be resized every time the notebook or panel is resi

Distinguishing attributes and methods

2007-12-07 Thread tjhnson
Hi, With properties, attributes and methods seem very similar. I was wondering what techniques people use to give clues to end users as to which 'things' are methods and which are attributes. With ipython, I use tab completion all the time, but I can rarely tell from the names alone whether it i

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 8, 12:20 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "MonkeeSage" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | 1.) What is the benefit of doing a two phase compilation (parsing/ > | compiling), rather than a single, joint parse + compile phase (as in > | interactive

Re: a Python person's experience with Ruby

2007-12-07 Thread MonkeeSage
On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > Python is my favorite programming language. I've used > it as my primary language for about six years now, > including four years of using it full-time in my day > job. Three months ago I decided to take a position > with a team that d

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread Carl Banks
On Dec 7, 4:08 pm, "Joe Goldthwaite" <[EMAIL PROTECTED]> wrote: > Here's the simple benchmark; > > start = time.time() > for x in xrange(3): > for y in xrange(1000): > pass > print 'xRange %s' % (time.time() - start) > > start = time.time() > for x in range(3): >

Re: How does python build its AST

2007-12-07 Thread Terry Reedy
"MonkeeSage" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | 1.) What is the benefit of doing a two phase compilation (parsing/ | compiling), rather than a single, joint parse + compile phase (as in | interactive mode)? As far as I know (without looking at the code), there is no di

Re: Securely distributing python source code as an application?

2007-12-07 Thread Tim Churches
xkenneth wrote: > Message should have read: > Hi All, > > I'll shortly be distributing a number of python applications that > use proprietary source code. The software is part of a much larger > system and it > will need to be distributed securely. How can i achieve this? You need to define

a Python person's experience with Ruby

2007-12-07 Thread Steve Howell
Python is my favorite programming language. I've used it as my primary language for about six years now, including four years of using it full-time in my day job. Three months ago I decided to take a position with a team that does a lot of things very well, but they don't use Python. We use Ruby

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 7, 4:29 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "MonkeeSage" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |A quick question about how python parses a file into compiled > | bytecode. Does it parse the whole file into AST first and then compile > | the AST, or does

Re: changing fonts?

2007-12-07 Thread Doug Morse
Hi Jay, I'm not *that* familiar with the Terminal program on OS/X, but regardless perhaps I can point out a possibly useful path to explore... With terminal programs generally -- especially more in the past, as then they were much more about emulating "real" terminals -- a lot of the terminal pro

Re: Securely distributing python source code as an application?

2007-12-07 Thread sturlamolden
So for example one could: 1. Put all the compiled Python bytecode in an encrypted binary file. 2. Build a small binary executable (.exe file) that: 2a. Reads the binary file. 2b. Decrypts it to conventional Python byte code. 2c. Embeds a Python interpreter. 2d. Executes the byte

Re: Securely distributing python source code as an application?

2007-12-07 Thread sturlamolden
On 7 Des, 23:37, xkenneth <[EMAIL PROTECTED]> wrote: > I'll shortly be distributing a number of python applications that > use proprietary. The software is part of a much larger system and it > will need to be distributed securely. How can i achieve this? If you provide the application as a

RE: I'm missing something here with range vs. xrange

2007-12-07 Thread Joe Goldthwaite
>90+ seconds?? What hardware, OS, and Python version? What else was >running in the background? >With this kit: >OS Name: Microsoft Windows XP Professional >Version: 5.1.2600 Service Pack 2 Build 2600 >Processor: x86 Family 15 Model 36 Stepping 2 AuthenticAMD ~1995 Mhz >Python: Pyt

Re: File to dict

2007-12-07 Thread J. Clifford Dyer
On Fri, 2007-12-07 at 03:31 -0800, [EMAIL PROTECTED] wrote: > Hello everyone, > > I have written this small utility function for transforming legacy > file to Python dict: > > > def lookupdmo(domain): > lines = open('/etc/virtual/domainowners','r').readlines() > lines = [ [y.ls

sizers in wxpanels/notebooks

2007-12-07 Thread Astan Chee
Hi, I have a wxNoteBook with a bunch of wxPanels attached to it as pages. Every page has its own GUI items. What Im trying to do is on a certain page, a certain GUI (wxTextCtrl) to be resized every time the notebook or panel is resized. But everything else stays the same. Now I know I can use si

changing fonts?

2007-12-07 Thread jyoung79
Hi Greg, Thanks for your fast reply. I apologize for my ignorance with unicode, but would you mind sharing an example of your experiment? Again, thanks for your help with this! Jay > I don't think you can control the font, but you can print > out the Greek text as utf8-encoded unicode. I jus

Re: changing fonts?

2007-12-07 Thread greg
[EMAIL PROTECTED] wrote: > Is it possible for the next answer that Python returns in the > Terminal Window to be displayed in the 'Symbols' font so that the > Greek text is displayed correctly? I don't think you can control the font, but you can print out the Greek text as utf8-encoded unicode.

changing fonts?

2007-12-07 Thread jyoung79
This is probably a silly question, but alas, I'll ask it anyway... Is it possible with Python, to change the font of the text returned in the Terminal Window in OS X? For example, lets say I'm running a Python program in Terminal, and it asks me "Please enter an English word to be changed to G

Re: [pygtk] Rectangular Selection in gtk.TextView

2007-12-07 Thread Wildemar Wildenburger
Oops! This was meant to go to the pygtk list. Mixup on my part, sorry. Not that I would lament comments from the general python crowd, though. ;) /W Wildemar Wildenburger wrote: > John Ehresman wrote: >> I may be wrong here, but I suspect TextView does not support >> rectangular selections. I

Re: [pygtk] Rectangular Selection in gtk.TextView

2007-12-07 Thread Wildemar Wildenburger
John Ehresman wrote: > I may be wrong here, but I suspect TextView does not support > rectangular selections. I haven't seen mention of rectangular > selections when I've worked with it and a quick google search seems to > confirm this. > That is my experience too; I was hoping that there might

Re: Securely distributing python source code as an application?

2007-12-07 Thread xkenneth
Message should have read: Hi All, I'll shortly be distributing a number of python applications that use proprietary source code. The software is part of a much larger system and it will need to be distributed securely. How can i achieve this? Regards, Ken -- http://mail.python.org/mailman/l

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread Tim Chase
>> Here's what I get; >> >> xRange 92.552733 >> Range 95.266599 > > Try tracking your memory usage during the benchmark and > it will become very clear why xrange exists. Or, when memory-constrained and this extra memory usage pushes your machine to pound on your swap...not a pretty sight

Re: Running unmodified CGI scripts persistently under mod_wsgi.

2007-12-07 Thread Jeffrey Froman
Jeffrey Froman wrote: > While recently > considering whether to re-write a standalone mod_python application as CGI > or WSGI, I was scared off by this paragraph from PEP333: As a followup, I did go ahead and convert my CGI handler to WSGI, and doing so was not difficult at all. The steps were b

Securely distributing python source code as an application?

2007-12-07 Thread xkenneth
Hi All, I'll shortly be distributing a number of python applications that use proprietary. The software is part of a much larger system and it will need to be distributed securely. How can i achieve this? Regards, Ken -- http://mail.python.org/mailman/listinfo/python-list

Re: Any simpler way to do this

2007-12-07 Thread Steven D'Aprano
On Fri, 07 Dec 2007 09:37:22 +0100, Lars Johansen wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED [snip] > Wouldn there been easier if I could just skip all the "*if's" and just > "return term.color", however

Re: How does python build its AST

2007-12-07 Thread Terry Reedy
"MonkeeSage" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |A quick question about how python parses a file into compiled | bytecode. Does it parse the whole file into AST first and then compile | the AST, or does it build and compile the AST on the fly as it reads | expressions? (I

Re: Problem with generator expression and class definition

2007-12-07 Thread Michael Spencer
Terry Reedy wrote: > "Maric Michaud" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > |I faced a strange behavior with generator expression, which seems like a > bug, for both > | python 2.4 and 2.5 : > > Including the latest release (2.5.2)? > > | >>> class A : > | ... a = 1

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread John Machin
On Dec 8, 8:08 am, "Joe Goldthwaite" <[EMAIL PROTECTED]> wrote: > Here's the simple benchmark; > > start = time.time() > for x in xrange(3): > for y in xrange(1000): > pass > print 'xRange %s' % (time.time() - start) > > start = time.time() > for x in range(3): >

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread [EMAIL PROTECTED]
On Dec 7, 3:08 pm, "Joe Goldthwaite" <[EMAIL PROTECTED]> wrote: > Here's the simple benchmark; > > start = time.time() > for x in xrange(3): > for y in xrange(1000): > pass > print 'xRange %s' % (time.time() - start) > > start = time.time() > for x in range(3): >

Re: "finding hostid with python"

2007-12-07 Thread kdwyer
On Dec 7, 9:10 pm, farsheed <[EMAIL PROTECTED]> wrote: > I,m searching for a way to obtain hostid in windows. > Any ideas? IIRC, MArk Hammond's extensions for windows have a method for obtaining the fully qualified hostname of a machine. Kev -- http://mail.python.org/mailman/listinfo/python-li

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread Chris Mellon
On Dec 7, 2007 3:08 PM, Joe Goldthwaite <[EMAIL PROTECTED]> wrote: > Here's the simple benchmark; > > start = time.time() > for x in xrange(3): > for y in xrange(1000): > pass > print 'xRange %s' % (time.time() - start) > > start = time.time() > for x in range(3): >

Re: pipeline encoding

2007-12-07 Thread Tomasz Toczyski
"Martin v. Löwis": > Not a command line option. However, you can wrap sys.stdout with a > stream that automatically performs an encoding. If all your print > statements output Unicode strings, you can do > > sys.stdout = codecs.getwriter("utf-8")(sys.stdout) It is the best solution for me. Thanks.

Re: Dictionary instantiation?

2007-12-07 Thread Steven D'Aprano
On Fri, 07 Dec 2007 11:56:14 +0100, Bruno Desthuilliers wrote: > Also, modifying a sequence in place while iterating over it is a *very* > bad idea. That's somewhat of an exaggeration, surely. Some sorts of modifications are more error-prone than others, and deserves your warning e.g. inserting

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread John Machin
On Dec 8, 12:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > Hello, > > From a zone-file of a Microsoft Active Directory integrated DNS server > I get the date/time of the dynamic update entries in a format, which > is as far as I know the hours since january 1st 1901. As Tim Golden has guessed,

Re: [NEWB] Dictionary instantiation?

2007-12-07 Thread Shane Geiger
#!/usr/bin/python """ EXAMPLE USAGE OF PYTHON'S CSV.DICTREADER FOR PEOPLE NEW TO PYTHON Python - Batteries Included(tm) This file will demonstrate that when you use the python CSV module, you don't have to remove the newline characters, as between "acorp_ Ac" and "orp Foundation" and other parts

RE: I'm missing something here with range vs. xrange

2007-12-07 Thread Joe Goldthwaite
Here's the simple benchmark; start = time.time() for x in xrange(3): for y in xrange(1000): pass print 'xRange %s' % (time.time() - start) start = time.time() for x in range(3): for y in range(1000): pass print 'Range %s' % (time.time() - st

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread [EMAIL PROTECTED]
On Dec 7, 9:59 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 16:50, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > > > > On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > > > > [EMAIL PROTECTED] wrote: > > > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > >

"finding hostid with python"

2007-12-07 Thread farsheed
I,m searching for a way to obtain hostid in windows. Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with generator expression and class definition

2007-12-07 Thread Terry Reedy
"Maric Michaud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I faced a strange behavior with generator expression, which seems like a bug, for both | python 2.4 and 2.5 : Including the latest release (2.5.2)? | >>> class A : | ... a = 1, 2, 3 | ... b = 1, 2, 3 | ...

download complete webpage with python

2007-12-07 Thread yi zhang
Dear all, The urllib.urlretrieve() can only download the text part of a webpage, not the image associated. How can I download the whole, complete webpage with python? Thanks! Yi Looking for last m

Re: How does python build its AST

2007-12-07 Thread Kay Schluehr
On Dec 7, 5:03 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 7, 9:50 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > > A quick question about how python parses a file into compiled > > > bytecode. Does it parse the whole file

Re: How does python build its AST

2007-12-07 Thread Michael Spencer
MonkeeSage wrote: > A quick question about how python parses a file into compiled > bytecode. Does it parse the whole file into AST first and then compile > the AST, or does it build and compile the AST on the fly as it reads > expressions? (If the former case, why can't functions be called before

Re: logging.py: mutiple system users writing to same file getting permission errors.

2007-12-07 Thread Vinay Sajip
On Dec 6, 6:35 pm, evenrik <[EMAIL PROTECTED]> wrote: > An a redhat box I have root, apache and other normal users run code > that uses theloggingmodule to write to the same log file. Since > umasks are set to 2 or 022 this gets permission errors. > > I have fixed my issue by patching theloggingco

Re: Fill In a Form Automatically

2007-12-07 Thread Ismail Dönmez
Friday 07 December 2007 22:06:23 tarihinde Victor Subervi şunları yazmıştı: > Hi; > I'm trying to fill in a Zope form automatically. I have this script, which > works great for creating the page...but how do I write to it? Use Mechanize [0]. [0] http://wwwsearch.sourceforge.net/mechanize/ -- Ne

Python tickets summary - renewed

2007-12-07 Thread Facundo Batista
People: Well, after my hosting allowing CGI, I now improved *a lot* the interface of this page. Now you have more columns: - Id - Summary - Priority - Severity - Components - Versions - Keywords - Opened by (when) - Temporal location - Last update by (when) And, the biggest enhancement, you can

Equivalent of perl's Pod::Usage?

2007-12-07 Thread Adam Funk
I'm using to using Pod::Usage in my Perl programs (a snipped example is shown below, if you're interested) to generate a little man page when they are called with the -h option. Is there an equivalent in Python? Thanks, Adam ## use Pod::Usage; getopts("ha:b:c", \%option) ; if ($optio

Fill In a Form Automatically

2007-12-07 Thread Victor Subervi
Hi; I'm trying to fill in a Zope form automatically. I have this script, which works great for creating the page...but how do I write to it? import urllib2 theurl = 'example.com' protocol = 'http://' my_id = "test" text = "Hello, world!" realm_dir = '/a_dir/' realm1 = 'manage_addProduct/PageTempl

Leo 4.4.5 beta 2 released

2007-12-07 Thread Edward K Ream
Leo 4.4.5 beta 2 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 This beta 2 release fixes several recently reported bugs. A final release is due in about a week. Leo is a text editor, data organizer, project manager and much more. See: http://webpage

RE: File to dict

2007-12-07 Thread Joe Goldthwaite
Duncan Booth wrote: >for item in list: >if item == 'searched.domain': >return item... [EMAIL PROTECTED] wrote: >Sure, but I have two options here, none of them nice: either "write C >in Python" or do it inefficient and still elaborate way. I don't understand your point at all. How

Re: Some python syntax that I'm not getting

2007-12-07 Thread Chris Mellon
On Dec 7, 2007 6:31 AM, waltbrad <[EMAIL PROTECTED]> wrote: > Hello. Been studying Python for about a week now. I did a quick read > of the tutorial in the manual and I'm reading Programming Python by > Mark Lutz. I'm still getting used to the Python syntax, but I'm able > to pretty much follow w

Who is Jesus?

2007-12-07 Thread aassime abdellatif
Who is Jesus? Without a doubt, you have often heard the claim that Jesus is God, the second person in the "Holy trinity." However, the very Bible which is used as a basis for knowledge about Jesus and as the basis for doctrine within Christianity clearly belies this claim. We urge you to consult y

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Boris Borcic
Dirk Hagemann wrote: > (3566839/24)/365 = 407 - YES I did this calculation too and was > surprised. But if you try this out in MS Excel: > ="01.01.1901"+(A1/24-(REST(A1;24)/24))+ZEIT(REST(A1;24);0;0) (put > 3566839 in field A1 and switch the format of the result-fieldby right- > click on it to

Python 3.0a2 is out

2007-12-07 Thread Christian Heimes
A new alpha of Python 3000 was released a few minutes ago! http://www.python.org/download/releases/3.0/ Have fun and don't forget to report bugs at http://bugs.python.org/ Christian signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Max Erickson
Dirk Hagemann <[EMAIL PROTECTED]> wrote: >> Dirk > Additional to my last posting: if you want to try this out in > Excel you should replace the command "REST" by the english > command what should be something like "remainder". The equivalent in my (U.S. English, 2000) version of excel is called

Re: ftplib.nlst gives error on empty directory

2007-12-07 Thread Giampaolo Rodola'
On 7 Dic, 10:42, loial <[EMAIL PROTECTED]> wrote: > Trying to use ftplib.FTP.nlst() method to list the files in > a directory on a FTP server. > > It works fine except when there are no files in the directory. Then it > gives the error > > ftplib.error_perm: 550 No files found. > > How can I handl

Re: File to dict

2007-12-07 Thread mrkafk
Glauco wrote: > cache = None > > def lookup( domain ): > if not cache: >cache = dict( [map( lambda x: x.strip(), x.split(':')) for x in > open('/etc/virtual/domainowners','r').readlines()]) > return cache.get(domain) Neat solution! It just needs small correction for empty or ba

Open Source Symposium CFP ending soon

2007-12-07 Thread Jeremy Fluhmann
Just a reminder that there's only one week left for the Open Source Symposium Call For Participation! http://www.texasoss.org/cfp (Deadline is December 15th) If you've been considering submitting, but aren't sure, I encourage you to go ahead and submit! I know several of you present at your user

Re: File to dict

2007-12-07 Thread Glauco
david ha scritto: > On Fri, 07 Dec 2007 16:46:56 +0100, Glauco wrote: > >> [EMAIL PROTECTED] ha scritto: >>> Hello everyone, >>> >>> I have written this small utility function for transforming legacy file >>> to Python dict: >>> >>> >>> def lookupdmo(domain): >>> lines = open('/etc/virtual

Re: Class destructor -- strange behaviour

2007-12-07 Thread Jason
On Dec 6, 2:51 pm, Spes <[EMAIL PROTECTED]> wrote: > Hi, > > I have this simple code: > | #!/usr/bin/python > | import codecs > | import re > | from copy import deepcopy > | > | class MyClass(object): > | def __del__(self): > | deepcopy(1) > | > | x=MyClass() > > but I get an error: > | Excep

Re: An Object's Type

2007-12-07 Thread Chris Mellon
On Dec 7, 2007 10:39 AM, paul <[EMAIL PROTECTED]> wrote: > Chris Mellon schrieb: > > On Dec 6, 2007 5:52 AM, paul <[EMAIL PROTECTED]> wrote: > > >> function or method. I hope type annotations in py3k will allow for > >> something like constraints in C# where you can tell the caller right > >> away

Re: sqlite or xml

2007-12-07 Thread oj
On Dec 6, 8:21 pm, Kelie <[EMAIL PROTECTED]> wrote: > Hello group, > > If I need store and use a couple thousand of people's contact info: > first name, last name, phone, fax, email, address, etc. I'm thinking > of using either sqlite or xml. Which one is better? My understanding > is if there is l

Re: How does python build its AST

2007-12-07 Thread Jason
On Dec 7, 9:03 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 7, 9:50 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > > A quick question about how python parses a file into compiled > > > bytecode. Does it parse the whole file

Problem with generator expression and class definition

2007-12-07 Thread Maric Michaud
I faced a strange behavior with generator expression, which seems like a bug, for both python 2.4 and 2.5 : >>> class A : ... a = 1, 2, 3 ... b = 1, 2, 3 ... C = list((e,f) for e in a for f in b) ... Traceback (most recent call last): File "", line 1, in File "", line 4, in A

Re: Gnu/Linux dialogue boxes in python

2007-12-07 Thread kyosohma
On Nov 30, 7:55 am, Donn Ingle <[EMAIL PROTECTED]> wrote: > Hi, > Okay, so I am in the mood to try this: Inform the user about what modules > the app requires in a graphical dialogue that can vary depending on what > the system already has installed. (It will fail-to output on cli) > > I am runnin

Re: An Object's Type

2007-12-07 Thread paul
Chris Mellon schrieb: > On Dec 6, 2007 5:52 AM, paul <[EMAIL PROTECTED]> wrote: >> function or method. I hope type annotations in py3k will allow for >> something like constraints in C# where you can tell the caller right >> away she's doing something wrong. >> [language rant snipped] > On a more

Re: Best way to merge/sort two sorted lists?...

2007-12-07 Thread Aaron Watters
On Dec 6, 9:51 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Aaron Watters" <[EMAIL PROTECTED]> wrote in message > The current version of list.sort (timsort) was designed to take advantage > of pre-existing order. It should discover the 2 sorted sublists and merge > them together. It will not r

Re: New subclass vs option in __init__

2007-12-07 Thread Carl Banks
On Dec 7, 9:36 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-07, Carl Banks <[EMAIL PROTECTED]> wrote: > > > On Dec 6, 11:56 am, "Kurt Smith" <[EMAIL PROTECTED]> wrote: > >> It would seem that there are cases where one would be > >> preferable over the other: a) when the new behavior wou

Re: File to dict

2007-12-07 Thread david
On Fri, 07 Dec 2007 16:46:56 +0100, Glauco wrote: > [EMAIL PROTECTED] ha scritto: >> Hello everyone, >> >> I have written this small utility function for transforming legacy file >> to Python dict: >> >> >> def lookupdmo(domain): >> lines = open('/etc/virtual/domainowners','r').readline

Re: Speed of Nested Functions & Lambda Expressions

2007-12-07 Thread Terry Jones
> "Duncan" == Duncan Booth <[EMAIL PROTECTED]> writes: Duncan> Terry Jones <[EMAIL PROTECTED]> wrote: >> Duncan Booth wrote: Duncan> You'll kick yourself for not seeing it. Duncan> If you changed fn_inner to: Duncan> def fn_inner(): Duncan> a, v = v, a Duncan> then you also changed 'a' and '

Re: File to dict

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: >>> from __future__ import with_statement >>> >>> def loaddomainowners(domain): >>> with open('/etc/virtual/domainowners','r') as infile:

Re: Gnu/Linux dialogue boxes in python

2007-12-07 Thread Jorgen Grahn
On Sun, 02 Dec 2007 17:18:45 +0200, Donn Ingle <[EMAIL PROTECTED]> wrote: >> But why?  Either >> >> (a) your program has a GUI and can display a dialogue box by itself >> (b) your program has a GUI but has problems opening even a tiny part >> of it (missing modules?), and should output diagnostics

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Zentrader
If we use minutes from 2001, then 3566839 comes out as sometime in October, 2007 (6.78622 years). Close but no cigar. Is anyone familar enough with Excel to translate the formula or do we have to go a- googling? -- http://mail.python.org/mailman/listinfo/python-list

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 7, 9:50 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > A quick question about how python parses a file into compiled > > bytecode. Does it parse the whole file into AST first and then compile > > the AST, or does it build and comp

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 16:50, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > >> Hello, > > > >> From a zone-file of a Microsoft Active Directory integrate

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 16:50, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > >> Hello, > > > >> From a zone-file of a Microsoft Active Directory integrate

Re: How does python build its AST

2007-12-07 Thread Kay Schluehr
On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > A quick question about how python parses a file into compiled > bytecode. Does it parse the whole file into AST first and then compile > the AST, or does it build and compile the AST on the fly as it reads > expressions? (If the former case

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > >> Hello, > > >> From a zone-file of a Microsoft Active Directory integrated DNS server > >> I get the date/time of the dynamic update entries in a fo

module organization/inheritance problem

2007-12-07 Thread km
Hi all, I have a python module (M) with the following structure M (directory) | __init__.py (class Base(object) ...) | - a.py (class A(Base) ...) | - b.py (class B(Base) ...) | - c.py (class C(Base) ...) The __init_.py has a class which all the sub-modu

Re: File to dict

2007-12-07 Thread Glauco
[EMAIL PROTECTED] ha scritto: > Hello everyone, > > I have written this small utility function for transforming legacy > file to Python dict: > > > def lookupdmo(domain): > lines = open('/etc/virtual/domainowners','r').readlines() > lines = [ [y.lstrip().rstrip() for y in x.split

Re: File to dict

2007-12-07 Thread Duncan Booth
Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: >> from __future__ import with_statement >> >> def loaddomainowners(domain): >> with open('/etc/virtual/domainowners','r') as infile: > > I've been thinking I have to use contextlib.closing for >

Re: which configparse?

2007-12-07 Thread Sion Arrowsmith
Neal Becker <[EMAIL PROTECTED]> wrote: >I've looked at configparse, cfgparse, iniparse. > >configparse looks like what I want, but it seems last commit was >2years >ago. > >What is the best choice? ConfigParser is the battery included in the standard library. If you're planning on distributing yo

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Giles Brown
On 7 Dec, 13:20, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > Hello, > > From a zone-file of a Microsoft Active Directory integrated DNS server > I get the date/time of the dynamic update entries in a format, which > is as far as I know the hours since january 1st 1901. > For Example: the number 3566

Re: eclipse pywintypes.com_error

2007-12-07 Thread kyosohma
On Dec 7, 9:10 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Spindle wrote: > > I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i > > mentioned before, > > the problem happens only with eclipse and pydev,on the same machine i > > can run the script from command line or with IDLE wit

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: >> Hello, >> >> From a zone-file of a Microsoft Active Directory integrated DNS server >> I get the date/time of the dynamic update entries in a format, which >> is as far as I know the hours since january 1st 19

Re: python and a 2 gigs Usb Stick (pure pythonic stick)

2007-12-07 Thread Tim Chase
> i've received for my birthday two usb key, and i had the idea to make > the 2GB one a special python usb key. > So far i've put on it : > Movable Python > My Python directory > Iron Python > Jython > Instant django > > the file installation for : > Python , iron python , jython , PIL , Pygame ,

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread supercooper
On Dec 7, 8:15 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 14:34, supercooper <[EMAIL PROTECTED]> wrote: > > > > > On Dec 7, 7:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > > I get the

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
Spindle wrote: > I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i > mentioned before, > the problem happens only with eclipse and pydev,on the same machine i > can run the script from command line or with IDLE without any errors. Well, that's bizarre then. Hopefully someone else

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread [EMAIL PROTECTED]
On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > Hello, > > From a zone-file of a Microsoft Active Directory integrated DNS server > I get the date/time of the dynamic update entries in a format, which > is as far as I know the hours since january 1st 1901. Your guess appears to be of

Re: eclipse pywintypes.com_error

2007-12-07 Thread gurkan
On 7 Aralık, 15:59, Tim Golden <[EMAIL PROTECTED]> wrote: > gurkan wrote: > > i have treid the script : > > > #import active_directory > > import win32com.client > > > win32com.client.Dispatch ("ADODB.Command") > > #me = active_directory.find_user () > > > #print me > > > again i got the error : >

Re: eclipse pywintypes.com_error

2007-12-07 Thread Spindle
On Dec 7, 3:59 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > gurkan wrote: > > i have treid the script : > > > #import active_directory > > import win32com.client > > > win32com.client.Dispatch ("ADODB.Command") > > #me = active_directory.find_user () > > > #print me > > > again i got the error : > >

python and a 2 gigs Usb Stick (pure pythonic stick)

2007-12-07 Thread bussiere maillist
Hi, i've received for my birthday two usb key, and i had the idea to make the 2GB one a special python usb key. So far i've put on it : Movable Python My Python directory Iron Python Jython Instant django the file installation for : Python , iron python , jython , PIL , Pygame , Pywin32 The pdf i

Re: splitting a words of a line

2007-12-07 Thread Paul McGuire
On Dec 6, 9:21 am, Sumit <[EMAIL PROTECTED]> wrote: > Hi , >I am trying to splitt a Line whihc is below of format , > > AzAccept PLYSSTM01 [23/Sep/2005:16:14:28 -0500] "162.44.245.32 CN= > cojack (890),OU=1,OU=Customers,OU=ISM-Users,OU=kkk > Secure,DC=customer,DC=rxcorp,DC=com" "pl

Re: New subclass vs option in __init__

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 6, 11:56 am, "Kurt Smith" <[EMAIL PROTECTED]> wrote: >> It would seem that there are cases where one would be >> preferable over the other: a) when the new behavior would >> modify a large portion of the existing subclass, making a new >

Re: File to dict

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : >> >>> The csv module is your friend. >> >> (slapping forehead) why the Holy Grail didn't I think about this? > > If that can make you feel better, a few years ago, I spent two > days writing my own (Squa

Re: File to dict

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: > from __future__ import with_statement > > def loaddomainowners(domain): > with open('/etc/virtual/domainowners','r') as infile: I've been thinking I have to use contextlib.closing for auto-closing files. Is that not so? -- Neil Cerutti

How does python build its AST

2007-12-07 Thread MonkeeSage
A quick question about how python parses a file into compiled bytecode. Does it parse the whole file into AST first and then compile the AST, or does it build and compile the AST on the fly as it reads expressions? (If the former case, why can't functions be called before their definitions?) Thank

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 14:34, supercooper <[EMAIL PROTECTED]> wrote: > On Dec 7, 7:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > I get the date/time of the dynamic update entries in a format, which > > is as far

Re: File to dict

2007-12-07 Thread mrkafk
> >>> def shelper(line): > ... return x.replace(' ','').strip('\n').split(':',1) Argh, typo, should be def shelper(x) of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
gurkan wrote: > i have treid the script : > > #import active_directory > import win32com.client > > win32com.client.Dispatch ("ADODB.Command") > #me = active_directory.find_user () > > #print me > > again i got the error : > > Traceback (most recent call last): > File "H:\dev\eclipse\workspa

  1   2   >