From: Bruce S. <Bru...@nc...> - 2009-05-10 21:19:14
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Guy K. Kloss wrote: <blockquote cite="mid:200...@ma..." type="cite"> <pre wrap="">On Mon, 11 May 2009 03:25:28 Bruce Sherwood wrote: </pre> <blockquote type="cite"> <pre wrap=""> if obj.__class__ is distant_light: </pre> </blockquote> <pre wrap=""><!----> Shouldn't that be rather if isinstance(obj, distant_light): to make it more Pythonic? </pre> </blockquote> Good point. I've made that change and posted the program in the contributed section of vpython.org. And I'll change the documentation for Visual accordingly.<br> <blockquote cite="mid:200...@ma..." type="cite"> <pre wrap=""> On that same topic of "Pythonicness" of the Visual API. I've noticed, that the classes don't really follow the common PEP-8 guide lines. They rather use the notation of attributes than classes (lower case and joined with underscores, rather than CamelCase). That confuses often when conditioned to Python naming schemes to infer types of labels in code. Guy </pre> </blockquote> It's likely that when David Scherer created Visual in 2000 these conventions were not well established. For internal consistency we can't really change now.<br> <br> Bruce Sherwood<br> </body> </html> |