Yes, in Python 3.3 SimpleNamespace was added

Unlike object, with SimpleNamespace you can add and remove attributes. If a SimpleNamespace object is initialized with keyword arguments, those are directly added to the underlying namespace.

Example:

import types

x = types.SimpleNamespace()
x.happy = True

print(x.happy) # True

del x.happy
print(x.happy) # AttributeError. object has no attribute 'happy'
Answer from Vlad Bezden on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_object.asp
Python object() Function
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... The object() function returns an empty object.
Discussions

Accessing newly added empty object
Blender Artists is an online creative forum that is dedicated to the growth and education of the 3D software Blender. More on blenderartists.org
๐ŸŒ blenderartists.org
1
0
September 7, 2022
[Python] What's a empty object and user-defined method objects?
Myclass.func is a function, but you can't call it. Try it: Myclass.func() # TypeError Why not? Because a class's functions must be called in the context of some particular instance of the class. Why? Well, here's an example: class Animal: def __init__(self, sound): self.sound = sound def speak(self): print('%s', self.sound) dog = Animal('woof') cat = Animal('meow') speakFunction = Animal.speak speakFunction() What is that last line supposed to do? Does it woof? Does it meow? We don't know. We didn't specify which instance of Animal we wanted to invoke. Put another way, that method isn't bound to any particular instance of Animal. But what does THIS do? speakFunction = dog.speak speakFunction() That one works! Why? Because we specified that we wanted the one that says 'woof.' We could also do it this way: speakFunction = Animal.speak speakFunction(dog) Okay, now to answer your questions explicitly. An "empty object" is a newly-created instance in a class that doesn't do any initialization. It has no custom fields set to any values beyond what any Python class instance would have. It's empty in the non-technical, English sense of the word. A user-defined function is what it says on the tin. It's a function, defined by some Python code. Example: def foo(): print("I'm a user-defined function!") Its name is only relevant when comparing it to other, more complicated types of things that can be called in Python, like instance methods, generators, built-ins, classes, and more. More on reddit.com
๐ŸŒ r/learnprogramming
4
2
January 22, 2019
What is an empty object?
This is generally a bad idea. If the parameters are invalid, you cannot make a valid object, so this empty object represents something that shouldn't exist It's better to throw an exception in such cases More on reddit.com
๐ŸŒ r/learnprogramming
10
2
January 18, 2023
scripting - How to add empty object not using bpy.ops? - Blender Stack Exchange
How to add an empty object with python using bpy and not using any ops? More on blender.stackexchange.com
๐ŸŒ blender.stackexchange.com
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-create-an-empty-class-in-python
How to create an empty class in Python? - GeeksforGeeks
July 12, 2025 - # Python program to demonstrate # empty class class Employee: pass # Driver's code # Object 1 details obj1 = Employee() obj1.name = 'Nikhil' obj1.office = 'GeeksforGeeks' # Object 2 details obj2 = Employee() obj2.name = 'Abhinav' obj2.office = 'GeeksforGeeks' obj2.phone = 1234567889 # Printing details print("obj1 Details:") print("Name:", obj1.name) print("Office:", obj1.office) print() print("obj2 Details:") print("Name:", obj2.name) print("Office:", obj2.office) print("Phone:", obj2.phone) # Uncommenting this print("Phone:", obj1.phone) # will raise an AttributeError
๐ŸŒ
Reddit
reddit.com โ€บ r/learnprogramming โ€บ [python] what's a empty object and user-defined method objects?
r/learnprogramming on Reddit: [Python] What's a empty object and user-defined method objects?
January 22, 2019 -

https://docs.python.org/3/tutorial/classes.html#class-objects

They say calling a class object creates a empty object, what's that?

https://docs.python.org/3/reference/datamodel.html

Under Callables, under Instance Methods

They were talking about user-defined methods objects are created if I get a attribute from a class (or instance of it) that's a user defined function or class method object.

But isn't MyClass.func a function and not a method

class Myclass:

  def func(self): pass

print(Myclass.func) # function

print(Myclass().func) #bounded method

So what's a user defined method object?

Top answer
1 of 2
3
Myclass.func is a function, but you can't call it. Try it: Myclass.func() # TypeError Why not? Because a class's functions must be called in the context of some particular instance of the class. Why? Well, here's an example: class Animal: def __init__(self, sound): self.sound = sound def speak(self): print('%s', self.sound) dog = Animal('woof') cat = Animal('meow') speakFunction = Animal.speak speakFunction() What is that last line supposed to do? Does it woof? Does it meow? We don't know. We didn't specify which instance of Animal we wanted to invoke. Put another way, that method isn't bound to any particular instance of Animal. But what does THIS do? speakFunction = dog.speak speakFunction() That one works! Why? Because we specified that we wanted the one that says 'woof.' We could also do it this way: speakFunction = Animal.speak speakFunction(dog) Okay, now to answer your questions explicitly. An "empty object" is a newly-created instance in a class that doesn't do any initialization. It has no custom fields set to any values beyond what any Python class instance would have. It's empty in the non-technical, English sense of the word. A user-defined function is what it says on the tin. It's a function, defined by some Python code. Example: def foo(): print("I'm a user-defined function!") Its name is only relevant when comparing it to other, more complicated types of things that can be called in Python, like instance methods, generators, built-ins, classes, and more.
2 of 2
2
They say calling a class object creates a empty object, what's that? They are just saying that unless you define an init method to set the initial value of class variables, they will not have values assigned and thus is an "empty" object.
๐ŸŒ
Medium
pavolkutaj.medium.com โ€บ how-to-check-if-a-list-dict-or-set-is-empty-in-python-as-per-pep8-35d8c64d07d0
How to Check if a List, Dict or Set is Empty in Python as per PEP8 | by Pavol Z. Kutaj | Medium
September 7, 2023 - Following Built-in Types โ€” Python 3.9.7 documentation you check 4 things when you write ยท if <object>: Null ยท Empty ยท False ยท Zero (0) if it is a collection, it is mainly for emptiness, though ยท l = [0] of course passes the test and is different from l=[] #Yes: if not seq: if seq: #No: if len(seq): if not len(seq): โ€” from PEP8 ยท
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-create-an-empty-class-in-python
How to create an empty class in Python?
September 15, 2022 - class Student: pass # Creating objects st1 = Student() st1.name = 'Henry' st1.age = 17 st1.marks = 90 st2 = Student() st2.name = 'Clark' st2.age = 16 st2.marks = 77 st2.phone = '120-6756-79' print('Student 1 = ', st1.name, st1.age, st1.marks) print('Student 2 = ', st2.name, st2.age, st2.marks, st2.phone) Student 1 = Henry 17 90 Student 2 = Clark 16 77 120-6756-79 ยท Using the pass statement, we can also create empty functions and loops.
Find elsewhere
๐ŸŒ
Adiyat Mubarak
adiyatmubarak.wordpress.com โ€บ 2017 โ€บ 03 โ€บ 06 โ€บ create-empty-object-in-python
Create Empty Object in Python โ€“ Adiyat Mubarak
March 6, 2017 - I need to create dummy object in python for testing purpose. Here is how to create dummy object in python on the fly using "type". Reference: http://stackoverflow.com/a/19476841/1936697
๐ŸŒ
Readthedocs
jfine-python-classes.readthedocs.io โ€บ en โ€บ latest โ€บ construct.html
Constructing classes โ€” Objects and classes in Python tutorial
The dictionary holds the attributes of the object. ... Even though our class is empty, its dictionary (or more exactly dictproxy) is not.
๐ŸŒ
Built In
builtin.com โ€บ software-engineering-perspectives โ€บ define-empty-variables-python
How to Define Empty Variables and Data Structures in Python | Built In
An empty variable in Python is a variable with no assigned value, often used as a placeholder in the code for a missing value. Empty variables can be defined using the None keyword (like a = None) or by leaving syntax as empty (like a_list = []).
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ pass a list of empty objects to be initialized?
r/learnpython on Reddit: Pass a list of empty objects to be initialized?
February 16, 2021 -

I've spent a long time searching on how to do this and can't seem to crack it.

I have a series of objects that inherit from a parent object. The main differences between the subclasses of the parent are different model types for an ML project.

I have a couple of datasets I'd like to pass to init and run each of the models, for example, something like:

class Dtree(Supervised_Learning): 
      
      def __init__(self, features, labels): 
             super().__init__(features, labels)
             #other model init from sklearn here 


Models = [Dtree(), KNN(), Boosting(), SVM()]

def run_model(model, features, labels)

     mdl = model(features, labels)

     mdl.train()

     mdl.plot()

for model in Models:

     run_model(model)

I've tried just passing the name with out the () and then calling the class().__init___() methods with the features and labels vars, but I can't figure out how to pass the variable for self.

Anyway to do this? Or do I need to just code a function that explicitly inits all of the model objects?

Top answer
1 of 2
4

Update for 2.8 +

import bpy

for obj in bpy.context.selected_objects:  # Loop over all selected objects
    empty = bpy.data.objects.new(obj.name + "_Empty", None)  # Create new empty object
    obj.users_collection[0].objects.link(empty)  # Link empty to the current object's collection
    empty.empty_display_type = 'PLAIN_AXES'
    empty.parent = obj

If you want the empties to be the parents :

import bpy

for obj in bpy.context.selected_objects:  # Loop over all selected objects
    empty = bpy.data.objects.new(obj.name + "_Empty", None)  # Create new empty object
    obj.users_collection[0].objects.link(empty)  # Link empty to the current object's collection
    empty.empty_display_type = 'PLAIN_AXES'
    empty.location = obj.location
    obj.parent = empty
    obj.location = (0, 0, 0)
2 of 2
2

bpy.ops.object.empty_add()

You can call bpy.ops.object.empty_add() operator per object and pass the location, rotation and scale for each object as well:

Blender 2.8+

import bpy

for obj in bpy.context.selected_objects:
    # Create the empty using the operator
    bpy.ops.object.empty_add(type='PLAIN_AXES', location=obj.location)
    # Get the newly created empty
    empty = bpy.context.view_layer.objects.active
    # Set the size
    empty.empty_display_size = 20
    # Parent the object to the empty
    obj.parent = empty

Blender 2.7x

import bpy

selected_objs = bpy.context.selected_objects
for obj in selected_objs:
    # Create the empty using the operator
    bpy.ops.object.empty_add(type='PLAIN_AXES', location=obj.location)
    # Get the newly created empty
    empty = bpy.context.scene.objects.active
    # Parent the object to the empty
    obj.parent = empty

I think it's quite straightforward, tell me if you have problems

๐ŸŒ
TutorialBrain
tutorialbrain.com โ€บ home โ€บ python create object
Python Create Object โ€” TutorialBrain
July 9, 2025 - Creating empty objects in Python is easy. Define an empty class and then create an object of that class.
๐ŸŒ
Blender Developer Forum
devtalk.blender.org โ€บ archive โ€บ python api
Custom Empty Object - Python API - Developer Forum
November 25, 2021 - Hi all, I wonder if is possible to customize/write a new empty object Possibly I would like to be able to draw a Cylinder in the viewport and update is width and height in the viewport Something like the CylinderGizmoโ€ฆ
๐ŸŒ
Quora
quora.com โ€บ Why-would-you-want-to-have-an-empty-class-in-Python
Why would you want to have an empty class in Python? - Quora
Answer (1 of 2): The most common case is for defining your own custom exceptions. Those are normally empty classes inheriting from the most appropriate existing exception in the hierarchy.
๐ŸŒ
Python.org
discuss.python.org โ€บ typing
Empty immutable collections types - Typing - Discussions on Python.org
December 29, 2023 - Hello, I published a package on PyPI: with source code on GitHub: It extends common collection types with immutable empty instances. Iโ€™m thinking it may be a good idea to have a type system that allows to declare wโ€ฆ