Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread alex23
On Oct 30, 2:33 am, Johannes Bauer wrote: > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to call some private methods of

Re: date and time comparison how to

2012-10-29 Thread noydb
Thanks, I did find this... pdf_timeStamp = time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) >> pdf_timestamp >> '102909133000' ... but now how to do the comparison? Cannot just do a raw string comparison, gotta declare it a date -- http://mail.python.org/mailman/listinfo/p

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Kaynor
On Mon, Oct 29, 2012 at 11:00 AM, Andrew Robinson wrote: > > Let's look at the source code rather than the web notes -- the source must > be the true answer anyhow. > > I downloaded the source code for python 3.3.0, as the tbz; > In the directory "Python-3.3.0/Python", look at Python-ast.c, line 2

Re: date and time comparison how to

2012-10-29 Thread noydb
if I do time.time() I get 1351562187.757, do it again I get 1351562212.2650001 --- so I can compare those, the latter is later then the former. Good. SO how do I turn pdf_timeStamp (a string) above into time in this (as from time.time()) format? Am I on the right track -- is that the way to d

Re: date and time comparison how to

2012-10-29 Thread noydb
I guess I get there eventually! This seems to work pdf_timeStamp = time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) intermediateTime = time.strptime(pdf_timeStamp, "%m%d%y%H%M%S") pdfFile_compareTime = time.mktime(intermediateTime) (and I'll do the same to the us

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 complicated effort. It isn'

Re: date and time comparison how to

2012-10-29 Thread Dave Angel
On 10/29/2012 10:13 PM, noydb wrote: > I guess I get there eventually! > This seems to work > > pdf_timeStamp = > time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) > intermediateTime = time.strptime(pdf_timeStamp, "%m%d%y%H%M%S") > pdfFile_compareTime = time.mktime(

Re: date and time comparison how to

2012-10-29 Thread MRAB
On 2012-10-30 03:11, Dave Angel wrote: On 10/29/2012 10:13 PM, noydb wrote: I guess I get there eventually! This seems to work pdf_timeStamp = time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) intermediateTime = time.strptime(pdf_timeStamp, "%m%d%y%H%M%S") pdfFile

Re: date and time comparison how to

2012-10-29 Thread noydb
On Monday, October 29, 2012 11:11:55 PM UTC-4, Dave Angel wrote: > On 10/29/2012 10:13 PM, noydb wrote: > > > I guess I get there eventually! > > > This seems to work > > > > > > pdf_timeStamp = > > time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) > > > intermedia

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 Michael Torrie
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 have to reject > certain parts of Python to ma

Re: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 12:00 PM, Andrew Robinson wrote: > I downloaded the source code for python 3.3.0, as the tbz; > In the directory "Python-3.3.0/Python", look at Python-ast.c, line 2089 & > ff. Python-ast.c is part of the compiler code. That's not the struct used to represent the object at

Re: date and time comparison how to

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 3:20 PM, noydb wrote: > But for the user supplied date... I'm not sure of the format just yet... > testing with a string for now (actual date-date might be possible, tbd > later), so like '10292012213000' (oct 29, 2012 9:30pm). How would you get > that input into a form

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 Ian Kelly
On Mon, Oct 29, 2012 at 4:39 PM, Andrew Robinson wrote: > In addition to those items you mention, of which the reference count is not > even *inside* the struct -- there is additional debugging information not > mentioned. Built in objects contain a "line number", a "column number", and > a "cont

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* to do:

<    1   2