title: How to create self registering factory in Python?
body: <p>In C++ or other compile/link based OOP languages, it is relatively easy to implement self-registering factory. Is it possible to do it in Python?</p>
  
  <p>For example, I have a base method class: Vehicle @ <code>vehicle.py</code>, which is abstract. I will have a factory for vehicles @ <code>vehicle_factory.py</code>. I will have other concrete vehicles: Class Car(Vehicle) @ <code>car.py</code>, Class Truck(Vehicle) @ <code>truck.py</code>, etc.</p>
  
  <p>I wish I do not have to touch <code>vehicle_factory.py</code> to register all these concrete vehicles. Every time I create a new vehicle class (such as Bus), I only need to work on its own module <code>bus.py</code> using self-registration. Can this be implemented in Python?</p>