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 y

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 wit

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

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(

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 exception you get on >

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 paste the error > message. C

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 y

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(

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,

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 paste the error > message.

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 exception you get on >

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 --

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

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 > >> wrote: > >> > def menu(): >

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 > wrote: > > def menu(): > > option = int(input("Please select an option: \n 1: Set Generation 0 > > Values \n 2: View Generation 0 Values \n 3:

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:

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 uninstall

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
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 contai

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

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 are not the

Puzzled

2015-11-01 Thread Robinson, Wendy
un 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 o

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

2015-06-29 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

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" <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.

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

2015-01-26 Thread Andrew Robinson
09:54 AM, Rob Gaddi wrote: On Wed, 14 Jan 2015 23:23:54 -0800 Andrew Robinson 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

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

2015-01-26 Thread Andrew Robinson
edy act that goes 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 e

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 To: Steven D'Aprano On 01/24/2015 12:27 AM, Steven D'Aprano wrote: Andrew Robinson wrote: But let me exp

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 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 these before. They

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 desi

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 shoul

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
w.youtube.com/watch?v=D0yYwBzKAyY Uh, no, -- your assertion excludes nothing you've been telling me is not a bool by contract -- so it doesn't 'define' anything precisely because it's by definition inaccurate. it's simply an invariant form of spam with three ter

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 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 class (b

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 onl

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 a

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

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 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-checkable as a bo

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 fro

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

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 comp

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 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 create an infinite for loop

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 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 for i

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/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: 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 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 some time threshold

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 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 fine for devisin

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 u

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

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 earlier

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&

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 iss

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 if

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 an

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 Smith wrote: In article, iMath wrote: Download the source for the version you're interested in. but which python module is open() in ? I met you half-way, I showed you where the source code is. Now you ne

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: 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 al

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 s

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 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 k

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 remai

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 b

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 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 made, this th

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

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 w

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&#x

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 m

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 reas

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","be

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 the

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/05/2012 10:07 PM, Chris Angelico wrote: On Tue, Nov 6, 2012 at 4:51 PM, Andrew Robinson 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 _something_.

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 Angelico wrote: On Tue, Nov 6, 2012 at 12:32 PM, Oscar Benjamin wrote: I was just thinking to myself that it would be a hard thing to change because the list would need to know how to instantiate copies of all 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 Rebert wrote: x = None x.a = 42 Traceback (most recent call last): File "", line 1, in AttributeError: 'NoneType' object has no attribute 'a' Python needs a YouGottaBeKiddingMeError for times when you do so

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 b

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:

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 ) ? -- http://mail.python.org/mail

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

Re: Negative array indicies and slice()

2012-11-01 Thread Andrew Robinson
On 11/01/2012 12:07 PM, Ian Kelly wrote: On Thu, Nov 1, 2012 at 5:32 AM, Andrew Robinson wrote: H was that PEP the active state of Python, when Tim rejected the bug report? Yes. The PEP was accepted and committed in March 2006 for release in Python 2.5. The bug report is from June

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.

Re: Negative array indicies and slice()

2012-10-31 Thread Andrew Robinson
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. These *normally* encountered values can't create a memory lo

Re: Negative array indicies and slice()

2012-10-31 Thread Andrew Robinson
On 10/30/2012 10:29 PM, Michael Torrie wrote: As this is the case, why this long discussion? If you are arguing for a change in Python to make it compatible with what this fork you are going to create will do, this has already been fairly thoroughly addressed earl on, and reasons why the semant

RE: Negative array indicies and slice()

2012-10-30 Thread Andrew Robinson
Ian, > Looks like it's already been wontfixed back in 2006: > http://bugs.python.org/issue1501180 Absolutely bloody typical, turned down because of an idiot. Who the hell is Tim Peters anyway? > I don't really disagree with him, anyway. It is a rather obscure bug > -- is it worth increasi

Re: Negative array indicies and slice()

2012-10-30 Thread Andrew Robinson
On 10/30/2012 04:48 PM, Mark Lawrence wrote: On 30/10/2012 15:47, Andrew Robinson wrote: I would refer you to a book written by Steve Maguire, Writing Solid Code; Chapter 5; Candy machine interfaces. The book that took a right hammering here http://accu.org/index.php?module=bookreviews

Re: Negative array indicies and slice()

2012-10-30 Thread Andrew Robinson
On 10/30/2012 01:17 AM, Steven D'Aprano wrote: By the way Andrew, the timestamps on your emails appear to be off, or possibly the time zone. Your posts are allegedly arriving before the posts you reply to, at least according to my news client. :D -- yes, I know about that problem. Every time I r

Re: Negative array indicies and slice()

2012-10-30 Thread Andrew Robinson
On 10/30/2012 11:02 AM, Ian Kelly wrote: On Tue, Oct 30, 2012 at 10:14 AM, Ethan Furman wrote: File a bug report? Looks like it's already been wontfixed back in 2006: http://bugs.python.org/issue1501180 Thanks, IAN, you've answered the first of my questions and have been a great help. (And y

Re: Negative array indicies and slice()

2012-10-30 Thread Andrew Robinson
On 10/29/2012 11:51 PM, Ian Kelly wrote: On Mon, Oct 29, 2012 at 4:39 PM, Andrew Robinson As above, you're looking at the compiler code, which is why you're finding things like "line" and "column". The tuple struct is defined in tupleobject.h and stores tuple e

Re: Negative array indicies and slice()

2012-10-30 Thread Andrew Robinson
On 10/29/2012 10:53 PM, Michael Torrie wrote: On 10/29/2012 01:34 PM, Andrew Robinson wrote: No, I don't think it big and complicated. I do think it has timing implications which are undesirable because of how *much* slices are used. In an embedded target -- I have to optimize; and I will

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 04:01 PM, Ian Kelly wrote: On Mon, Oct 29, 2012 at 9:20 AM, Andrew Robinson wrote: FYI: I was asking for a reason why Python's present implementation is desirable... I wonder, for example: Given an arbitrary list: a=[1,2,3,4,5,6,7,8,9,10,11,12] Why would someone *want*

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
Hi Ian, There are several interesting/thoughtful things you have written. I like the way you consider a problem before knee jerk answering. The copying you mention (or realloc) doesn't re-copy the objects on the list. It merely re-copies the pointer list to those objects. So lets see what it w

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 06:49 PM, Chris Kaynor wrote: Every Python object requires two pieces of data, both of which are pointer-sized (one is a pointer, one is an int the size of a pointer). These are: a pointer to the object's type, and the object's reference count. A tuple actually does not need a hea

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 05:02 PM, Steven D'Aprano wrote: On Mon, 29 Oct 2012 08:42:39 -0700, Andrew Robinson wrote: But, why can't I just overload the existing __getitem__ for lists and not bother writing an entire class? You say that as if writing "an entire class" was a big co

  1   2   >