
As u can see in rev. #30543 I commited a series of methods to complete the mmap module. Those are the special methods (__xyz__) implemented as regular ones. I thought it was best to have the functionality in anyway. When and if we'll have that support it will be only a matter of change methods names to gain compatibility with CPython's code. If you disagree with me let me know, I'll comment out the code or whatever. -- Lawrence http://www.oluyede.org/blog

Hi Lawrence, On Tue, Jul 25, 2006 at 08:51:09PM +0200, Lawrence Oluyede wrote:
That's fine. Note also that you can use special method *names* in RPython code, you just have to call them explicitly. So for example it's ok to have code like: class W_X: def __len__(self): return 42 def get_len(self, space): return space.wrap(self.__len__()) Or even: class PurePythonBase: def __len__(self): return 42 class W_X(PurePythonBase): def get_len(self, space): return space.wrap(self.__len__()) A bientot, Armin

That's fine. Note also that you can use special method *names* in RPython code, you just have to call them explicitly.
Is it some sort of coding style rule? I think is ok but sounds like a duplication of code to me now... -- Lawrence http://www.oluyede.org/blog

Hi Lawrence, On Thu, Jul 27, 2006 at 11:20:02AM +0200, Lawrence Oluyede wrote:
Well, as long as we have to write the space wrappers by hand, but would also like the "pure" method to be available, there is going to be this kind of duplication :-( At some point, the unwrap_spec could be enhanced to cover much more automatic wrapping and unwrapping; then we'll be able to use the "pure" method directly, as in: class X: def __len__(self): return 42 __len__.unwrap_spec = ['self'], 'returns an int' # or whatever and directly point to the __len__ method in the TypeDef, getting rid of all explicit references to 'space' in the simple methods. A bientot, Armin.

Hi Lawrence, On Tue, Jul 25, 2006 at 08:51:09PM +0200, Lawrence Oluyede wrote:
That's fine. Note also that you can use special method *names* in RPython code, you just have to call them explicitly. So for example it's ok to have code like: class W_X: def __len__(self): return 42 def get_len(self, space): return space.wrap(self.__len__()) Or even: class PurePythonBase: def __len__(self): return 42 class W_X(PurePythonBase): def get_len(self, space): return space.wrap(self.__len__()) A bientot, Armin

That's fine. Note also that you can use special method *names* in RPython code, you just have to call them explicitly.
Is it some sort of coding style rule? I think is ok but sounds like a duplication of code to me now... -- Lawrence http://www.oluyede.org/blog

Hi Lawrence, On Thu, Jul 27, 2006 at 11:20:02AM +0200, Lawrence Oluyede wrote:
Well, as long as we have to write the space wrappers by hand, but would also like the "pure" method to be available, there is going to be this kind of duplication :-( At some point, the unwrap_spec could be enhanced to cover much more automatic wrapping and unwrapping; then we'll be able to use the "pure" method directly, as in: class X: def __len__(self): return 42 __len__.unwrap_spec = ['self'], 'returns an int' # or whatever and directly point to the __len__ method in the TypeDef, getting rid of all explicit references to 'space' in the simple methods. A bientot, Armin.
participants (2)
-
Armin Rigo
-
Lawrence Oluyede