Re: [pygccxml-development] Additional attribute functionality
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2007-12-05 06:51:52
|
On Dec 4, 2007 11:33 PM, Ben Schleimer <bsc...@lu...> wrote: > Um, ok I finally saw this page. having a link to it inside the > documentation would be useful.. > I think that the use of exceptions in this context is overkill, > considering that exceptions should only be used in "exceptional" cases. > I think that java suffered from the same problem of overuse of exceptions. > > However, I think I'll stick to mem_fun*s(..., allow_empty=true) for now. > It makes more sense... > In this case it make more sense to set allow_empty to be always true by scopedef_t. ALLOW_EMPTY_MDECL_WRAPPER = True so you will not be forced to pass the argument every call > > Cheers > Ben > > PS. I don't understand how we are avoiding a loop by writing > > for decl in class_.decls(): > > wouldn't this be the same if decls() returned a list? > And then the benefit of a list would be it's standard operations... > It is hard to come with good example for pygccxml only classes, partly because declaration classes doesn't contain functionality, but only data. For Py++ it is very easy, for example update some property for all selected declarations: decls = class_.decls( some condition ) decls.xxx = yyy Or even class_.decls( some condition ).xxx = yyy it is much shorter than [ d.xxx = yyy for d in class_.decls( some condition ) ) But may be you are right. I will think about this point. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |