Re: [Tutor] Shelve & immutable objects

2014-01-01 Thread eryksun
On Wed, Jan 1, 2014 at 11:43 AM, Keith Winston wrote: > Thanks Danny, I don't understand the re-persisted part, but I'll look into > it. Shelf.close calls Shelf.sync to flush the cache. Here's what it does: >>> print(inspect.getsource(shelve.Shelf.sync)) def sync(self): i

Re: [Tutor] subtyping builtin type

2014-01-01 Thread Steven D'Aprano
On Wed, Jan 01, 2014 at 02:49:17PM +0100, spir wrote: > On 01/01/2014 01:26 AM, Steven D'Aprano wrote: > >On Tue, Dec 31, 2013 at 03:35:55PM +0100, spir wrote: [...] > I take the opportunity to add a few features, but would do > without Source altogether if it were not for 'i'. > The reason is: it

Re: [Tutor] Shelve & immutable objects

2014-01-01 Thread Mark Lawrence
On 01/01/2014 16:43, Keith Winston wrote: Thanks Danny, I don't understand the re-persisted part, but I'll look into it. I realized I hadn't done enough homework to justify a question right after I sent the first half of that one! Happy New Year! You do infinitely more work than some who pose

Re: [Tutor] Shelve & immutable objects

2014-01-01 Thread Keith Winston
Thanks Danny, I don't understand the re-persisted part, but I'll look into it. I realized I hadn't done enough homework to justify a question right after I sent the first half of that one! Happy New Year! ___ Tutor maillist - Tutor@python.org To unsubsc

Re: [Tutor] subtyping builtin type

2014-01-01 Thread spir
On 01/01/2014 01:26 AM, Steven D'Aprano wrote: On Tue, Dec 31, 2013 at 03:35:55PM +0100, spir wrote: Hello, I don't remember exactly how to do that. As an example: class Source (str): __slots__ = ['i', 'n'] def __init__ (self, string): self.i = 0 # current m

Re: [Tutor] lists of lists: more Chutes & Ladders!

2014-01-01 Thread Mark Lawrence
On 01/01/2014 08:04, Danny Yoo wrote: My point was: `iter` the func exists in python (built-in with '-'), one may use it at times. Giving an application var this name hides, which accosionnally leads to bugs. I have been bitten by such a bug more than once in the past, and once hard to find, asp.

Re: [Tutor] lists of lists: more Chutes & Ladders!

2014-01-01 Thread Danny Yoo
> My point was: `iter` the func exists in python (built-in with '-'), one may > use it at times. Giving an application var this name hides, which > accosionnally leads to bugs. I have been bitten by such a bug more than once > in the past, and once hard to find, asp. with the built-in func `range`