list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

E9215 Python Reserved Name

A name that Python reserves or that generated code uses

The Python generator reports this error, and does not generate the class, for three kinds of name:

  • A class or interface named like a Python built-in that generated code calls, such as len, id, set or tuple: it would hide the built-in in its module and in every method that imports it.
  • A class, interface, method, event, state, constant, enumeration or enumeration value whose generated name is a Python keyword, such as lambda, async, break or None. Enumeration values are written with a capital first letter, so none becomes None.
  • A parameter named __class__, the name generated methods use for their own class.

Rename the element.

Example

// len is a Python built-in that generated code calls,
// so a class named len would hide it: E9215
generate Python;
namespace shapes;
class len {
  Double value;
}

      

Load the above code into UmpleOnline

 

Solution to The Above So the Message No Longer Appears

// Another name avoids the clash
generate Python;
namespace shapes;
class Length {
  Double value;
}

      

Load the above code into UmpleOnline