-
Notifications
You must be signed in to change notification settings - Fork 4.5k
consider renaming the "id" parameter for constructs (reserved word in Python) #3203
Description
Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.
-
I'm submitting a ...
- 🪲 bug report
- 🚀 feature request
- 📚 construct library gap
- ☎️ security issue or vulnerability => Please see policy
- ❓ support request => Please see note at the top of this template.
-
What is the current behavior?
To create a newConstruct(or any otherResource) using CDK, the constructor in Python has the following syntax:
class aws_cdk.core.Construct(scope, id)
The id parameter serves as a unique id for CloudFormation. Naming a parameter id in Python is not really good practice, since id() is a built-in function in the Python standard library, which represents the address of the object in memory in CPython. (see https://docs.python.org/3/library/functions.html#id)
I think this could lead to potentials errors down the line for users that use the Python variant of CDK, since the id parameter could clash with the id() function.
-
What is the expected behavior (or behavior of feature suggested)?
If possible, renaming theidparameter to something likeidentifierorcdk_idwould avoid having this parameter clash with the built-inid()function. -
What is the motivation / use case for changing the behavior or adding this feature?
Clashes with Python standard library built-in functions. -
Please tell us about your environment:
- CDK CLI Version: 0.36.2
- Module Version: 0.36.2.0
- OS: [all]
- Language: [Python ]
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)