Using type as a keyword argument to a function will mask the built-in function "type" within the scope of the function. So while doing so does not raise a SyntaxError, it is not considered good practice, and I would avoid doing so.
Python
peps.python.org › pep-0695
PEP 695 – Type Parameter Syntax | peps.python.org
A type parameter declared as part of a generic class is valid within the class body and inner scopes contained therein. Type parameters are also accessible when evaluating the argument list (base classes and any keyword arguments) that comprise the class definition.
Is it safe to use the python word "type" in my code? - Stack Overflow
That is more than a decade old question and to be on the safe side, I would recommend using kind instead of type as argument. For a long time I was considering building a rename recommendation for all reserved or builins, but seeing your question made me finally do it. Please check python-keyword-... More on stackoverflow.com
Introduce type keyword for type only imports - Ideas - Discussions on Python.org
After the great work of everyone involved in PEP 810, I would like to propose a new idea that is similar and somewhat changes a bit of the PEP itself, which is the introduction of the type keyword for imports that are only used for typing reasons. This would be beneficial for people reading ... More on discuss.python.org
Use type keyword for defining NewTypes in Non-Generic types - Ideas - Discussions on Python.org
Now type aliases for Non-generic types are almost useless, like the one showed in the PEP 484 Url = str def retry(url: Url, retry_count: int) -> None: ... With the modern syntax, we would have: type Url = str def retry(url: Url, retry_count: int) -> None: ... Which won’t do anything in static ... More on discuss.python.org
Is not having to declare your variables a BAD THING?
One up his snobbiness. Throw some C code at his face and call him a hippy slob. More on reddit.com
What are Python keywords?
Keywords in Python are predefined reserved words with special meanings so the interpreter can understand them. They perform specific tasks in Python programming and are a part of its syntax.
wscubetech.com
wscubetech.com › resources › python › keywords
Keywords in Python: All Lists With Examples
How many keywords are there in Python?
The number of keywords in Python can vary based on its version. Some versions may have a few additional keywords, while others have less. We have covered 35 Python keywords in this tutorial.
wscubetech.com
wscubetech.com › resources › python › keywords
Keywords in Python: All Lists With Examples
Is None also a keyword in Python?
Yes, None is one of the keywords in Python. It represents "no value" or "nothing". You’ll often use it when you want to show a variable is empty or not set yet.
wscubetech.com
wscubetech.com › resources › python › keywords
Keywords in Python: All Lists With Examples
Videos
10:11
2. Python: Data Type and Variable, Keywords - YouTube
06:21
python's "soft" keywords (intermediate) anthony explains #546 - ...
22:58
I Didn't Know You Can Do This With the Type Keyword - YouTube
34:08
All 39 Python Keywords Explained - YouTube
01:20
Python Keywords: Don't Declare Types! #shorts - YouTube
Python documentation
docs.python.org › 3 › library › typing.html
typing — Support for type hints
1 week ago - The argument list must be a list of types, a ParamSpec, Concatenate, or an ellipsis (...). The return type must be a single type. If a literal ellipsis ... is given as the argument list, it indicates that a callable with any arbitrary parameter list would be acceptable: def concat(x: str, y: str) -> str: return x + y x: Callable[..., str] x = str # OK x = concat # Also OK · Callable cannot express complex signatures such as functions that take a variadic number of arguments, overloaded functions, or functions that have keyword-only parameters.
Top answer 1 of 7
79
Using type as a keyword argument to a function will mask the built-in function "type" within the scope of the function. So while doing so does not raise a SyntaxError, it is not considered good practice, and I would avoid doing so.
2 of 7
16
Neither. It's not a reserved word (a list of which can be found at http://docs.python.org/reference/lexical_analysis.html#keywords ), but it's generally a bad idea to shadow any builtin.
GeeksforGeeks
geeksforgeeks.org › python › python-type-function
type() function in Python - GeeksforGeeks
The type() function in Python tells what kind of data an object is or creates a new class dynamically.
Published January 14, 2026
W3Schools
w3schools.com › python › ref_func_type.asp
Python type() 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 ... a = ('apple', 'banana', 'cherry') b = "Hello World" c = 33 x = type(a) y = type(b) z = type(c) Try it Yourself »
Python
docs.python.org › 3 › library › types.html
types — Dynamic type creation and names for built-in types
1 week ago - When initialized with keyword arguments, those are directly added to the underlying namespace. Alternatively, when initialized with a positional argument, the underlying namespace will be updated with key-value pairs from that argument (either a mapping object or an iterable object producing key-value pairs). All such keys must be strings. The type is roughly equivalent to the following code:
Python.org
discuss.python.org › ideas
Introduce type keyword for type only imports - Ideas - Discussions on Python.org
October 4, 2025 - After the great work of everyone involved in PEP 810, I would like to propose a new idea that is similar and somewhat changes a bit of the PEP itself, which is the introduction of the type keyword for imports that are only used for typing reasons. This would be beneficial for people reading the code to understand that the import is only there for type checking reasons, and it will not ever be evaluated, similar to lazy imports proposed in PEP 810, but the code won’t ever need to do the reificat...
WsCube Tech
wscubetech.com › resources › python › keywords
Keywords in Python: All Lists With Examples
3 weeks ago - Explore all Python keywords in our comprehensive list with examples. Learn how to use each keyword effectively in your Python programming.
FastAPI
fastapi.tiangolo.com › python-types
Python Types Intro - FastAPI
Then you can declare a variable to be of type Person: ... class Person: def __init__(self, name: str): self.name = name def get_person_name(one_person: Person): return one_person.name ... Notice that this means "one_person is an instance of the class Person". It doesn't mean "one_person is the class called Person". Pydantic is a Python library to perform data validation.
Python.org
discuss.python.org › ideas
Use type keyword for defining NewTypes in Non-Generic types - Ideas - Discussions on Python.org
February 7, 2024 - Now type aliases for Non-generic types are almost useless, like the one showed in the PEP 484 Url = str def retry(url: Url, retry_count: int) -> None: ... With the modern syntax, we would have: type Url = str def retry(url: Url, retry_count: int) -> None: ... Which won’t do anything in static analysis: test: str = 'not_an_url' test1 = retry(test) # Doesn't give a static warning test = 'not_an_url' test2 = retry(test) # Doesn't give a warning, but may be nice based on --strict test: Url ...
Real Python
realpython.com › python-keywords
Python Keywords: An Introduction – Real Python
February 12, 2025 - The built-in functions and types are also always available, but they aren’t as restrictive as the keywords in their usage. An example of something you can’t do with Python keywords is assign something to them. If you try, then you’ll get a SyntaxError. You won’t get a SyntaxError if ...
Toppr
toppr.com › guides › python-guide › references › methods-and-functions › methods › built-in › type › python-type
Python type() function | What is a type() function in Python? |
July 14, 2021 - Python type() is a built-in function that returns the type of the data elements stored in any data type or returns a new type object depending on the arguments passed to the function. The Python type() function prints what type of data structures are used to store the data elements in a program.
YouTube
youtube.com › watch
Python Keywords an Introduction - YouTube
Every programming language has special reserved words, or keywords, that have specific meanings and restrictions around how they should be used. Python is no...
Published April 14, 2022
Python
peps.python.org › pep-0484
PEP 484 – Type Hints | peps.python.org
It is possible to declare the return type of a callable without specifying the call signature by substituting a literal ellipsis (three dots) for the list of arguments: def partial(func: Callable[..., str], *args) -> Callable[..., str]: # Body · Note that there are no square brackets around the ellipsis. The arguments of the callback are completely unconstrained in this case (and keyword ...
DigitalOcean
digitalocean.com › community › tutorials › python-type
Python type() Function Explained | DigitalOcean
June 6, 2025 - You can also use type(name, bases, dict) to dynamically create new custom classes, specify their base classes (which can also be other custom classes), and define their attributes and methods. Python’s type() function is an important tool for understanding the precise nature of objects and for advanced scenarios involving the dynamic construction of classes.