Re: compute the double square...... :(

2011-01-08 Thread Gary Herron
On 01/08/2011 10:10 PM, aregee wrote: Double Squares A double-square number is an integer X which can be expressed as the sum of two perfect squares. For example, 10 is a double-square because 10 = 32 + 12. Your task in this problem is, given X, determine the number of ways in which it can be wri

Re: compute the double square...... :(

2011-01-08 Thread Corey Richardson
On 01/09/2011 01:10 AM, aregee wrote: > > Double Squares > A double-square number is an integer X which can be expressed as the > sum of two perfect squares. For example, 10 is a double-square because > 10 = 32 + 12. Your task in this problem is, given X, determine the > number of ways in which it

compute the double square...... :(

2011-01-08 Thread aregee
Double Squares A double-square number is an integer X which can be expressed as the sum of two perfect squares. For example, 10 is a double-square because 10 = 32 + 12. Your task in this problem is, given X, determine the number of ways in which it can be written as the sum of two squares. For exa

Re: How to read ansic file into a pre-defined class?

2011-01-08 Thread Tim Roberts
Ying Zu wrote: > >How to read ansic file into a pre-defined class? This is not an "ansic" file. It's just a plain old data file. >I have a series of files written in the following format, > >2 # number of classes >100 # number of items for the first class object >0 foo >1 foo

Re: surprised by import in python 2.6

2011-01-08 Thread Aahz
In article , Stefaan Himpe wrote: > >Recently someone asked me this question, to which I could not give an >answer. I'm hoping for some insight, or a manual page. What follows is >python 2.6. > >The problem is with the difference between > >from test import * > >and > >import test Just adding

Create a class to position a window on the screen.

2011-01-08 Thread Rohit Coder
Hi,elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpad

Re: Absolute imports?

2011-01-08 Thread Terry Reedy
On 1/8/2011 5:48 PM, Roy Smith wrote: In article, Terry Reedy wrote: Import from another file in /home/roy. (since '.' is part of sys.path). Or put module or package of modules in Lib/site-packages. But why the horror of modifying sys.path? It is normal proceedure. Not quite horror, but s

PyCon 2011 - Full talk and tutorial list now available, registration open!

2011-01-08 Thread Jesse Noller
I'm very pleased to announce, on behalf of the PyCon 2011 Program committee, and entire PyCon 2011 volunteer staff, that the full list of PyCon 2011 talks is now public, and available! This was an especially hard year for the PyCon program committee: we had over 200 proposals for only 95 total slo

Re: Absolute imports?

2011-01-08 Thread Roy Smith
In article , Terry Reedy wrote: > > Import from another file in /home/roy. (since '.' is part of sys.path). > Or put module or package of modules in Lib/site-packages. > But why the horror of modifying sys.path? It is normal proceedure. Not quite horror, but since I already know the absolute p

Re: Absolute imports?

2011-01-08 Thread Roy Smith
In article <877heff4fl@benfinney.id.au>, Ben Finney wrote: > Roy Smith writes: > > > If I have an absolute path to a file (i.e. '/home/roy/foo.py'), is > > there a way to import that as a module WITHOUT modifying sys.path? I'm > > using Python 2.6. > > Importing a module with ‘import’

Re: list displays

2011-01-08 Thread Steven D'Aprano
On Sat, 08 Jan 2011 22:57:45 +0100, Olive wrote: > I am a newbie to python. Python supports what I thinks it is called list > display, for example: > > [i for i in range(10)] > [i for i in range(10) if i<6] This is called a list comprehension, not list display. > Does anyone know a good docume

Re: list displays

2011-01-08 Thread Chris Rebert
On Sat, Jan 8, 2011 at 1:57 PM, Olive wrote: > I am a newbie to python. Python supports what I thinks it is called > list display, for example: > > [i for i in range(10)] > [i for i in range(10) if i<6] > > Does anyone know a good documentation for this. I have read the > language reference but it

Re: list displays

2011-01-08 Thread Daniel da Silva
They're called "List Comprehensions" http://docs.python.org/tutorial/datastructures.html#list-comprehensions On Sat, Jan 8, 2011 at 4:57 PM, Olive wrote: > I am a newbie to python. Python supports what I thinks it is call

list displays

2011-01-08 Thread Olive
I am a newbie to python. Python supports what I thinks it is called list display, for example: [i for i in range(10)] [i for i in range(10) if i<6] Does anyone know a good documentation for this. I have read the language reference but it is confusing. Olive -- http://mail.python.org/mailman/

Re: Absolute imports?

2011-01-08 Thread Ben Finney
Roy Smith writes: > If I have an absolute path to a file (i.e. '/home/roy/foo.py'), is > there a way to import that as a module WITHOUT modifying sys.path? I'm > using Python 2.6. Importing a module with ‘import’ is done by using the module's name, which is only *incidentally* related to its fil

Re: Absolute imports?

2011-01-08 Thread Terry Reedy
On 1/8/2011 3:03 PM, Roy Smith wrote: If I have an absolute path to a file (i.e. '/home/roy/foo.py'), is there a way to import that as a module WITHOUT modifying sys.path? I'm using Python 2.6. Import from another file in /home/roy. (since '.' is part of sys.path). Or put module or package of

Absolute imports?

2011-01-08 Thread Roy Smith
If I have an absolute path to a file (i.e. '/home/roy/foo.py'), is there a way to import that as a module WITHOUT modifying sys.path? I'm using Python 2.6. I've read PEP 328, and don't really understand how the absolute imports it's talking about are supposed to work. Should I be using imp.l

Re: student question

2011-01-08 Thread Peter Pearson
On Fri, 7 Jan 2011 18:42:45 -0800 (PST), John wrote: q_file = open(questions_location) #opens the document successfully for line in q_file: > print line > > # prints document successfully line > # prints last line of document for line in q_file: > pr

Re: Python app dev tools for Gnome?

2011-01-08 Thread Dan Stromberg
On Sat, Jan 8, 2011 at 8:07 AM, kj wrote: > There's a zillion utility apps that I've had kicking around in my > head for years, but I've never implemented because I absolutely > hate GUI programming. > > But I'm increasingly impressed by the quality, stability, and sheer > number, of Gnome apps th

Re: Python app dev tools for Gnome?

2011-01-08 Thread Adam Tauno Williams
On Sat, 2011-01-08 at 16:07 +, kj wrote: > There's a zillion utility apps that I've had kicking around in my > head for years, but I've never implemented because I absolutely > hate GUI programming. > But I'm increasingly impressed by the quality, stability, and sheer > number, of Gnome apps t

Re: filecmp.dircmp performance

2011-01-08 Thread Peter Otten
dads wrote: > I'm creating a one way sync program, it's to automate backing up data > over the wan from our shops to a server at head office. It uses > filecmp.dircmp() but the performance seems poor to me. > > for x in dc.diff_files: > srcfp = os.path.join(src, x) >

Python app dev tools for Gnome?

2011-01-08 Thread kj
There's a zillion utility apps that I've had kicking around in my head for years, but I've never implemented because I absolutely hate GUI programming. But I'm increasingly impressed by the quality, stability, and sheer number, of Gnome apps that I keep coming across that use Python under the h

filecmp.dircmp performance

2011-01-08 Thread dads
I'm creating a one way sync program, it's to automate backing up data over the wan from our shops to a server at head office. It uses filecmp.dircmp() but the performance seems poor to me. for x in dc.diff_files: srcfp = os.path.join(src, x) self.fn777(srcfp)

[ANN] pyxser-1.5.2r --- Python Object to XML serializer/deserializer

2011-01-08 Thread Daniel Molina Wegener
Hello Python Community. I'm pleased to announce pyxser-1.5.2r, a python extension which contains functions to serialize and deserialize Python Objects into XML. This is a model based serializer. This release is supports Python 2.4 to Python 2.5. What can do this serializer? * Serialization of cr

Re: More Help with python .find fucntion

2011-01-08 Thread Keith Anthony
THanks ... I am new to Python ... Comparing the result of find with -1 fixes the bug ... some of the endobj start in the firt position ... You're right about the lines ending in \n by accident, EXCEPT in PDF files items are separated by obj <<\n and endobj\n --

Re: Error invalid syntax while statement

2011-01-08 Thread Terry Reedy
15 print("counter: ", counter 16 17 while (end == 0): # <---returns syntax error on this while statement Among other responses, there is no indent after print. should be print() while x: #now i