px.defaults too permissive
`px.defaults.whatever = "whatever"` should raise an exception: only the specific keys in the object should be settable.
diff --git a/packages/python/plotly/plotly/express/_core.py b/packages/python/plotly/plotly/express/_core.py
index db8f002c2..1f9e2706a 100644
--- a/packages/python/plotly/plotly/express/_core.py
+++ b/packages/python/plotly/plotly/express/_core.py
@@ -16,6 +16,17 @@ from plotly.subplots import (
 
 
 class PxDefaults(object):
+    __slots__ = [
+        "template",
+        "width",
+        "height",
+        "color_discrete_sequence",
+        "color_continuous_scale",
+        "symbol_sequence",
+        "line_dash_sequence",
+        "size_max",
+    ]
+
     def __init__(self):
         self.template = None
         self.width = None
diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py b/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py
index 9ace6a7b4..b4880899e 100644
--- a/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py
+++ b/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py
@@ -1,5 +1,6 @@
 import plotly.express as px
 import numpy as np
+import pytest
 
 
 def test_scatter():
@@ -232,3 +233,9 @@ def test_orthogonal_orderings():
     for days in permutations(df["day"].unique()):
         for times in permutations(df["time"].unique()):
             assert_orderings(days, days, times, times)
+
+
+def test_permissive_defaults():
+    msg = "'PxDefaults' object has no attribute 'should_not_work'"
+    with pytest.raises(AttributeError, match=msg):
+        px.defaults.should_not_work = "test"
['packages/python/plotly/plotly/tests/test_core/test_px/test_px.py', 'packages/python/plotly/plotly/express/_core.py']