[issue42594] Provide a way to skip magic-number search in ZipFile(mode='a')

2020-12-07 Thread Bart Robinson
New submission from Bart Robinson : When a ZipFile object is created with mode='a', the existing file contents are checked for the magic number b"PK\005\006" near the end of the file. If a non-zipfile just happens to contain this magic number, it can confuse the library int

[issue12450] Use the Grisu algorithms to convert floats to strings

2017-02-19 Thread Bart Robinson
Bart Robinson added the comment: Six years later, I have accepted Amaury's challenge and created an extension module that uses the double-conversion library to generate repr's for floats: https://pypi.python.org/pypi/frepr My rudimentary performance testing gives something like 8X speedup

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 3:35:53 PM UTC+13, Erik wrote: > On 04/01/17 02:24, Callum Robinson wrote: > > On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: > >> What values can 'is_same' return? > >> > >> Which of those values are you checkin

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: > On 2017-01-04 01:37, Callum Robinson wrote: > > On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: > >> Im doing a new task from my teacher but i can't seem to find what is wrong with thi

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:45:22 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:30, Callum Robinson wrote: > > I feel like im missing something so blatantly obvious. > > That's because you are ;). I don't want to come across as patronising, > but I want yo

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: > Im doing a new task from my teacher but i can't seem to find what is wrong with this code. Can anyone help? > > #mynumber.py > # this game uses a home made function > import random > &g

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:26:26 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:02, Callum Robinson wrote: > > When i check the code it comes up with invalid syntax and my writing > line gets re directed here > > > > def is_same(target, number: &g

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 2:16:08 PM UTC+13, Steve D'Aprano wrote: > On Wed, 4 Jan 2017 12:04 pm, Callum Robinson wrote: > > > Traceback (most recent call last): > > File "D:/Python/random.py", line 6, in > > computer_number = number.randint(1

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:03:18 PM UTC+13, Erik wrote: > On 03/01/17 23:56, Chris Angelico wrote: > > On Wed, Jan 4, 2017 at 10:49 AM, wrote: > >> #think of a number > >> computer_number = number.randint(1,100) > > > > What's wrong is that you aren't showing us the

Re: Hey, I'm new to python so don't judge.

2017-01-05 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:26:26 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:02, Callum Robinson wrote: > > When i check the code it comes up with invalid syntax and my writing > line gets re directed here > > > > def is_same(target, number: &g

Re: Hey, I'm new to python so don't judge.

2017-01-05 Thread Callum Robinson
When i check the code it comes up with invalid syntax and my writing line gets re directed here def is_same(target, number: if target == number: result="win" elif target > number: result="low" else: result="high" return result

Re: Hey, I'm new to python so don't judge.

2017-01-05 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:17:11 PM UTC+13, Chris Angelico wrote: > On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: > > I doubt it's getting that far (I can see at least one syntax error in the > > code pasted). > > True true. In any case, the point is to copy and

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 3:35:53 PM UTC+13, Erik wrote: > On 04/01/17 02:24, Callum Robinson wrote: > > On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: > >> What values can 'is_same' return? > >> > >> Which of those values are you checkin

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: > On 2017-01-04 01:37, Callum Robinson wrote: > > On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: > >> Im doing a new task from my teacher but i can't seem to find what is wrong > &

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: > Im doing a new task from my teacher but i can't seem to find what is wrong > with this code. Can anyone help? > > #mynumber.py > # this game uses a home made function > import random >

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 2:16:08 PM UTC+13, Steve D'Aprano wrote: > On Wed, 4 Jan 2017 12:04 pm, Callum Robinson wrote: > > > Traceback (most recent call last): > > File "D:/Python/random.py", line 6, in > > computer_number = number.randint(1

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:45:22 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:30, Callum Robinson wrote: > > I feel like im missing something so blatantly obvious. > > That's because you are ;). I don't want to come across as patronising, &g

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:26:26 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:02, Callum Robinson wrote: > > When i check the code it comes up with invalid syntax and my writing > line gets re directed here > > > > def is_same(target, number: &g

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:26:26 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:02, Callum Robinson wrote: > > When i check the code it comes up with invalid syntax and my writing > line gets re directed here > > > > def is_same(target, number: &g

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:17:11 PM UTC+13, Chris Angelico wrote: > On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: > > I doubt it's getting that far (I can see at least one syntax error in the > > code pasted). > > True true. In any case, the point is to copy and

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:03:18 PM UTC+13, Erik wrote: > On 03/01/17 23:56, Chris Angelico wrote: > > On Wed, Jan 4, 2017 at 10:49 AM, wrote: > >> #think of a number > >> computer_number = number.randint(1,100) > > > > What's wrong is that you aren't showing us the

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
When i check the code it comes up with invalid syntax and my writing line gets re directed here def is_same(target, number: if target == number: result="win" elif target > number: result="low" else: result="high" return result

[issue26195] Windows frozen .exe multiprocessing.Queue access is denied exception

2016-02-28 Thread Alex Robinson
Alex Robinson added the comment: Sorry I can't help more than provide a test environment for any fix. I just plucked the "fix" from StackOverflow and it fixed the Q problem on my machine. It appears, at the least, the multiprocessing code should probably not rely on the def

[issue26195] Windows frozen .exe multiprocessing.Queue access is denied exception

2016-01-24 Thread Alex Robinson
New submission from Alex Robinson: A pyinstaller 3.0 frozen .exe Python 2.7.10 program under Windows 7 that uses a multiprocessing.Queue to send things to a multiprocessing.Process leads to the process getting access-is-denied exceptions on every q.get() call. And, when the program can't exit

Re: local variable 'juveniles' referenced before assignment

2016-01-13 Thread Alan Robinson
On Wednesday, 13 January 2016 12:32:51 UTC, Chris Angelico wrote: > On Wed, Jan 13, 2016 at 11:23 PM, Alan Robinson > <arobin...@lordlawson.org.uk> wrote: > > def menu(): > > option = int(input("Please select an option: \n 1: Set Generation 0 > > Values

Re: local variable 'juveniles' referenced before assignment

2016-01-13 Thread Alan Robinson
On Wednesday, 13 January 2016 13:06:11 UTC, Peter Otten wrote: > Alan Robinson wrote: > > > On Wednesday, 13 January 2016 12:32:51 UTC, Chris Angelico wrote: > >> On Wed, Jan 13, 2016 at 11:23 PM, Alan Robinson > >> <arobin...@lordlawson.org.uk> wrote: > &

local variable 'juveniles' referenced before assignment

2016-01-13 Thread Alan Robinson
def menu(): option = int(input("Please select an option: \n 1: Set Generation 0 Values \n 2: View Generation 0 Values \n 3: Run Model \n 4: Print values")) if option == 1: juveniles,adults,seniles = setGen() elif option == 2: displayGen() elif option == 3:

Re: local variable 'juveniles' referenced before assignment

2016-01-13 Thread Alan Robinson
On Wednesday, 13 January 2016 13:23:04 UTC, Alan Robinson wrote: > On Wednesday, 13 January 2016 13:06:11 UTC, Peter Otten wrote: > > Alan Robinson wrote: > > > > > On Wednesday, 13 January 2016 12:32:51 UTC, Chris Angelico wrote: > > >> On Wed, Jan

install issue

2015-12-07 Thread John Robinson
When I run the installer (python-3.5.0.exe [win32]) I see this: There seems to be "hidden" buttons as clicking in the middle of this dialog box does continue the process. However, when complete, and I start python, I get an error saying its not a valid win32 application. So, I

RE: Puzzled

2015-11-08 Thread Robinson, Wendy
Ah, ok I get it now. Thanks both! Wendy Robinson Audit Analyst -Original Message- From: Chris Gonnerman [mailto:ch...@gonnerman.org] Sent: Friday, November 06, 2015 5:40 AM To: python-list@python.org Cc: Robinson, Wendy Subject: Re: Puzzled Wendy said: > I installed Python 3.

RE: Puzzled

2015-11-06 Thread Robinson, Wendy
Well... I still can't get this to work. I guess I'll just uninstall it. It's a bummer that there's no help on basic startup like this. Wendy Robinson Audit Analyst (916) 566-4994 phone NOTICE OF CONFIDENTIALITY: This email is for the sole use of the intended recipient and may contain material

RE: Puzzled

2015-11-06 Thread Robinson, Wendy
Hmmm... fair enough. I sent the traceback though, on Monday. I'll give the intro a read again. I've probably missed something basic. Wendy Robinson Audit Analyst (916) 566-4994 phone NOTICE OF CONFIDENTIALITY: This email is for the sole use of the intended recipient and may contain material

RE: Puzzled

2015-11-02 Thread Robinson, Wendy
[cid:image001.png@01D11543.5ED11D50] Wendy Robinson Audit Analyst (916) 566-4994 phone NOTICE OF CONFIDENTIALITY: This email is for the sole use of the intended recipient and may contain material that is confidential and protected by state and federal regulations. If you

Puzzled

2015-11-01 Thread Robinson, Wendy
at the >>> prompt gives me a NameError. I tried running the Repair installation, but that did not help. Any suggestions? Thank you Wendy Robinson Audit Analyst (916) 566-4994 phone [cid:image001.jpg@01D112F4.341BC390] NOTICE OF CONFIDENTIALITY: This email is for the sole use of the

Cross compiling C Python2.7.10 for arm on x86_64 linux box.

2015-06-30 Thread Andrew Robinson
Hi, I'm Needing to get python 2.7.10 to cross compile correctly for an ARM embedded device. I'm very close, as it does build with warnings, but the result is defective and I'm not sure how to fix it. For some odd reason, the interpreter does run -- but I either get random segfaults -- or if I

Re: Fwd: Re: Comparisons and sorting of a numeric class....

2015-01-29 Thread Andrew Robinson
On 01/27/2015 02:04 AM, Gregory Ewing wrote: Andrew Robinson wrote: The spelling caveat is great -- and in Python the object named in bool's honor is spelled bool (lowercase too). ;) That doesn't change the fact that the man was called George Boole (not Charles!). If you're going to refer

Re: Fwd: Re: Comparisons and sorting of a numeric class....

2015-01-27 Thread Andrew Robinson
On 01/26/2015 02:22 PM, Ian Kelly wrote: On Jan 26, 2015 6:42 AM, Andrew Robinson andr...@r3dsolutions.com mailto:andr...@r3dsolutions.com wrote: ... If you're going to descend into insults and name-calling, then I'm not going to waste any more of my time on this thread. I don't

Fwd: Re: Comparisons and sorting of a numeric class....

2015-01-26 Thread Andrew Robinson
Original Message Subject:Re: Comparisons and sorting of a numeric class Date: Mon, 26 Jan 2015 05:38:22 -0800 From: Andrew Robinson andr...@r3dsolutions.com To: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info On 01/24/2015 12:27 AM, Steven D'Aprano

Re: Fwd: Re: Comparisons and sorting of a numeric class....

2015-01-26 Thread Andrew Robinson
on here. I seriously doubt I will ever read them all... On 01/26/2015 08:31 AM, Mark Lawrence wrote: On 26/01/2015 13:38, Andrew Robinson wrote: *plonk* Ah well, now that I have actually bothered to read your three replies, I suppose the most surprising part of your emails is this: -My

Re: Comparisons and sorting of a numeric class....

2015-01-26 Thread Andrew Robinson
wrote: On Wed, 14 Jan 2015 23:23:54 -0800 Andrew Robinson andr...@r3dsolutions.com wrote: Boolean algebra has two values: true and false, or 1 and 0, or humpty and dumpty, or whatever you like to call them. You're speaking to an Electrical engineer. I know there are 10 kinds of people, those who

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Andrew Robinson
On 01/15/2015 09:05 AM, Ian Kelly wrote: On Thu, Jan 15, 2015 at 12:23 AM, Andrew Robinson andr...@r3dsolutions.com wrote: Can you name any other language that *does* allow subclassing of booleans or creation of new boolean values? Yes. Several off the top of my head -- and I have mentioned

Re: Comparisons and sorting of a numeric class....

2015-01-15 Thread Andrew Robinson
On 01/15/2015 12:41 AM, Steven D'Aprano wrote: On Wed, 14 Jan 2015 23:23:54 -0800, Andrew Robinson wrote: [...] A subclass is generally backward compatible in any event -- as it is built upon a class, so that one can almost always revert to the base class's meaning when desired

Re: Comparisons and sorting of a numeric class....

2015-01-14 Thread Andrew Robinson
And most of this thread has been nothing more than me asking why did Guido say to do that -- and people avoiding answering the question. Wait, are you actually asking why bool is a doubleton? If nobody has answered that, I think probably nobody understood you were asking it, because it

Re: Comparisons and sorting of a numeric class....

2015-01-13 Thread Andrew Robinson
On 01/12/2015 09:32 PM, Steven D'Aprano wrote: On Mon, 12 Jan 2015 17:59:42 -0800, Andrew Robinson wrote: [...] What I am wanting to know is WHY did Guido think it so important to do that ? Why was he so focused on a strict inability to have any instances of a bool subclass at all

Re: Comparisons and sorting of a numeric class....

2015-01-12 Thread Andrew Robinson
On 01/07/2015 04:04 PM, Ethan Furman wrote: On 01/06/2015 07:37 PM, Andrew Robinson wrote: Explain; How does mere subclassing of bool break the contract that bool has? eg: What method or data would the superclass have that my subclass would not? bool's contract is that there are only two

Re: Comparisons and sorting of a numeric class....

2015-01-12 Thread Andrew Robinson
On 01/12/2015 02:35 PM, Chris Angelico wrote: On Tue, Jan 13, 2015 at 9:27 AM, Andrew Robinson andr...@r3dsolutions.com wrote: Huh? I'm not adding any values when I merely subclass bool ; and even if the subclass could be instantiated -- that's doesn't mean a new value or instance of the base

Re: Comparisons and sorting of a numeric class....

2015-01-12 Thread Andrew Robinson
that assertion from anyway and how is it related to Guido and formal definitions of the python language ??? Are you really trying to imply that Guido wrote that assertion ? On Tue, Jan 13, 2015 at 12:59 PM, Andrew Robinson andr...@r3dsolutions.com wrote: There is no need to copy data from

Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
Hi, I'm building a custom numeric class that works with values that have uncertainty and am wanting to make it as compatible with floating point objects as possible -- so as to be usable in legacy code with minimal rewites; but but I am having trouble understanding how to handle magnitude

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean False, but can be differentiated from false by the 'is' operator. It's frustrating -- what good is subclassing, if one cant subclass all the

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 05:35 AM, Chris Angelico wrote: On Wed, Jan 7, 2015 at 12:30 AM, Andrew Robinson andr...@r3dsolutions.com wrote: Why this is so important to Guido, I don't know ... but it's making it VERY difficult to add named aliases of False which will still be detected as False and type

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 06:02 AM, Dave Angel wrote: On 01/06/2015 08:30 AM, Andrew Robinson wrote: So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean False, but can be differentiated from false

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 06:34 PM, Terry Reedy wrote: On 1/6/2015 9:01 PM, Andrew Robinson wrote: [snip] There are very few (about 4) builtin classes that cannot be subclassed. bool is one of those few, float is not. Go ahead and subclass it. class F(float): pass F class '__main__.F' F(2.3

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 06:31 PM, Chris Angelico wrote: The type check issue is mostly about compatability in the first place ; eg: users typecheck either unintentionally -- (novices syndrome) -- or because they need all the capabilities of a given type, and the only simple way to find out if they are

[issue15907] move doctest test-data files into a subdirectory of Lib/test

2014-08-07 Thread Jason Robinson
Jason Robinson added the comment: Ezio, here are new versions of the patch. This time I used `hg mv` command to move the files to the new location and then copied over the correct versions. It does look though to me that there is no difference except timestamps. I will upload also a --git

[issue15907] move doctest test-data files into a subdirectory of Lib/test

2014-08-07 Thread Jason Robinson
Jason Robinson added the comment: Here is the `hg diff --git` patch. Hope this one applies :) -- Added file: http://bugs.python.org/file36303/issue15907_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15907

[issue19996] httplib infinite read on invalid header

2014-08-02 Thread Jason Robinson
Jason Robinson added the comment: I took the patches and verified that; * running the new tests without the changed code in Lib/email/feedparser.py (head) and Lib/httplib.py, Lib/rfc822.py (2.7) fails both the new tests. * running the new tests with the changed code passes the tests (on both

[issue17762] platform.linux_distribution() should honor /etc/os-release

2014-08-02 Thread Jason Robinson
Jason Robinson added the comment: platform.linux_distribution is being deprecated in 3.5 and removed in 3.6 as stated in comment http://bugs.python.org/issue1322#msg207427 in issue #1322 I'm guessing this issue should be closed when that patch is merged in? -- nosy: +jaywink

[issue9514] platform.linux_distribution() under Ubuntu returns ('debian', 'squeeze/sid', '')

2014-08-02 Thread Jason Robinson
Jason Robinson added the comment: platform.linux_distribution is being deprecated in 3.5 and removed in 3.6 as stated in comment http://bugs.python.org/issue1322#msg207427 in issue #1322 I'm guessing this issue should be closed when that patch is merged in? -- nosy: +ezio.melotti

[issue15907] move doctest test-data files into a subdirectory of Lib/test

2014-08-02 Thread Jason Robinson
Jason Robinson added the comment: Here is a patch that hopefully does what was intended. All the tests passed locally, hopefully the tests we're adapted correctly to the new location of the files. My first patch :) I added a new data file 'doctest_DocFileSuite_test.txt' to Lib/test to keep

ANN: ReportLab PLUS and open source 3.1 released with Python 3 support

2014-05-05 Thread Andy Robinson
information: ReportLab softwarehttps://www.reportlab.com/software/ RML and other support documents https://www.reportlab.com/software/documentation/ Andy Robinson CEO / Chief Architect ReportLab -- https://mail.python.org/mailman/listinfo/python-announce-list Support

ReportLab 3.0 release - Python 2.7 / 3.3+ compatible

2014-02-14 Thread Andy Robinson
it far easier than before to install and try out the commercial package. Many thanks to Robin Becker who has done the vast majority of the work alone on this extremely complex port. Best Regards -- Andy Robinson Managing Director ReportLab Europe Ltd. Thornton House, Thornton Road, Wimbledon

ReportLab 3.0 alpha 1 available - Python 2.7 3.3 support

2014-02-07 Thread Andy Robinson
Robinson Managing Director ReportLab Europe Ltd. Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK Tel +44-20-8405-6420 -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
On 02/14/2013 05:23 AM, Terry Reedy wrote: On 2/13/2013 2:00 PM, stephenw...@gmail.com wrote: Hello, Would it be feasible to modify the Python grammar to allow ':' to generate slice objects everywhere rather than just indexers and top-level tuples of indexers? Right now in Py2.7, Py3.3:

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
Errata, I made a tyepopeo in the middle of the night: eg:Python evaluates right to left; this is semantically an iterator giving a[1],a[2],a[5],a[11] Sigh: Python Iterates from left to right; --Andrew. -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
On 02/25/2013 10:28 AM, Ian Kelly wrote: On Sun, Feb 24, 2013 at 6:10 PM, Andrew Robinson andrew3@xxx wrote: I've read through the whole of the subject, and the answer is no, although I think allowing it in (::) is a *very* good idea, including as a replacement for range or xrange. s=1:2:3

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
On 02/25/2013 04:54 PM, Ian Kelly wrote: On Mon, Feb 25, 2013 at 12:41 AM, Andrew Robinson andr...@r3dsolutions.com wrote: Intuitively, it should result in an infinite loop starting at 0. But ranges require a stop value for a very good reason -- it should not be this easy to accidentally

Re: FYI: AI-programmer

2013-02-22 Thread Andrew Robinson
On 02/22/2013 07:21 PM, Ian Kelly wrote: On Fri, Feb 22, 2013 at 4:41 AM, Chris Angelico ros...@gmail.com wrote: That's not artificial intelligence, though. It's artificial program generation based on a known target output. The Fitness calculation is based on a specific target string. This is

Re: FYI: AI-programmer

2013-02-22 Thread Andrew Robinson
On 02/22/2013 08:23 PM, Ian Kelly wrote: On Fri, Feb 22, 2013 at 5:09 AM, Andrew Robinson andr...@r3dsolutions.com wrote: On 02/22/2013 07:21 PM, Ian Kelly wrote: I am curious about how he deals with infinite loops in the generated programs. Probably he just kills the threads after they pass

Re: call from pthon to shell

2013-02-12 Thread Andrew Robinson
On 02/12/2013 05:38 AM, Bqsj Sjbq wrote: import os os.system(i=3) 0 os.system(echo $i) 0 why i can not get the value of i? First: os.system is only defined to give the return value (exit code) of the sub-process. However, one way to get the output of shell commands is to use

string.replace doesn't removes :

2013-02-09 Thread Joshua Robinson
Hi *Monte-Pythons*, x = this is a simple : text: that has colon s = x.replace(string.punctuation, ); OR s = x.replace(string.punctuation, ); print x # 'this is a simple : text: that has colon' # The colon is still in the text Is this a bug or am I doing something wrong ? Py.Version: 2.7

multi-result set MySQLdb queries.

2013-02-07 Thread Andrew Robinson
Hi, I'm being forced to use import MySQLdb to access a serverand am not getting all my data back. I'm trying to send multiple queries all at once (for time reasons) and then extract the rows in bulk. The queries have different number of columns; For a contrived example; script.db.query(

XML validation / exception.

2013-01-24 Thread Andrew Robinson
A quick question: On xml.etree, When I scan in a handwritten XML file, and there are mismatched tags -- it will throw an exception. and the exception will contain a line number of the closing tag which does not have a mate of the same kind. Is there a way to get the line number of the

XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Andrew Robinson
Good day :), I've been exploring XML parsers in python; particularly: xml.etree.cElementTree; and I'm trying to figure out how to do it incrementally, for very large XML files -- although I don't think the problems are restricted to incremental parsing. First problem: I've come across an

Re: XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Andrew Robinson
On 01/24/2013 06:42 AM, Stefan Behnel wrote: Andrew Robinson, 23.01.2013 16:22: Good day :), Nope, you should read the manual on this. Here's a tutorial: http://lxml.de/tutorial.html#elements-contain-text I see, so it should be under the tail attribute, not the text attribute. That's why I

Vote tallying...

2013-01-18 Thread Andrew Robinson
Hi, I have a problem which may fit in a mysql database, but which I only have python as an alternate tool to solve... so I'd like to hear some opinions... I'm building a experimental content management program on a standard Linux Web server. And I'm needing to keep track of archived votes

Re: Vote tallying...

2013-01-18 Thread Andrew Robinson
On 01/18/2013 08:47 AM, Stefan Behnel wrote: Andrew Robinson, 18.01.2013 00:59: I have a problem which may fit in a mysql database Everything fits in a MySQL database - not a reason to use it, though. Py2.5 and later ship with sqlite3 and if you go for an external database, why use MySQL

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Andrew Robinson
On 12/18/2012 07:03 AM, Chris Angelico wrote: On Wed, Dec 19, 2012 at 1:28 AM, Roy Smithr...@panix.com wrote: In articlead040201-ba94-496c-bb17-7433b0e09...@googlegroups.com, iMathredstone-c...@163.com wrote: Download the source for the version you're interested in. but which python

Re: Preventing tread collisions

2012-12-13 Thread Andrew Robinson
On 12/12/2012 12:29 PM, Dave Angel wrote: On 12/12/2012 03:11 PM, Wanderer wrote: I have a program that has a main GUI and a camera. In the main GUI, you can manipulate the images taken by the camera. You can also use the menu to check the camera's settings. Images are taken by the camera in a

Re: Running a python script under Linux

2012-12-13 Thread Andrew Robinson
On 12/13/2012 06:45 PM, Steven D'Aprano wrote: I understand this is not exactly a Python question, but it may be of interest to other Python programmers, so I'm asking it here instead of a more generic Linux group. I have a Centos system which uses Python 2.4 as the system Python, so I set an

Re: Running a python script under Linux

2012-12-13 Thread Andrew Robinson
On 12/13/2012 06:45 PM, Steven D'Aprano wrote: What am I doing wrong? By the way, I didn't include command line parameters as part of the function definition, so you might want to add them to insure it acts like a generic alias. Also, (alternately), you could define a generic python shell

Re: Multi-dimensional list initialization

2012-11-08 Thread Andrew Robinson
On 11/07/2012 11:09 PM, Ian Kelly wrote: On Wed, Nov 7, 2012 at 8:13 PM, Andrew Robinson andr...@r3dsolutions.com wrote: OK, and is this a main use case? (I'm not saying it isn't I'm asking.) I have no idea what is a main use case. Well, then we can't evaluate if it's worth keeping a list

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
Hi IAN! On 11/06/2012 03:52 PM, Ian Kelly wrote: On Tue, Nov 6, 2012 at 3:41 PM, Andrew Robinson The objection is not nonsense; you've merely misconstrued it. If [[1,2,3]] * 4 is expected to create a mutable matrix of 1s, 2s, and 3s, then one would expect [[{}]] * 4 to create a mutable matrix

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/06/2012 05:55 PM, Steven D'Aprano wrote: On Tue, 06 Nov 2012 14:41:24 -0800, Andrew Robinson wrote: Yes. But this isn't going to cost any more time than figuring out whether or not the list multiplication is going to cause quirks, itself. Human psychology *tends* (it's a FAQ

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/06/2012 10:56 PM, Demian Brecht wrote: My question was *not* based on what I perceive to be intuitive (although most of this thread has now seemed to devolve into that and become more of a philosophical debate), but was based on what I thought may have been inconsistent behaviour (which

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 05:39 AM, Joshua Landau wrote: On 7 November 2012 11:11, Oscar Benjamin wrote: On Nov 7, 2012 5:41 AM, Gregory Ewing wrote: If anything is to be done in this area, it would be better as an extension of list comprehensions, e.g. [[None times 5]

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 01:01 PM, Ian Kelly wrote: On Wed, Nov 7, 2012 at 12:51 PM, Andrew Robinson andr...@r3dsolutions.com wrote: Interesting, you avoided the main point lists are copied with list multiplication. It seems that each post is longer than the last. If we each responded to every point

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 03:39 PM, Ian Kelly wrote: Why? Just to get rid of an FAQ? :-) Here's one of the more interesting uses from my own code: OK, and is this a main use case? (I'm not saying it isn't I'm asking.) Replacing the list multiplication in that function with a list comprehension would

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 04:00 PM, Steven D'Aprano wrote: Andrew, it appears that your posts are being eaten or rejected by my ISP's news server, because they aren't showing up for me. Possibly a side- effect of your dates being in the distant past? Date has been corrected since two days ago. It will

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/05/2012 10:07 PM, Chris Angelico wrote: On Tue, Nov 6, 2012 at 4:51 PM, Andrew Robinson andr...@r3dsolutions.com wrote: I really don't think doing a shallow copy of lists would break anyone's program. Well, it's a change, a semantic change. It's almost certainly going to break

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 06:35 AM, Oscar Benjamin wrote: In general, people don't use element multiplication (that I have *ever* seen) to make lists where all elements of the outer most list point to the same sub-*list* by reference. The most common use of the multiplication is to fill an array with

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 09:32 AM, Prasad, Ramit wrote: Ian Kelly wrote: On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson [snip] See if you can find *any* python program where people desired the multiplication to have the die effect that changing an object in one of the sub lists -- changes all

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 01:19 AM, Ian Kelly wrote: On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson If you nest it another time; [[[None]]]*4, the same would happen; all lists would be independent -- but the objects which aren't lists would be refrenced-- not copied. a=[[[alpha,beta]]]*4 would yield

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 01:04 AM, Steven D'Aprano wrote: On Mon, 05 Nov 2012 21:51:24 -0800, Andrew Robinson wrote: The most compact notation in programming really ought to reflect the most *commonly* desired operation. Otherwise, we're really just making people do extra typing for no reason

Re: Multi-dimensional list initialization

2012-11-05 Thread Andrew Robinson
On 11/05/2012 06:30 PM, Oscar Benjamin wrote: On 6 November 2012 02:01, Chris Angelicoros...@gmail.com wrote: On Tue, Nov 6, 2012 at 12:32 PM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: I was just thinking to myself that it would be a hard thing to change because the list would need to

Re: Multi-dimensional list initialization

2012-11-04 Thread Andrew Robinson
On 11/04/2012 10:27 PM, Demian Brecht wrote: So, here I was thinking oh, this is a nice, easy way to initialize a 4D matrix (running 2.7.3, non-core libs not allowed): m = [[None] * 4] * 4 The way to get what I was after was: m = [[None] * 4, [None] * 4, [None] * 4, [None * 4]] FYI: The

Re: Multi-dimensional list initialization

2012-11-04 Thread Andrew Robinson
On 11/04/2012 11:27 PM, Chris Angelico wrote: On Mon, Nov 5, 2012 at 6:07 PM, Chris Rebertc...@rebertia.com wrote: x = None x.a = 42 Traceback (most recent call last): File stdin, line 1, inmodule AttributeError: 'NoneType' object has no attribute 'a' Python needs a

Fwd: Re: Negative array indicies and slice()

2012-11-03 Thread Andrew Robinson
Forwarded to python list: Original Message Subject:Re: Negative array indicies and slice() Date: Sat, 03 Nov 2012 15:32:04 -0700 From: Andrew Robinson Reply-To: andr...@r3dsolutions.com To: Ian Kelly On 11/01/2012 05:32 PM, Ian Kelly wrote: On Thu

Re: Negative array indicies and slice()

2012-11-02 Thread Andrew Robinson
Hi Ian, I apologize for trying your patience with the badly written code example. All objects were meant to be ThirdParty(), the demo was only to show how a slice() filter could have been applied for the reasons PEP357 made index() to exist. eg: because numpy items passed to __getitems__ via

Memory profiling: Python 3.2

2012-11-02 Thread Andrew Robinson
When Python3.2 is running, is there an easy way within Python to capture the *total* amount of heap space the program is actually using (eg:real memory)? And how much of that heap space is allocated to variables ( including re-capturable data not yet GC'd ) ? --

Re: Negative array indicies and slice()

2012-11-01 Thread Andrew Robinson
On 11/01/2012 07:12 AM, Ethan Furman wrote: Andrew Robinson wrote: On 10/31/2012 02:20 PM, Ian Kelly wrote: On Wed, Oct 31, 2012 at 7:42 AM, Andrew Robinson wrote: Then; I'd note: The non-goofy purpose of slice is to hold three data values; They are either numbers or None

  1   2   >