Re: [sage-devel] Re: plateform specific implantation

2016-01-16 Thread Florent Hivert
> Oops, I misread your code. I'm not used to seeing python code in a class > definition other than defining methods. Sorry. However that clarifies why > you are putting it into a class. Actually, it would have been the same outside a class, with the enclosing module playing the role of the class

Re: [sage-devel] Re: plateform specific implantation

2016-01-16 Thread Travis Scrimshaw
On Saturday, January 16, 2016 at 1:08:08 AM UTC-8, fhivert wrote: > > On Fri, Jan 15, 2016 at 03:36:23PM -0800, Travis Scrimshaw wrote: > > In the interest of speed, to avoid calls to `sys,platform`, I would make > > foo a (module level) @lazy_attribute or @cached_function. IMO a full > class

Re: [sage-devel] Re: plateform specific implantation

2016-01-16 Thread Florent Hivert
On Sat, Jan 16, 2016 at 05:55:01AM -0800, Dima Pasechnik wrote: > IMHO this is still far from the best way of doing such things - namely, > wrap whatever platform-specific you must do with semaphores in a special > class, so that the code where they are used does not do any > platform-specific th

Re: [sage-devel] Re: plateform specific implantation

2016-01-16 Thread Dima Pasechnik
IMHO this is still far from the best way of doing such things - namely, wrap whatever platform-specific you must do with semaphores in a special class, so that the code where they are used does not do any platform-specific things at all. Otherwise platform-specific code would proliferate like ver

Re: [sage-devel] Re: plateform specific implantation

2016-01-16 Thread Florent Hivert
On Fri, Jan 15, 2016 at 03:36:23PM -0800, Travis Scrimshaw wrote: > In the interest of speed, to avoid calls to `sys,platform`, I would make > foo a (module level) @lazy_attribute or @cached_function. IMO a full class > is a lot more than you need. First of all, in my usecase, those are only two

[sage-devel] Re: plateform specific implantation

2016-01-15 Thread Nils Bruin
On Friday, January 15, 2016 at 3:36:24 PM UTC-8, Travis Scrimshaw wrote: > > In the interest of speed, to avoid calls to `sys,platform`, I would make > foo a (module level) @lazy_attribute or @cached_function. IMO a full class > is a lot more than you need. > > According to https://docs.python.or

[sage-devel] Re: plateform specific implantation

2016-01-15 Thread Travis Scrimshaw
In the interest of speed, to avoid calls to `sys,platform`, I would make foo a (module level) @lazy_attribute or @cached_function. IMO a full class is a lot more than you need. Best, Travis On Friday, January 15, 2016 at 8:49:40 AM UTC-8, Volker Braun wrote: > > THats fine (except that you sho

[sage-devel] Re: plateform specific implantation

2016-01-15 Thread Volker Braun
THats fine (except that you should use new-style classes) On Friday, January 15, 2016 at 5:34:35 PM UTC+1, fhivert wrote: > > Dear all, > > I'd like to have a class with a method with some implementation internal > that > differ if the os is MacOS of anything else. > > Context > ===