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

2011-01-09 Thread Owen
On Jan 9, 6:14 pm, Gary Herron wrote: > 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, giv

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

2011-01-09 Thread Ian Kelly
On 1/8/2011 11:10 PM, aregee wrote: pie.py:3: Deprecation Warning: integer argument expected, got float for b in range(0,(x**0.5)/2): I expect you want range(0, int((x / 2) ** 0.5) + 1), no? for b in range(0,(x**0.5)/2): a = (x-(b**2))**0.5 try: a = int(a) except: prin

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

2011-01-09 Thread Cedric Schmeits
On Jan 9, 7: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 can be

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

2011-01-09 Thread aregee
hey all thanks for yr help,i got it right .n sorry for confussions...i m very new to python...just started learning it couple of days ago... Ian Kelly wrote: > On 1/8/2011 11:10 PM, aregee wrote: > > pie.py:3: Deprecation Warning: integer argument expected, got float > >for b in range(0,(x

Embedded Python static modules

2011-01-09 Thread Евгений Почитаев
I build python from sources(static version): ./configure --disable-shared Next I build program with this static library. Program work fine on my linux, but when I tried run my program on another linux, I got next message: Could not find platform independent libraries Could not find platform depend

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

2011-01-09 Thread Alan Mackenzie
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 written as the su

Help needed with unittest and global

2011-01-09 Thread Ian Hobson
Hi all, I am trying to develop a PyQt application, and I want to unittest it. After three false starts, I am plainly unaware of something rather basic - can some kind person please help me out? This is a log to show what I have so far D:\work\ian>type testAll.py # coding=utf8 # testAll.py

Nothing to repeat

2011-01-09 Thread Tom Anderson
Hello everyone, long time no see, This is probably not a Python problem, but rather a regular expressions problem. I want, for the sake of arguments, to match strings comprising any number of occurrences of 'spa', each interspersed by any number of occurrences of the 'm'. 'any number' includ

Re: Integrating doctest with unittest

2011-01-09 Thread Aahz
In article <4d038b63$0$3$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > >Is there a way to have unittest.main() find and run doc_test_suite >together with the other test suites? You probably need to use nose or something. (That's what we're doing.) -- Aahz (a...@pythoncraft

Re: Nothing to repeat

2011-01-09 Thread Ian
On 09/01/2011 16:49, Tom Anderson wrote: Hello everyone, long time no see, This is probably not a Python problem, but rather a regular expressions problem. I want, for the sake of arguments, to match strings comprising any number of occurrences of 'spa', each interspersed by any number of o

Re: Nothing to repeat

2011-01-09 Thread Ian
On 09/01/2011 17:49, Ian wrote: I think you want to anchor your list, or anything will match. Perhaps My bad - this is better re.compile('^((spa)*(m)*)+$') search finds match in 'spa', 'spaspaspa', 'spammmspa', '' and 'mmm' search fails on 'spats', 'mats' and others. -- http://mail.p

Re: Nothing to repeat

2011-01-09 Thread Martin Gregorie
On Sun, 09 Jan 2011 16:49:35 +, Tom Anderson wrote: > > Any thoughts on what i should do? Do i have to bite the bullet and apply > some cleverness in my pattern generation to avoid situations like this? > This sort of works: import re f = open("test.txt") p = re.compile("(spam*)*") for line

Re: Nothing to repeat

2011-01-09 Thread Terry Reedy
On 1/9/2011 11:49 AM, Tom Anderson wrote: Hello everyone, long time no see, This is probably not a Python problem, but rather a regular expressions problem. I want, for the sake of arguments, to match strings comprising any number of occurrences of 'spa', each interspersed by any number of occu

Re: Help needed with unittest and global

2011-01-09 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Ian Hobson wrote: Hi all, I am trying to develop a PyQt application, and I want to unittest it. After three false starts, I am plainly unaware of something rather basic - can some kind person please help me out? This is a log to show what I have so far D:\work\ian>ty

Re: Help needed with unittest and global

2011-01-09 Thread Ian
On 09/01/2011 19:53, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Ian Hobson wrote: Hi all, I am trying to develop a PyQt application, and I want to unittest it. snip D:\work\ian>python testAll.py E == ERROR: test001_walking

What INI config file module allows lists of duplicate same-named options?

2011-01-09 Thread Thomas L. Shinnick
Having (possibly) surveyed all the available pypi config file modules, I still haven't seen one that allows an obvious and familiar extension of the strict Windows INI format. Each INI-style config module seems to enforce the strict rule: each option in a section must have a different name - n

Re: What INI config file module allows lists of duplicate same-named options?

2011-01-09 Thread Corey Richardson
On 01/09/2011 03:43 PM, Thomas L. Shinnick wrote: > Having (possibly) surveyed all the available pypi config file modules, I > still haven't seen one that allows an obvious and familiar extension of > the strict Windows INI format. > > Each INI-style config module seems to enforce the strict rule

Re: What INI config file module allows lists of duplicate same-named options?

2011-01-09 Thread Stefan Sonnenberg-Carstens
Am 09.01.2011 21:43, schrieb Thomas L. Shinnick: Having (possibly) surveyed all the available pypi config file modules, I still haven't seen one that allows an obvious and familiar extension of the strict Windows INI format. Each INI-style config module seems to enforce the strict rule: each

Re: What INI config file module allows lists of duplicate same-named options?

2011-01-09 Thread Thomas L. Shinnick
At 02:47 PM 1/9/2011, Corey Richardson wrote: On 01/09/2011 03:43 PM, Thomas L. Shinnick wrote: > Having (possibly) surveyed all the available pypi config file modules, I > still haven't seen one that allows an obvious and familiar extension of > the strict Windows INI format. > > Each INI-style

Re: What INI config file module allows lists of duplicate same-named options?

2011-01-09 Thread Thomas L. Shinnick
At 02:52 PM 1/9/2011, Stefan Sonnenberg-Carstens wrote: Am 09.01.2011 21:43, schrieb Thomas L. Shinnick: Having (possibly) surveyed all the available pypi config file modules, I still haven't seen one that allows an obvious and familiar extension of the strict Windows INI format. Each INI-sty

Re: Embedded Python static modules

2011-01-09 Thread Евгений Почитаев
I made frozen modules and link this modules with my program. PyImport_FrozenModules = frozen_modules; Py_Initialize(); I got next message: Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Traceback (most recent call last

Re: Embedded Python static modules

2011-01-09 Thread Евгений Почитаев
I found solution: Py_NoSiteFlag = 1; Py_FrozenFlag = 1; Py_IgnoreEnvironmentFlag = 1; Py_SetPythonHome(""); Py_SetProgramName(""); -- http://mail.python.org/mailman/listinfo/python-list

Re: Integrating doctest with unittest

2011-01-09 Thread Steven D'Aprano
On Sun, 09 Jan 2011 08:56:52 -0800, Aahz wrote: > In article <4d038b63$0$3$c3e8da3$54964...@news.astraweb.com>, Steven > D'Aprano wrote: >> >>Is there a way to have unittest.main() find and run doc_test_suite >>together with the other test suites? > > You probably need to use nose or someth