[I18n-sig] Re: Printing objects on files

Peter Funk pf@artcom-gmbh.de
Wed, 3 May 2000 12:27:51 +0200 (MEST)


Hi!

Ka-Ping Yee:
> Okay, i lied.  Shortly after writing this i realized that it
> is probably advisable for all such bits of state to be stored
> in stacks, so an interface such as this might do:
> 
>     def push(self, key, value):
[...]
>     def pop(self, key):
[...]

I like the idea of having an encoding attribute in file objects.
May this can be prototyped in an 'UserFile' class similar to 
'UserList', 'UserDict'?  Since file objects have methods I 
wondered long time ago, why there is no 'UserFile' class.
But that's off-topic for the i18n-sig.  

But I still don't see the advantage of having a stack builtin.
Especially in Python this gives us only a very minor adavantage over
the following pattern:

	previous_state = object.get_state()
	object.set_state(some_value)
	...do something with object requiring it to be in state 'some_value'...
	# restore state:
	object.set_state(previous_state)


Regards, Peter