简体   繁体   中英

What's the correct name for a Python Extension-thingy?

Is it:

  • Extension class
  • Extension type
  • Extension object

?

Could somebody disambiguate?

I'm asking because I have the following object structure in my C++ code, and I'm trying to figure out whether I should revise the names before I release my code:

class ExtObjBase_noTemplate : public PyObject


template< typename FinalClass >
class ExtObjBase : public FuncMapper<FinalClass> , public ExtObjBase_noTemplate


// - - - - - - - 

template<typename FinalClass>
class ExtObj_old : public ExtObjBase<FinalClass>

template<typename FinalClass>
class ExtObj_new : public ExtObjBase<FinalClass>


//= = = = = = = = = = = 
//CONSUMER does:

class new_style_class: public ExtObj_new< new_style_class >

class old_style_class: public ExtObj_old< old_style_class >

Extension class , Extension type :

These are synonyms, if we ignore classic (old-style) classes. They refer to classes or types created in extension modules.

Sometimes, we do care about classic classes. New-style classes are types. Classic classes are not types. I don't recommend working with classic classes in new code. They have been removed in Python 3.

Extension object

I've not heard this term before, but I would assume it refers to an instance of an extension class/type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM