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 vermin...
 

On Saturday, 16 January 2016 09:08:08 UTC, 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 
> > is a lot more than you need. 
>
> First of all, in my usecase, those are only two small methods in a large 
> class. Then, if you look carefully at my code, you'll see that the call to 
> sys.platform is only evaluated once: when the file is read. So I don't see 
> the 
> benefit of using a lazy attribute or a cached function, except in the very 
> unlikely scenario of the user reading the file and not using it. This is 
> indeed very unlikely if the class is lazy imported. And even in this case, 
> the 
> overhead should be very small. 
>
> Cheers, 
>
> Florent 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to