diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/CPythonBackedPythonInterpreter.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/CPythonBackedPythonInterpreter.java index 5d7b6ae7..db010127 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/CPythonBackedPythonInterpreter.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/CPythonBackedPythonInterpreter.java @@ -113,7 +113,7 @@ public static void updateJavaObjectFromPythonObject(PythonLikeObject javaObject, OpaquePythonReference pythonObject, Map instanceMap) { Map dict = getPythonReferenceDict(pythonObject, instanceMap); - dict.forEach(javaObject::__setAttribute); + dict.forEach(javaObject::$setAttribute); } public static PythonLikeObject callPythonReference(OpaquePythonReference object, List positionalArguments, diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonClassTranslator.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonClassTranslator.java index d11d4ed1..da3052e6 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonClassTranslator.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonClassTranslator.java @@ -144,7 +144,7 @@ public static PythonLikeType translatePythonClass(PythonCompiledClass pythonComp classWriter.visit(Opcodes.V11, Modifier.PUBLIC, internalClassName, null, superClassType.getJavaTypeInternalName(), interfaces); - pythonCompiledClass.staticAttributeNameToObject.forEach(pythonLikeType::__setAttribute); + pythonCompiledClass.staticAttributeNameToObject.forEach(pythonLikeType::$setAttribute); classWriter.visitField(Modifier.PUBLIC | Modifier.STATIC, TYPE_FIELD_NAME, Type.getDescriptor(PythonLikeType.class), null, null); @@ -154,7 +154,7 @@ public static PythonLikeType translatePythonClass(PythonCompiledClass pythonComp for (Map.Entry staticAttributeEntry : pythonCompiledClass.staticAttributeNameToObject .entrySet()) { - pythonLikeType.__setAttribute(staticAttributeEntry.getKey(), staticAttributeEntry.getValue()); + pythonLikeType.$setAttribute(staticAttributeEntry.getKey(), staticAttributeEntry.getValue()); } Map attributeNameToTypeMap = new HashMap<>(); @@ -259,17 +259,17 @@ public static PythonLikeType translatePythonClass(PythonCompiledClass pythonComp PythonBytecodeToJavaBytecodeTranslator.writeClassOutput(BuiltinTypes.classNameToBytecode, className, classWriter.toByteArray()); - pythonLikeType.__setAttribute("__name__", PythonString.valueOf(pythonCompiledClass.className)); - pythonLikeType.__setAttribute("__qualname__", PythonString.valueOf(pythonCompiledClass.qualifiedName)); - pythonLikeType.__setAttribute("__module__", PythonString.valueOf(pythonCompiledClass.module)); + pythonLikeType.$setAttribute("__name__", PythonString.valueOf(pythonCompiledClass.className)); + pythonLikeType.$setAttribute("__qualname__", PythonString.valueOf(pythonCompiledClass.qualifiedName)); + pythonLikeType.$setAttribute("__module__", PythonString.valueOf(pythonCompiledClass.module)); PythonLikeDict annotations = new PythonLikeDict(); pythonCompiledClass.typeAnnotations.forEach((name, type) -> annotations.put(PythonString.valueOf(name), type)); - pythonLikeType.__setAttribute("__annotations__", annotations); + pythonLikeType.$setAttribute("__annotations__", annotations); PythonLikeTuple mro = new PythonLikeTuple(); mro.addAll(superTypeList); - pythonLikeType.__setAttribute("__mro__", mro); + pythonLikeType.$setAttribute("__mro__", mro); Class generatedClass; try { @@ -339,7 +339,7 @@ public static void setSelfStaticInstances(PythonCompiledClass pythonCompiledClas objectInstance.$setCPythonId(PythonInteger.valueOf(pythonReferenceId.longValue())); objectInstance.$setInstanceMap(instanceMap); objectInstance.$readFieldsFromCPythonReference(); - pythonLikeType.__setAttribute(attributeName, objectInstance); + pythonLikeType.$setAttribute(attributeName, objectInstance); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new RuntimeException("Unable to construct instance of class (" + generatedClass + ")", e); } @@ -442,7 +442,7 @@ private static Class createBytecodeForMethodAndSetOnClass(String className, P generatedClass.getField(getJavaMethodName(methodEntry.getKey())) .set(null, functionInstance); - pythonLikeType.__setAttribute(methodEntry.getKey(), translatedPythonMethodWrapper); + pythonLikeType.$setAttribute(methodEntry.getKey(), translatedPythonMethodWrapper); return functionClass; } catch (IllegalAccessException | NoSuchFieldException e) { throw new IllegalStateException("Impossible State: could not access method (" + methodEntry.getKey() @@ -508,7 +508,7 @@ private static Class createPythonWrapperMethod(String methodName, PythonCompi Type.getDescriptor(PythonLikeType.class)); methodVisitor.visitLdcInsn(methodName); methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class), - "__getAttributeOrError", + "$getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class), Type.getType(String.class)), true); methodVisitor.visitTypeInsn(Opcodes.CHECKCAST, Type.getInternalName(PythonLikeFunction.class)); @@ -805,7 +805,7 @@ public static Type getVirtualFunctionReturnType(PythonCompiledFunction function) public static void createGetAttribute(ClassWriter classWriter, String classInternalName, String superInternalName, Collection instanceAttributes, Map fieldToType) { - MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "__getAttributeOrNull", + MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class), Type.getType(String.class)), null, null); @@ -823,7 +823,7 @@ public static void createGetAttribute(ClassWriter classWriter, String classInter }, () -> { methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); methodVisitor.visitVarInsn(Opcodes.ALOAD, 1); - methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superInternalName, "__getAttributeOrNull", + methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superInternalName, "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class), Type.getType(String.class)), false); @@ -837,7 +837,7 @@ public static void createGetAttribute(ClassWriter classWriter, String classInter public static void createSetAttribute(ClassWriter classWriter, String classInternalName, String superInternalName, Collection instanceAttributes, Map fieldToType) { - MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "__setAttribute", + MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "$setAttribute", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(String.class), Type.getType(PythonLikeObject.class)), @@ -860,7 +860,7 @@ public static void createSetAttribute(ClassWriter classWriter, String classInter methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); methodVisitor.visitVarInsn(Opcodes.ALOAD, 1); methodVisitor.visitVarInsn(Opcodes.ALOAD, 2); - methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superInternalName, "__setAttribute", + methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superInternalName, "$setAttribute", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(String.class), Type.getType(PythonLikeObject.class)), @@ -875,7 +875,7 @@ public static void createSetAttribute(ClassWriter classWriter, String classInter public static void createDeleteAttribute(ClassWriter classWriter, String classInternalName, String superInternalName, Collection instanceAttributes, Map fieldToType) { - MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "__deleteAttribute", + MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "$deleteAttribute", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(String.class)), null, null); @@ -894,7 +894,7 @@ public static void createDeleteAttribute(ClassWriter classWriter, String classIn }, () -> { methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); methodVisitor.visitVarInsn(Opcodes.ALOAD, 1); - methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superInternalName, "__deleteAttribute", + methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superInternalName, "$deleteAttribute", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(String.class)), false); diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonGeneratorTranslator.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonGeneratorTranslator.java index a5bb14d7..408be12f 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonGeneratorTranslator.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonGeneratorTranslator.java @@ -656,12 +656,12 @@ private static void generateAdvanceGeneratorMethodForYieldFrom(ClassWriter class methodVisitor.visitInsn(Opcodes.DUP); methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class), - "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)), + "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)), true); methodVisitor.visitLdcInsn("throw"); methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class), - "__getAttributeOrNull", + "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class), Type.getType(String.class)), true); diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonLikeObject.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonLikeObject.java index bfafca41..0391e30d 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonLikeObject.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonLikeObject.java @@ -27,7 +27,7 @@ public interface PythonLikeObject { * @return The attribute of the object that corresponds with attributeName * @throws AttributeError if the attribute does not exist */ - PythonLikeObject __getAttributeOrNull(String attributeName); + PythonLikeObject $getAttributeOrNull(String attributeName); /** * Gets an attribute by name. @@ -36,8 +36,8 @@ public interface PythonLikeObject { * @return The attribute of the object that corresponds with attributeName * @throws AttributeError if the attribute does not exist */ - default PythonLikeObject __getAttributeOrError(String attributeName) { - PythonLikeObject out = this.__getAttributeOrNull(attributeName); + default PythonLikeObject $getAttributeOrError(String attributeName) { + PythonLikeObject out = this.$getAttributeOrNull(attributeName); if (out == null) { throw new AttributeError("object '" + this + "' does not have attribute '" + attributeName + "'"); } @@ -50,52 +50,52 @@ default PythonLikeObject __getAttributeOrError(String attributeName) { * @param attributeName Name of the attribute to set * @param value Value to set the attribute to */ - void __setAttribute(String attributeName, PythonLikeObject value); + void $setAttribute(String attributeName, PythonLikeObject value); /** * Delete an attribute by name. * * @param attributeName Name of the attribute to delete */ - void __deleteAttribute(String attributeName); + void $deleteAttribute(String attributeName); /** * Returns the type describing the object * * @return the type describing the object */ - PythonLikeType __getType(); + PythonLikeType $getType(); /** - * Return a generic version of {@link PythonLikeObject#__getType()}. This is used in bytecode + * Return a generic version of {@link PythonLikeObject#$getType()}. This is used in bytecode * generation and not at runtime. For example, for a list of integers, this return * list[int], while getType returns list. Both methods are needed so type([1,2,3]) is type(['a', 'b', 'c']) * return True. * * @return the generic version of this object's type. Must not be used in identity checks. */ - default PythonLikeType __getGenericType() { - return __getType(); + default PythonLikeType $getGenericType() { + return $getType(); } default PythonLikeObject $method$__getattribute__(PythonString pythonName) { String name = pythonName.value; - PythonLikeObject objectResult = __getAttributeOrNull(name); + PythonLikeObject objectResult = $getAttributeOrNull(name); if (objectResult != null) { return objectResult; } - PythonLikeType type = __getType(); - PythonLikeObject typeResult = type.__getAttributeOrNull(name); + PythonLikeType type = $getType(); + PythonLikeObject typeResult = type.$getAttributeOrNull(name); if (typeResult != null) { - PythonLikeObject maybeDescriptor = typeResult.__getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod); + PythonLikeObject maybeDescriptor = typeResult.$getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod); if (maybeDescriptor == null) { - maybeDescriptor = typeResult.__getType().__getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod); + maybeDescriptor = typeResult.$getType().$getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod); } if (maybeDescriptor != null) { if (!(maybeDescriptor instanceof PythonLikeFunction)) { - throw new UnsupportedOperationException("'" + maybeDescriptor.__getType() + "' is not callable"); + throw new UnsupportedOperationException("'" + maybeDescriptor.$getType() + "' is not callable"); } return TernaryDunderBuiltin.GET_DESCRIPTOR.invoke(typeResult, this, type); } @@ -107,13 +107,13 @@ default PythonLikeType __getGenericType() { default PythonLikeObject $method$__setattr__(PythonString pythonName, PythonLikeObject value) { String name = pythonName.value; - __setAttribute(name, value); + $setAttribute(name, value); return PythonNone.INSTANCE; } default PythonLikeObject $method$__delattr__(PythonString pythonName) { String name = pythonName.value; - __deleteAttribute(name); + $deleteAttribute(name); return PythonNone.INSTANCE; } @@ -141,7 +141,7 @@ default PythonLikeType __getGenericType() { } else { position = String.valueOf(System.identityHashCode(this)); } - return PythonString.valueOf("<" + __getType().getTypeName() + " object at " + position + ">"); + return PythonString.valueOf("<" + $getType().getTypeName() + " object at " + position + ">"); } default PythonLikeObject $method$__format__() { @@ -153,6 +153,6 @@ default PythonLikeType __getGenericType() { } default PythonLikeObject $method$__hash__() { - throw new TypeError("unhashable type: '" + __getType().getTypeName() + "'"); + throw new TypeError("unhashable type: '" + $getType().getTypeName() + "'"); } } diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonOverloadImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonOverloadImplementor.java index 631a80e1..73b76cbb 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonOverloadImplementor.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/PythonOverloadImplementor.java @@ -74,7 +74,7 @@ public static void createDispatchesFor(PythonLikeType pythonLikeType) { createDispatchForMethod(pythonLikeType, methodName, pythonLikeType.getMethodType(methodName).orElseThrow(), pythonLikeType.getMethodKind(methodName) .orElse(PythonClassTranslator.PythonMethodKind.VIRTUAL_METHOD)); - pythonLikeType.__setAttribute(methodName, overloadDispatch); + pythonLikeType.$setAttribute(methodName, overloadDispatch); } if (pythonLikeType.getConstructorType().isPresent()) { @@ -82,7 +82,7 @@ public static void createDispatchesFor(PythonLikeType pythonLikeType) { createDispatchForMethod(pythonLikeType, "__init__", pythonLikeType.getConstructorType().orElseThrow(), PythonClassTranslator.PythonMethodKind.VIRTUAL_METHOD); pythonLikeType.setConstructor(overloadDispatch); - pythonLikeType.__setAttribute("__init__", overloadDispatch); + pythonLikeType.$setAttribute("__init__", overloadDispatch); } } @@ -142,7 +142,7 @@ private static PythonLikeFunction createDispatchForMethod(PythonLikeType pythonL } private static void createGetTypeFunction(PythonClassTranslator.PythonMethodKind kind, ClassWriter classWriter) { - MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "__getType", + MethodVisitor methodVisitor = classWriter.visitMethod(Modifier.PUBLIC, "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)), null, null); @@ -484,7 +484,7 @@ private static void createGenericDispatch(MethodVisitor methodVisitor, public static String getCallErrorInfo(List positionalArgs, Map namedArgs) { return "Could not find an overload that accept " + positionalArgs.stream() - .map(arg -> arg.__getType().getTypeName()).collect(Collectors.joining(", ", "(", ") argument types. ")); + .map(arg -> arg.$getType().getTypeName()).collect(Collectors.joining(", ", "(", ") argument types. ")); } private static SortedMap> diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/BinaryDunderBuiltin.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/BinaryDunderBuiltin.java index 82dab776..de2377f5 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/BinaryDunderBuiltin.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/BinaryDunderBuiltin.java @@ -39,12 +39,12 @@ public BinaryDunderBuiltin(PythonBinaryOperator operator) { PythonLikeObject object = positionalArguments.get(0); PythonLikeObject arg = positionalArguments.get(1); - PythonLikeFunction dunderMethod = (PythonLikeFunction) object.__getType().__getAttributeOrError(DUNDER_METHOD_NAME); + PythonLikeFunction dunderMethod = (PythonLikeFunction) object.$getType().$getAttributeOrError(DUNDER_METHOD_NAME); return dunderMethod.$call(List.of(object, arg), Map.of(), null); } public PythonLikeObject invoke(PythonLikeObject object, PythonLikeObject arg) { - PythonLikeFunction dunderMethod = (PythonLikeFunction) object.__getType().__getAttributeOrError(DUNDER_METHOD_NAME); + PythonLikeFunction dunderMethod = (PythonLikeFunction) object.$getType().$getAttributeOrError(DUNDER_METHOD_NAME); return dunderMethod.$call(List.of(object, arg), Map.of(), null); } } diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/GlobalBuiltins.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/GlobalBuiltins.java index 7681afef..6a1fd93d 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/GlobalBuiltins.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/GlobalBuiltins.java @@ -557,7 +557,7 @@ public static PythonNone delattr(List positionalArgs, throw new ValueError("delattr expects 2 argument, got " + positionalArgs.size()); } - object.__deleteAttribute(name.value); + object.$deleteAttribute(name.value); return PythonNone.INSTANCE; } @@ -574,20 +574,20 @@ public static PythonLikeObject divmod(List positionalArgs, throw new TypeError("divmod() expects 2 positional arguments"); } - PythonLikeObject maybeDivmod = left.__getType().__getAttributeOrNull("__divmod__"); + PythonLikeObject maybeDivmod = left.$getType().$getAttributeOrNull("__divmod__"); if (maybeDivmod != null) { PythonLikeObject result = ((PythonLikeFunction) maybeDivmod).$call(List.of(left, right), Map.of(), null); if (result != NotImplemented.INSTANCE) { return result; } - maybeDivmod = right.__getType().__getAttributeOrNull("__rdivmod__"); + maybeDivmod = right.$getType().$getAttributeOrNull("__rdivmod__"); if (maybeDivmod != null) { result = ((PythonLikeFunction) maybeDivmod).$call(List.of(right, left), Map.of(), null); if (result != NotImplemented.INSTANCE) { return result; } else { - PythonLikeObject maybeDiv = left.__getType().__getAttributeOrNull("__floordiv__"); - PythonLikeObject maybeMod = left.__getType().__getAttributeOrNull("__mod__"); + PythonLikeObject maybeDiv = left.$getType().$getAttributeOrNull("__floordiv__"); + PythonLikeObject maybeMod = left.$getType().$getAttributeOrNull("__mod__"); if (maybeDiv != null && maybeMod != null) { PythonLikeObject divResult = @@ -597,8 +597,8 @@ public static PythonLikeObject divmod(List positionalArgs, if (divResult != NotImplemented.INSTANCE && modResult != NotImplemented.INSTANCE) { return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { - maybeDiv = right.__getType().__getAttributeOrNull("__rfloordiv__"); - maybeMod = right.__getType().__getAttributeOrNull("__rmod__"); + maybeDiv = right.$getType().$getAttributeOrNull("__rfloordiv__"); + maybeMod = right.$getType().$getAttributeOrNull("__rmod__"); if (maybeDiv != null && maybeMod != null) { divResult = ((PythonLikeFunction) maybeDiv).$call(List.of(right, left), Map.of(), null); @@ -607,13 +607,13 @@ public static PythonLikeObject divmod(List positionalArgs, return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { throw new TypeError( - "Unsupported operands for divmod: " + left.__getType() + ", " + right.__getType()); + "Unsupported operands for divmod: " + left.$getType() + ", " + right.$getType()); } } } } else { - maybeDiv = right.__getType().__getAttributeOrNull("__rfloordiv__"); - maybeMod = right.__getType().__getAttributeOrNull("__rmod__"); + maybeDiv = right.$getType().$getAttributeOrNull("__rfloordiv__"); + maybeMod = right.$getType().$getAttributeOrNull("__rmod__"); if (maybeDiv != null && maybeMod != null) { PythonLikeObject divResult = @@ -624,21 +624,21 @@ public static PythonLikeObject divmod(List positionalArgs, return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { throw new TypeError( - "Unsupported operands for divmod: " + left.__getType() + ", " + right.__getType()); + "Unsupported operands for divmod: " + left.$getType() + ", " + right.$getType()); } } } } } } else { - maybeDivmod = right.__getType().__getAttributeOrNull("__rdivmod__"); + maybeDivmod = right.$getType().$getAttributeOrNull("__rdivmod__"); if (maybeDivmod != null) { PythonLikeObject result = ((PythonLikeFunction) maybeDivmod).$call(List.of(right, left), Map.of(), null); if (result != NotImplemented.INSTANCE) { return result; } else { - PythonLikeObject maybeDiv = left.__getType().__getAttributeOrNull("__floordiv__"); - PythonLikeObject maybeMod = left.__getType().__getAttributeOrNull("__mod__"); + PythonLikeObject maybeDiv = left.$getType().$getAttributeOrNull("__floordiv__"); + PythonLikeObject maybeMod = left.$getType().$getAttributeOrNull("__mod__"); if (maybeDiv != null && maybeMod != null) { PythonLikeObject divResult = @@ -648,8 +648,8 @@ public static PythonLikeObject divmod(List positionalArgs, if (divResult != NotImplemented.INSTANCE && modResult != NotImplemented.INSTANCE) { return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { - maybeDiv = right.__getType().__getAttributeOrNull("__rfloordiv__"); - maybeMod = right.__getType().__getAttributeOrNull("__rmod__"); + maybeDiv = right.$getType().$getAttributeOrNull("__rfloordiv__"); + maybeMod = right.$getType().$getAttributeOrNull("__rmod__"); if (maybeDiv != null && maybeMod != null) { divResult = ((PythonLikeFunction) maybeDiv).$call(List.of(right, left), Map.of(), null); @@ -658,13 +658,13 @@ public static PythonLikeObject divmod(List positionalArgs, return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { throw new TypeError( - "Unsupported operands for divmod: " + left.__getType() + ", " + right.__getType()); + "Unsupported operands for divmod: " + left.$getType() + ", " + right.$getType()); } } } } else { - maybeDiv = right.__getType().__getAttributeOrNull("__rfloordiv__"); - maybeMod = right.__getType().__getAttributeOrNull("__rmod__"); + maybeDiv = right.$getType().$getAttributeOrNull("__rfloordiv__"); + maybeMod = right.$getType().$getAttributeOrNull("__rmod__"); if (maybeDiv != null && maybeMod != null) { PythonLikeObject divResult = @@ -675,22 +675,22 @@ public static PythonLikeObject divmod(List positionalArgs, return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { throw new TypeError( - "Unsupported operands for divmod: " + left.__getType() + ", " + right.__getType()); + "Unsupported operands for divmod: " + left.$getType() + ", " + right.$getType()); } } } } } else { - PythonLikeObject maybeDiv = left.__getType().__getAttributeOrNull("__floordiv__"); - PythonLikeObject maybeMod = left.__getType().__getAttributeOrNull("__mod__"); + PythonLikeObject maybeDiv = left.$getType().$getAttributeOrNull("__floordiv__"); + PythonLikeObject maybeMod = left.$getType().$getAttributeOrNull("__mod__"); if (maybeDiv != null && maybeMod != null) { PythonLikeObject divResult = ((PythonLikeFunction) maybeDiv).$call(List.of(left, right), Map.of(), null); PythonLikeObject modResult = ((PythonLikeFunction) maybeMod).$call(List.of(left, right), Map.of(), null); if (divResult != NotImplemented.INSTANCE && modResult != NotImplemented.INSTANCE) { return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { - maybeDiv = right.__getType().__getAttributeOrNull("__rfloordiv__"); - maybeMod = right.__getType().__getAttributeOrNull("__rmod__"); + maybeDiv = right.$getType().$getAttributeOrNull("__rfloordiv__"); + maybeMod = right.$getType().$getAttributeOrNull("__rmod__"); if (maybeDiv != null && maybeMod != null) { divResult = ((PythonLikeFunction) maybeDiv).$call(List.of(right, left), Map.of(), null); @@ -699,13 +699,13 @@ public static PythonLikeObject divmod(List positionalArgs, return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { throw new TypeError( - "Unsupported operands for divmod: " + left.__getType() + ", " + right.__getType()); + "Unsupported operands for divmod: " + left.$getType() + ", " + right.$getType()); } } } } else { - maybeDiv = right.__getType().__getAttributeOrNull("__rfloordiv__"); - maybeMod = right.__getType().__getAttributeOrNull("__rmod__"); + maybeDiv = right.$getType().$getAttributeOrNull("__rfloordiv__"); + maybeMod = right.$getType().$getAttributeOrNull("__rmod__"); if (maybeDiv != null && maybeMod != null) { PythonLikeObject divResult = @@ -716,7 +716,7 @@ public static PythonLikeObject divmod(List positionalArgs, return PythonLikeTuple.fromList(List.of(divResult, modResult)); } else { throw new TypeError( - "Unsupported operands for divmod: " + left.__getType() + ", " + right.__getType()); + "Unsupported operands for divmod: " + left.$getType() + ", " + right.$getType()); } } } @@ -895,7 +895,7 @@ public static PythonLikeObject getattr(List positionalArgs, throw new ValueError("getattr expects 2 or 3 arguments, got " + positionalArgs.size()); } - PythonLikeFunction getAttribute = (PythonLikeFunction) object.__getType().__getAttributeOrError("__getattribute__"); + PythonLikeFunction getAttribute = (PythonLikeFunction) object.$getType().$getAttributeOrError("__getattribute__"); try { return getAttribute.$call(List.of(object, name), Map.of(), null); @@ -1048,20 +1048,20 @@ public static PythonBoolean issubclass(List positionalArgs, if (positionalArgs.size() == 2) { if (!(positionalArgs.get(0) instanceof PythonLikeType)) { - throw new TypeError("issubclass argument 0 must be a class, not " + positionalArgs.get(0).__getType()); + throw new TypeError("issubclass argument 0 must be a class, not " + positionalArgs.get(0).$getType()); } type = (PythonLikeType) positionalArgs.get(0); classInfo = positionalArgs.get(1); } else if (positionalArgs.size() == 1 && keywordArgs.containsKey(PythonString.valueOf("classinfo"))) { if (!(positionalArgs.get(0) instanceof PythonLikeType)) { - throw new TypeError("issubclass argument 0 must be a class, not " + positionalArgs.get(0).__getType()); + throw new TypeError("issubclass argument 0 must be a class, not " + positionalArgs.get(0).$getType()); } type = (PythonLikeType) positionalArgs.get(0); classInfo = keywordArgs.get(PythonString.valueOf("classinfo")); } else if (positionalArgs.size() == 0 && keywordArgs.containsKey(PythonString.valueOf("class")) && keywordArgs.containsKey(PythonString.valueOf("classinfo"))) { if (!(keywordArgs.get(PythonString.valueOf("class")) instanceof PythonLikeType)) { - throw new TypeError("issubclass argument 0 must be a class, not " + positionalArgs.get(0).__getType()); + throw new TypeError("issubclass argument 0 must be a class, not " + positionalArgs.get(0).$getType()); } type = (PythonLikeType) keywordArgs.get(PythonString.valueOf("class")); classInfo = keywordArgs.get(PythonString.valueOf("classinfo")); @@ -1154,8 +1154,8 @@ public static PythonLikeObject min(List positionalArgs, Map iterator = (Iterator) ((PythonLikeFunction) (positionalArgs.get(0).__getType() - .__getAttributeOrError("__iter__"))).$call(List.of(positionalArgs.get(0)), + Iterator iterator = (Iterator) ((PythonLikeFunction) (positionalArgs.get(0).$getType() + .$getAttributeOrError("__iter__"))).$call(List.of(positionalArgs.get(0)), Map.of(), null); Comparable min = null; for (Iterator it = iterator; it.hasNext();) { @@ -1198,8 +1198,8 @@ public static PythonLikeObject max(List positionalArgs, Map iterator = (Iterator) ((PythonLikeFunction) (positionalArgs.get(0).__getType() - .__getAttributeOrError("__iter__"))).$call(List.of(positionalArgs.get(0)), + Iterator iterator = (Iterator) ((PythonLikeFunction) (positionalArgs.get(0).$getType() + .$getAttributeOrError("__iter__"))).$call(List.of(positionalArgs.get(0)), Map.of(), null); Comparable max = null; for (Iterator it = iterator; it.hasNext();) { @@ -1371,13 +1371,13 @@ public static PythonLikeObject reversed(List positionalArgs, } sequence = positionalArgs.get(0); - PythonLikeType sequenceType = sequence.__getType(); - if (sequenceType.__getAttributeOrNull(PythonUnaryOperator.REVERSED.getDunderMethod()) != null) { + PythonLikeType sequenceType = sequence.$getType(); + if (sequenceType.$getAttributeOrNull(PythonUnaryOperator.REVERSED.getDunderMethod()) != null) { return UnaryDunderBuiltin.REVERSED.invoke(sequence); } - if (sequenceType.__getAttributeOrNull(PythonUnaryOperator.LENGTH.getDunderMethod()) != null && - sequenceType.__getAttributeOrNull(PythonBinaryOperator.GET_ITEM.getDunderMethod()) != null) { + if (sequenceType.$getAttributeOrNull(PythonUnaryOperator.LENGTH.getDunderMethod()) != null && + sequenceType.$getAttributeOrNull(PythonBinaryOperator.GET_ITEM.getDunderMethod()) != null) { PythonInteger length = (PythonInteger) UnaryDunderBuiltin.LENGTH.invoke(sequence); Iterator reversedIterator = new Iterator<>() { PythonInteger current = length.subtract(PythonInteger.ONE); @@ -1408,9 +1408,9 @@ public static PythonLikeObject round(List positionalArgs, } PythonLikeObject number = positionalArgs.get(0); - PythonLikeType numberType = number.__getType(); - if (numberType.__getAttributeOrNull("__round__") != null) { - return ((PythonLikeFunction) numberType.__getAttributeOrNull("__round__")).$call(positionalArgs, keywordArgs, null); + PythonLikeType numberType = number.$getType(); + if (numberType.$getAttributeOrNull("__round__") != null) { + return ((PythonLikeFunction) numberType.$getAttributeOrNull("__round__")).$call(positionalArgs, keywordArgs, null); } throw new ValueError(numberType + " does not has a __round__ method"); @@ -1566,7 +1566,7 @@ public static PythonLikeObject vars(List positionalArgs, throw new ValueError("0-argument version of vars is not supported when executed in Java bytecode"); } - return positionalArgs.get(0).__getAttributeOrError("__dict__"); + return positionalArgs.get(0).$getAttributeOrError("__dict__"); } public static PythonIterator zip(List positionalArgs, diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/TernaryDunderBuiltin.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/TernaryDunderBuiltin.java index 78cd77b4..385f9e38 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/TernaryDunderBuiltin.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/TernaryDunderBuiltin.java @@ -34,12 +34,12 @@ public TernaryDunderBuiltin(PythonTernaryOperator operator) { PythonLikeObject object = positionalArguments.get(0); PythonLikeObject arg1 = positionalArguments.get(1); PythonLikeObject arg2 = positionalArguments.get(2); - PythonLikeFunction dunderMethod = (PythonLikeFunction) object.__getType().__getAttributeOrError(DUNDER_METHOD_NAME); + PythonLikeFunction dunderMethod = (PythonLikeFunction) object.$getType().$getAttributeOrError(DUNDER_METHOD_NAME); return dunderMethod.$call(List.of(object, arg1, arg2), Map.of(), null); } public PythonLikeObject invoke(PythonLikeObject object, PythonLikeObject arg1, PythonLikeObject arg2) { - PythonLikeFunction dunderMethod = (PythonLikeFunction) object.__getType().__getAttributeOrError(DUNDER_METHOD_NAME); + PythonLikeFunction dunderMethod = (PythonLikeFunction) object.$getType().$getAttributeOrError(DUNDER_METHOD_NAME); return dunderMethod.$call(List.of(object, arg1, arg2), Map.of(), null); } } diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/UnaryDunderBuiltin.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/UnaryDunderBuiltin.java index 844a91b8..f592252f 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/UnaryDunderBuiltin.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/builtins/UnaryDunderBuiltin.java @@ -39,12 +39,12 @@ public UnaryDunderBuiltin(PythonUnaryOperator operator) { throw new ValueError("Function " + DUNDER_METHOD_NAME + " expects 1 positional argument"); } PythonLikeObject object = positionalArguments.get(0); - PythonLikeFunction dunderMethod = (PythonLikeFunction) object.__getType().__getAttributeOrError(DUNDER_METHOD_NAME); + PythonLikeFunction dunderMethod = (PythonLikeFunction) object.$getType().$getAttributeOrError(DUNDER_METHOD_NAME); return dunderMethod.$call(List.of(object), Map.of(), null); } public PythonLikeObject invoke(PythonLikeObject object) { - PythonLikeFunction dunderMethod = (PythonLikeFunction) object.__getType().__getAttributeOrError(DUNDER_METHOD_NAME); + PythonLikeFunction dunderMethod = (PythonLikeFunction) object.$getType().$getAttributeOrError(DUNDER_METHOD_NAME); return dunderMethod.$call(List.of(object), Map.of(), null); } } diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/DunderOperatorImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/DunderOperatorImplementor.java index 8fe070a8..093f8c1b 100644 --- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/DunderOperatorImplementor.java +++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/DunderOperatorImplementor.java @@ -62,7 +62,7 @@ public static void unaryOperator(MethodVisitor methodVisitor, StackMetadata stac * * *
-     *    BiFunction[List, Map, Result] operand_method = TOS.__getType().__getAttributeOrError(operator.getDunderMethod());
+     *    BiFunction[List, Map, Result] operand_method = TOS.$getType().$getAttributeOrError(operator.getDunderMethod());
      *    List args = new ArrayList(1);
      *    args.set(0) = TOS
      *    pop TOS
@@ -74,11 +74,11 @@ public static void unaryOperator(MethodVisitor methodVisitor, StackMetadata stac
     public static void unaryOperator(MethodVisitor methodVisitor, PythonUnaryOperator operator) {
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(operator.getDunderMethod());
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                "$getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                         Type.getType(String.class)),
                 true);
 
@@ -257,7 +257,7 @@ private static void raiseUnsupportedType(MethodVisitor methodVisitor, LocalVaria
                     false);
             localVariableHelper.readTemp(methodVisitor, Type.getType(PythonLikeObject.class), left);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                     true);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(PythonLikeType.class),
                     "getTypeName", Type.getMethodDescriptor(Type.getType(String.class)),
@@ -273,7 +273,7 @@ private static void raiseUnsupportedType(MethodVisitor methodVisitor, LocalVaria
                     false);
             localVariableHelper.readTemp(methodVisitor, Type.getType(PythonLikeObject.class), right);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                     true);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(PythonLikeType.class),
                     "getTypeName", Type.getMethodDescriptor(Type.getType(String.class)),
@@ -320,7 +320,7 @@ private static void raiseUnsupportedType(MethodVisitor methodVisitor, LocalVaria
      *
      * 
      * 
-     *    BiFunction[List, Map, Result] operand_method = TOS1.__getType().__getAttributeOrError(operator.getDunderMethod());
+     *    BiFunction[List, Map, Result] operand_method = TOS1.$getType().$getAttributeOrError(operator.getDunderMethod());
      *    List args = new ArrayList(2);
      *    args.set(0) = TOS1
      *    args.set(1) = TOS
@@ -342,11 +342,11 @@ public static void binaryOperator(MethodVisitor methodVisitor, LocalVariableHelp
         // Stack is now (TOS1, TOS,)? TOS, TOS1
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(operator.getDunderMethod());
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                         Type.getType(String.class)),
                 true);
         methodVisitor.visitInsn(Opcodes.DUP);
@@ -410,11 +410,11 @@ public static void binaryOperator(MethodVisitor methodVisitor, LocalVariableHelp
             // Stack is now TOS1, TOS
             methodVisitor.visitInsn(Opcodes.DUP);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                     true);
             methodVisitor.visitLdcInsn(operator.getRightDunderMethod());
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                    "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                             Type.getType(String.class)),
                     true);
             methodVisitor.visitInsn(Opcodes.DUP);
@@ -482,11 +482,11 @@ public static void binaryOperatorOnlyRight(MethodVisitor methodVisitor, LocalVar
         // Stack is now TOS1, TOS
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(operator.getRightDunderMethod());
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                         Type.getType(String.class)),
                 true);
         methodVisitor.visitInsn(Opcodes.DUP);
@@ -548,7 +548,7 @@ public static void binaryOperatorOnlyRight(MethodVisitor methodVisitor, LocalVar
      *
      * 
      * 
-     *    BiFunction[List, Map, Result] operand_method = TOS2.__getType().__getAttributeOrError(operator.getDunderMethod());
+     *    BiFunction[List, Map, Result] operand_method = TOS2.$getType().$getAttributeOrError(operator.getDunderMethod());
      *    List args = new ArrayList(2);
      *    args.set(0) = TOS2
      *    args.set(1) = TOS1
@@ -568,11 +568,11 @@ public static void ternaryOperator(FunctionMetadata functionMetadata, StackMetad
         // Stack is now TOS, TOS1, TOS2
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(operator.getDunderMethod());
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                "$getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                         Type.getType(String.class)),
                 true);
         // Stack is now TOS, TOS1, TOS2, method
@@ -669,7 +669,7 @@ private static void binaryOpOverridingLeftIfSpecific(MethodVisitor methodVisitor
         methodVisitor.visitInsn(Opcodes.DUP_X1);
 
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(operator.getDunderMethod());
         methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(PythonLikeType.class),
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ExceptionImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ExceptionImplementor.java
index 25814765..a28cc7e6 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ExceptionImplementor.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ExceptionImplementor.java
@@ -221,7 +221,7 @@ public static void createTryFinallyBlock(MethodVisitor methodVisitor, String cla
             // Get exception class
             methodVisitor.visitInsn(Opcodes.DUP);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                     true);
 
             // Stack is (stack-before-try), instruction, stack-size, label, traceback, exception, exception_class
@@ -255,11 +255,11 @@ public static void startWith(int jumpTarget, FunctionMetadata functionMetadata,
 
         // First load the method __exit__
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn("__exit__");
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrError",
+                "$getAttributeOrError",
                 Type.getMethodDescriptor(Type.getType(PythonLikeObject.class), Type.getType(String.class)),
                 true);
         methodVisitor.visitTypeInsn(Opcodes.CHECKCAST, Type.getInternalName(PythonLikeFunction.class));
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/FunctionImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/FunctionImplementor.java
index dab83e64..7ae8b54e 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/FunctionImplementor.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/FunctionImplementor.java
@@ -43,11 +43,11 @@ public static void callBinaryMethod(FunctionMetadata functionMetadata,
         methodVisitor.visitInsn(Opcodes.SWAP);
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(methodName);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                "$getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                         Type.getType(String.class)),
                 true);
         methodVisitor.visitInsn(Opcodes.DUP_X2);
@@ -71,11 +71,11 @@ public static void callBinaryMethod(MethodVisitor methodVisitor, String methodNa
         methodVisitor.visitInsn(Opcodes.SWAP);
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(methodName);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                "$getAttributeOrError", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                         Type.getType(String.class)),
                 true);
         methodVisitor.visitInsn(Opcodes.DUP_X2);
@@ -119,7 +119,7 @@ public static void loadMethod(FunctionMetadata functionMetadata, MethodVisitor m
                     if (isTosType && knownFunctionType.isStaticMethod()) {
                         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                         Type.getType(String.class)),
                                 true);
 
@@ -131,11 +131,11 @@ public static void loadMethod(FunctionMetadata functionMetadata, MethodVisitor m
                         }
                     } else if (!isTosType && knownFunctionType.isStaticMethod()) {
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                                 true);
                         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                         Type.getType(String.class)),
                                 true);
                         methodVisitor.visitInsn(Opcodes.ACONST_NULL);
@@ -148,18 +148,18 @@ public static void loadMethod(FunctionMetadata functionMetadata, MethodVisitor m
                         methodVisitor.visitInsn(Opcodes.DUP);
                         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                         Type.getType(String.class)),
                                 true);
                         methodVisitor.visitInsn(Opcodes.SWAP);
                     } else if (!isTosType && knownFunctionType.isClassMethod()) {
                         methodVisitor.visitInsn(Opcodes.DUP);
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                                 true);
                         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                         Type.getType(String.class)),
                                 true);
                         methodVisitor.visitInsn(Opcodes.SWAP);
@@ -167,18 +167,18 @@ public static void loadMethod(FunctionMetadata functionMetadata, MethodVisitor m
                         methodVisitor.visitInsn(Opcodes.DUP);
                         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                         Type.getType(String.class)),
                                 true);
                         methodVisitor.visitInsn(Opcodes.SWAP);
                     } else {
                         methodVisitor.visitInsn(Opcodes.DUP);
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                                 true);
                         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
                         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                                "__getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
+                                "$getAttributeOrNull", Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                         Type.getType(String.class)),
                                 true);
                         methodVisitor.visitInsn(Opcodes.SWAP);
@@ -199,7 +199,7 @@ private static void loadGenericMethod(FunctionMetadata functionMetadata, MethodV
 
         methodVisitor.visitInsn(Opcodes.DUP);
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                 true);
         methodVisitor.visitLdcInsn(function.co_names.get(instruction.arg));
         methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(PythonLikeType.class),
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/GeneratorImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/GeneratorImplementor.java
index 8459a21e..8f027675 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/GeneratorImplementor.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/GeneratorImplementor.java
@@ -256,12 +256,12 @@ public static void progressSubgenerator(FunctionMetadata functionMetadata, Stack
                             methodVisitor.visitInsn(Opcodes.DUP);
                             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE,
                                     Type.getInternalName(PythonLikeObject.class),
-                                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                                     true);
                             methodVisitor.visitLdcInsn("throw");
                             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE,
                                     Type.getInternalName(PythonLikeObject.class),
-                                    "__getAttributeOrNull",
+                                    "$getAttributeOrNull",
                                     Type.getMethodDescriptor(Type.getType(PythonLikeObject.class),
                                             Type.getType(String.class)),
                                     true);
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/KnownCallImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/KnownCallImplementor.java
index 73e66052..94a991ec 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/KnownCallImplementor.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/KnownCallImplementor.java
@@ -98,7 +98,7 @@ public static void callMethod(PythonFunctionSignature pythonFunctionSignature, M
             methodVisitor.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(PythonLikeType.class));
             methodVisitor.visitJumpInsn(Opcodes.IFNE, doneGettingType);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                     true);
             methodVisitor.visitJumpInsn(Opcodes.GOTO, doneGettingType);
             methodVisitor.visitLabel(ifIsBoundFunction);
@@ -264,7 +264,7 @@ public static void callPython311andAbove(PythonFunctionSignature pythonFunctionS
             methodVisitor.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(PythonLikeType.class));
             methodVisitor.visitJumpInsn(Opcodes.IFNE, doneGettingType);
             methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                    "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                    "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                     true);
             methodVisitor.visitJumpInsn(Opcodes.GOTO, doneGettingType);
             methodVisitor.visitLabel(ifIsBoundFunction);
@@ -379,7 +379,7 @@ private static void callWithKeywords(PythonFunctionSignature pythonFunctionSigna
                 methodVisitor.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(PythonLikeType.class));
                 methodVisitor.visitJumpInsn(Opcodes.IFNE, doneGettingType);
                 methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                        "__getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
+                        "$getType", Type.getMethodDescriptor(Type.getType(PythonLikeType.class)),
                         true);
                 methodVisitor.visitJumpInsn(Opcodes.GOTO, doneGettingType);
                 methodVisitor.visitLabel(ifIsBoundFunction);
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ModuleImplementor.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ModuleImplementor.java
index ee1b7703..33f1f354 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ModuleImplementor.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/implementors/ModuleImplementor.java
@@ -120,7 +120,7 @@ public static void importFrom(FunctionMetadata functionMetadata, StackMetadata s
 
         // Get the attribute
         methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(PythonLikeObject.class),
-                "__getAttributeOrError",
+                "$getAttributeOrError",
                 Type.getMethodDescriptor(Type.getType(PythonLikeObject.class), Type.getType(String.class)),
                 true);
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadConstantOpcode.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadConstantOpcode.java
index 98722355..25d7688f 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadConstantOpcode.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadConstantOpcode.java
@@ -20,14 +20,14 @@ public LoadConstantOpcode(PythonBytecodeInstruction instruction) {
     @Override
     protected StackMetadata getStackMetadataAfterInstruction(FunctionMetadata functionMetadata, StackMetadata stackMetadata) {
         PythonLikeObject constant = functionMetadata.pythonCompiledFunction.co_constants.get(instruction.arg);
-        PythonLikeType constantType = constant.__getGenericType();
+        PythonLikeType constantType = constant.$getGenericType();
         return stackMetadata.push(ValueSourceInfo.of(this, constantType));
     }
 
     @Override
     public void implement(FunctionMetadata functionMetadata, StackMetadata stackMetadata) {
         PythonLikeObject constant = functionMetadata.pythonCompiledFunction.co_constants.get(instruction.arg);
-        PythonLikeType constantType = constant.__getGenericType();
+        PythonLikeType constantType = constant.$getGenericType();
 
         PythonConstantsImplementor.loadConstant(functionMetadata.methodVisitor, functionMetadata.className,
                 instruction.arg);
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadGlobalOpcode.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadGlobalOpcode.java
index 47b9ec09..2a8259e5 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadGlobalOpcode.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/variable/LoadGlobalOpcode.java
@@ -45,7 +45,7 @@ protected StackMetadata getStackMetadataAfterInstruction(FunctionMetadata functi
             if (global != null) {
                 return stackMetadata
                         .push(ValueSourceInfo.of(this, BuiltinTypes.NULL_TYPE))
-                        .push(ValueSourceInfo.of(this, global.__getGenericType()));
+                        .push(ValueSourceInfo.of(this, global.$getGenericType()));
             } else {
                 return stackMetadata
                         .push(ValueSourceInfo.of(this, BuiltinTypes.NULL_TYPE))
@@ -54,7 +54,7 @@ protected StackMetadata getStackMetadataAfterInstruction(FunctionMetadata functi
         } else {
             if (global != null) {
                 return stackMetadata
-                        .push(ValueSourceInfo.of(this, global.__getGenericType()));
+                        .push(ValueSourceInfo.of(this, global.$getGenericType()));
             } else {
                 return stackMetadata
                         .push(ValueSourceInfo.of(this, BuiltinTypes.BASE_TYPE));
@@ -77,6 +77,6 @@ public void implement(FunctionMetadata functionMetadata, StackMetadata stackMeta
             functionMetadata.methodVisitor.visitInsn(Opcodes.ACONST_NULL);
         }
         VariableImplementor.loadGlobalVariable(functionMetadata, stackMetadata, globalIndex,
-                (global != null) ? global.__getGenericType() : BuiltinTypes.BASE_TYPE);
+                (global != null) ? global.$getGenericType() : BuiltinTypes.BASE_TYPE);
     }
 }
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/AbstractPythonLikeObject.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/AbstractPythonLikeObject.java
index f3e28e00..1fec8da3 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/AbstractPythonLikeObject.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/AbstractPythonLikeObject.java
@@ -23,26 +23,26 @@ public AbstractPythonLikeObject(PythonLikeType __type__, Map positionalArgum
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return type;
     }
 }
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonByteArray.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonByteArray.java
index 08cd1905..f96cfab7 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonByteArray.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonByteArray.java
@@ -519,7 +519,7 @@ private static byte[] getBytes(PythonLikeObject iterable) {
                 PythonLikeObject next = iterator.nextPythonItem();
                 byte[] byteWrapper = new byte[1];
                 if (!(next instanceof PythonInteger)) {
-                    throw new TypeError("'" + next.__getType().getTypeName() + "' object cannot be interpreted as an integer");
+                    throw new TypeError("'" + next.$getType().getTypeName() + "' object cannot be interpreted as an integer");
                 }
                 byteWrapper[0] = ((PythonInteger) next).asByte();
                 out.writeBytes(byteWrapper);
@@ -1038,7 +1038,7 @@ public PythonByteArray join(PythonLikeObject iterable) {
             PythonLikeObject item = iterator.nextPythonItem();
 
             if (!(item instanceof PythonBytesLikeObject)) {
-                throw new TypeError("type " + item.__getType() + " is not a bytes-like type");
+                throw new TypeError("type " + item.$getType() + " is not a bytes-like type");
             }
 
             outputStream.writeBytes(((PythonBytesLikeObject) item).asByteArray());
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonBytes.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonBytes.java
index 5fa362d8..0c063749 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonBytes.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonBytes.java
@@ -844,7 +844,7 @@ public PythonBytes join(PythonLikeObject iterable) {
             PythonLikeObject item = iterator.nextPythonItem();
 
             if (!(item instanceof PythonBytesLikeObject)) {
-                throw new TypeError("type " + item.__getType() + " is not a bytes-like type");
+                throw new TypeError("type " + item.$getType() + " is not a bytes-like type");
             }
 
             outputStream.writeBytes(((PythonBytesLikeObject) item).asByteArray());
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonKnownFunctionType.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonKnownFunctionType.java
index e0c80c66..0c53a2c3 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonKnownFunctionType.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonKnownFunctionType.java
@@ -28,12 +28,12 @@ public boolean isClassMethod() {
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return BuiltinTypes.BASE_TYPE;
     }
 
     @Override
-    public PythonLikeType __getGenericType() {
+    public PythonLikeType $getGenericType() {
         return BuiltinTypes.BASE_TYPE;
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeFunction.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeFunction.java
index ba0ab0da..9e23ba1f 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeFunction.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeFunction.java
@@ -30,22 +30,22 @@ static PythonLikeType getClassFunctionType() {
             PythonLikeObject callerInstance);
 
     @Override
-    default PythonLikeObject __getAttributeOrNull(String attributeName) {
+    default PythonLikeObject $getAttributeOrNull(String attributeName) {
         return null;
     }
 
     @Override
-    default void __setAttribute(String attributeName, PythonLikeObject value) {
+    default void $setAttribute(String attributeName, PythonLikeObject value) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    default void __deleteAttribute(String attributeName) {
+    default void $deleteAttribute(String attributeName) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    default PythonLikeType __getType() {
+    default PythonLikeType $getType() {
         return BuiltinTypes.FUNCTION_TYPE;
     }
 }
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeType.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeType.java
index dcb88c62..9b30e7ea 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeType.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonLikeType.java
@@ -124,7 +124,7 @@ private List mergeMRO() {
     }
 
     public boolean isInstance(PythonLikeObject object) {
-        PythonLikeType objectType = object.__getType();
+        PythonLikeType objectType = object.$getType();
         return objectType.isSubclassOf(this);
     }
 
@@ -162,7 +162,7 @@ public static PythonLikeType registerBaseType() {
     public static PythonLikeType registerTypeType() {
         BuiltinTypes.TYPE_TYPE.setConstructor((positional, keywords, callerInstance) -> {
             if (positional.size() == 1) {
-                return positional.get(0).__getType();
+                return positional.get(0).$getType();
             } else if (positional.size() == 3) {
                 PythonString name = (PythonString) positional.get(0);
                 PythonLikeTuple baseClasses = (PythonLikeTuple) positional.get(1);
@@ -178,7 +178,7 @@ public static PythonLikeType registerTypeType() {
                 for (Map.Entry entry : dict.entrySet()) {
                     PythonString attributeName = (PythonString) entry.getKey();
 
-                    out.__setAttribute(attributeName.value, entry.getValue());
+                    out.$setAttribute(attributeName.value, entry.getValue());
                 }
 
                 return out;
@@ -193,16 +193,16 @@ public static PythonLikeType registerTypeType() {
     @Override
     public PythonLikeObject $method$__getattribute__(PythonString pythonName) {
         String name = pythonName.value;
-        PythonLikeObject typeResult = __getAttributeOrNull(name);
+        PythonLikeObject typeResult = this.$getAttributeOrNull(name);
         if (typeResult != null) {
-            PythonLikeObject maybeDescriptor = typeResult.__getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
+            PythonLikeObject maybeDescriptor = typeResult.$getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
             if (maybeDescriptor == null) {
-                maybeDescriptor = typeResult.__getType().__getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
+                maybeDescriptor = typeResult.$getType().$getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
             }
 
             if (maybeDescriptor != null) {
                 if (!(maybeDescriptor instanceof PythonLikeFunction)) {
-                    throw new UnsupportedOperationException("'" + maybeDescriptor.__getType() + "' is not callable");
+                    throw new UnsupportedOperationException("'" + maybeDescriptor.$getType() + "' is not callable");
                 }
                 return TernaryDunderBuiltin.GET_DESCRIPTOR.invoke(typeResult, PythonNone.INSTANCE, this);
             }
@@ -312,9 +312,9 @@ public Optional getMethodType(String methodName) {
     }
 
     public Optional getMethodKind(String methodName) {
-        PythonLikeObject maybeMethod = __getAttributeOrNull(methodName);
+        PythonLikeObject maybeMethod = this.$getAttributeOrNull(methodName);
         if (maybeMethod != null) {
-            PythonLikeType methodKind = maybeMethod.__getType();
+            PythonLikeType methodKind = maybeMethod.$getType();
             if (methodKind == BuiltinTypes.FUNCTION_TYPE) {
                 return Optional.of(PythonClassTranslator.PythonMethodKind.VIRTUAL_METHOD);
             }
@@ -450,17 +450,17 @@ public int getDepth() {
     }
 
     public PythonLikeObject loadMethod(String methodName) {
-        PythonLikeObject out = __getAttributeOrNull(methodName);
+        PythonLikeObject out = this.$getAttributeOrNull(methodName);
         if (out == null) {
             return null;
         }
 
-        if (out.__getType() == BuiltinTypes.FUNCTION_TYPE) {
+        if (out.$getType() == BuiltinTypes.FUNCTION_TYPE) {
             return out;
         }
 
         return null;
-        //if (out.__getType() == PythonLikeFunction.getClassFunctionType()) {
+        //if (out.$getType() == PythonLikeFunction.getClassFunctionType()) {
         //    return FunctionBuiltinOperations.bindFunctionToType((PythonLikeFunction) out, null, this);
         //} else {
         //    return null;
@@ -484,11 +484,11 @@ public PythonLikeType getDefiningTypeOrNull(String attributeName) {
         return null;
     }
 
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
         PythonLikeObject out = __dir__.get(attributeName);
         if (out == null) {
             for (PythonLikeType type : PARENT_TYPES) {
-                out = type.__getAttributeOrNull(attributeName);
+                out = type.$getAttributeOrNull(attributeName);
                 if (out != null) {
                     return out;
                 }
@@ -500,23 +500,23 @@ public PythonLikeObject __getAttributeOrNull(String attributeName) {
     }
 
     @Override
-    public void __setAttribute(String attributeName, PythonLikeObject value) {
+    public void $setAttribute(String attributeName, PythonLikeObject value) {
         __dir__.put(attributeName, value);
     }
 
     @Override
-    public void __deleteAttribute(String attributeName) {
+    public void $deleteAttribute(String attributeName) {
         // TODO: Descriptors: https://docs.python.org/3/howto/descriptor.html
         __dir__.remove(attributeName);
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return BuiltinTypes.TYPE_TYPE;
     }
 
     @Override
-    public PythonLikeType __getGenericType() {
+    public PythonLikeType $getGenericType() {
         return new PythonLikeGenericType(this);
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonModule.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonModule.java
index 4f40acd1..55fdd8ff 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonModule.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonModule.java
@@ -19,7 +19,7 @@ public PythonModule(Map referenceMap) {
     }
 
     public void addItem(String itemName, PythonLikeObject itemValue) {
-        __setAttribute(itemName, itemValue);
+        $setAttribute(itemName, itemValue);
     }
 
     public OpaquePythonReference getPythonReference() {
@@ -31,12 +31,12 @@ public void setPythonReference(OpaquePythonReference pythonReference) {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
-        PythonLikeObject result = super.__getAttributeOrNull(attributeName);
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
+        PythonLikeObject result = super.$getAttributeOrNull(attributeName);
         if (result == null) {
             PythonLikeObject actual = CPythonBackedPythonInterpreter.lookupAttributeOnPythonReference(pythonReference,
                     attributeName, referenceMap);
-            __setAttribute(attributeName, actual);
+            $setAttribute(attributeName, actual);
             return actual;
         }
         return result;
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonRange.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonRange.java
index 7ded913b..e5561300 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonRange.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonRange.java
@@ -104,9 +104,9 @@ public PythonRange(PythonInteger start, PythonInteger stop, PythonInteger step)
         this.stop = stop;
         this.step = step;
 
-        __setAttribute("start", start);
-        __setAttribute("stop", stop);
-        __setAttribute("step", step);
+        $setAttribute("start", start);
+        $setAttribute("stop", stop);
+        $setAttribute("step", step);
     }
 
     @Override
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSlice.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSlice.java
index 59172bc7..6d20be2d 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSlice.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSlice.java
@@ -81,9 +81,9 @@ public PythonSlice(PythonLikeObject start, PythonLikeObject stop, PythonLikeObje
         this.stop = stop;
         this.step = step;
 
-        __setAttribute("start", (start != null) ? start : PythonNone.INSTANCE);
-        __setAttribute("stop", (stop != null) ? stop : PythonNone.INSTANCE);
-        __setAttribute("step", (step != null) ? step : PythonNone.INSTANCE);
+        $setAttribute("start", (start != null) ? start : PythonNone.INSTANCE);
+        $setAttribute("stop", (stop != null) ? stop : PythonNone.INSTANCE);
+        $setAttribute("step", (step != null) ? step : PythonNone.INSTANCE);
     }
 
     /**
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonString.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonString.java
index 98c2a9d2..c11848f6 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonString.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonString.java
@@ -1138,7 +1138,7 @@ public PythonString join(PythonLikeObject iterable) {
             PythonLikeObject maybeString = iterator.nextPythonItem();
             if (!(maybeString instanceof PythonString)) {
                 throw new TypeError("sequence item " + index + ": expected str instance, "
-                        + maybeString.__getType().getTypeName() + " found");
+                        + maybeString.$getType().getTypeName() + " found");
             }
             PythonString string = (PythonString) maybeString;
             out.append(string.value);
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSuperObject.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSuperObject.java
index ec93fbf6..fe787c58 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSuperObject.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonSuperObject.java
@@ -34,7 +34,7 @@ public PythonSuperObject(PythonLikeType previousType, PythonLikeObject instance)
             if (instance instanceof PythonLikeType) {
                 mro = ((PythonLikeType) instance).MRO;
             } else {
-                mro = instance.__getType().MRO;
+                mro = instance.$getType().MRO;
             }
         } else {
             mro = previousType.MRO;
@@ -44,7 +44,7 @@ public PythonSuperObject(PythonLikeType previousType, PythonLikeObject instance)
         for (int currentIndex = mro.indexOf(previousType) + 1; currentIndex < mro.size(); currentIndex++) {
             PythonLikeType candidate = mro.get(currentIndex);
 
-            PythonLikeObject typeResult = candidate.__getAttributeOrNull(name);
+            PythonLikeObject typeResult = candidate.$getAttributeOrNull(name);
             if (typeResult != null) {
 
                 if (typeResult instanceof PythonLikeFunction && !(typeResult instanceof PythonLikeType)) {
@@ -54,20 +54,20 @@ public PythonSuperObject(PythonLikeType previousType, PythonLikeObject instance)
                         typeResult = new GeneratedFunctionMethodReference(methodInstance,
                                 methodInstance.getClass().getDeclaredMethods()[0],
                                 Map.of(),
-                                typeResult.__getType());
+                                typeResult.$getType());
                     } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
                         // ignore
                     }
                 }
 
-                PythonLikeObject maybeDescriptor = typeResult.__getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
+                PythonLikeObject maybeDescriptor = typeResult.$getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
                 if (maybeDescriptor == null) {
-                    maybeDescriptor = typeResult.__getType().__getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
+                    maybeDescriptor = typeResult.$getType().$getAttributeOrNull(PythonTernaryOperator.GET.dunderMethod);
                 }
 
                 if (maybeDescriptor != null) {
                     if (!(maybeDescriptor instanceof PythonLikeFunction)) {
-                        throw new UnsupportedOperationException("'" + maybeDescriptor.__getType() + "' is not callable");
+                        throw new UnsupportedOperationException("'" + maybeDescriptor.$getType() + "' is not callable");
                     }
                     return TernaryDunderBuiltin.GET_DESCRIPTOR.invoke(typeResult,
                             (instance != null) ? instance : PythonNone.INSTANCE,
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictItemView.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictItemView.java
index 78e4277a..d6459038 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictItemView.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictItemView.java
@@ -79,7 +79,7 @@ public DictItemView(PythonLikeDict mapping) {
         super(BuiltinTypes.DICT_ITEM_VIEW_TYPE);
         this.mapping = mapping;
         this.entrySet = mapping.delegate.entrySet();
-        __setAttribute("mapping", mapping);
+        $setAttribute("mapping", mapping);
     }
 
     private List getEntriesAsTuples() {
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictKeyView.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictKeyView.java
index 70cd4d15..11340a97 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictKeyView.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictKeyView.java
@@ -71,7 +71,7 @@ public DictKeyView(PythonLikeDict mapping) {
         super(BuiltinTypes.DICT_KEY_VIEW_TYPE);
         this.mapping = mapping;
         this.keySet = mapping.delegate.keySet();
-        __setAttribute("mapping", mapping);
+        $setAttribute("mapping", mapping);
     }
 
     public PythonInteger getKeysSize() {
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictValueView.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictValueView.java
index f0f131d6..93908abc 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictValueView.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/view/DictValueView.java
@@ -51,7 +51,7 @@ public DictValueView(PythonLikeDict mapping) {
         super(BuiltinTypes.DICT_VALUE_VIEW_TYPE);
         this.mapping = mapping;
         this.valueCollection = mapping.delegate.values();
-        __setAttribute("mapping", mapping);
+        $setAttribute("mapping", mapping);
     }
 
     public PythonInteger getValuesSize() {
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDate.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDate.java
index e9c84d79..e6a0d9c7 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDate.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDate.java
@@ -49,9 +49,9 @@ public class PythonDate> extends AbstractPythonLikeObjec
             PythonLikeComparable.setup(DATE_TYPE);
             registerMethods();
 
-            DATE_TYPE.__setAttribute("min", new PythonDate(LocalDate.of(1, 1, 1)));
-            DATE_TYPE.__setAttribute("max", new PythonDate(LocalDate.of(9999, 12, 31)));
-            DATE_TYPE.__setAttribute("resolution", new PythonTimeDelta(Duration.ofDays(1)));
+            DATE_TYPE.$setAttribute("min", new PythonDate(LocalDate.of(1, 1, 1)));
+            DATE_TYPE.$setAttribute("max", new PythonDate(LocalDate.of(9999, 12, 31)));
+            DATE_TYPE.$setAttribute("resolution", new PythonTimeDelta(Duration.ofDays(1)));
 
             PythonOverloadImplementor.createDispatchesFor(DATE_TYPE);
         } catch (NoSuchMethodException e) {
@@ -183,7 +183,7 @@ public static PythonDate of(int year, int month, int day) {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String name) {
+    public PythonLikeObject $getAttributeOrNull(String name) {
         switch (name) {
             case "year":
                 return year;
@@ -192,7 +192,7 @@ public PythonLikeObject __getAttributeOrNull(String name) {
             case "day":
                 return day;
             default:
-                return super.__getAttributeOrNull(name);
+                return super.$getAttributeOrNull(name);
         }
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDateTime.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDateTime.java
index 500476a3..e5b781a9 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDateTime.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDateTime.java
@@ -62,11 +62,11 @@ public class PythonDateTime extends PythonDate {
             PythonLikeComparable.setup(DATE_TIME_TYPE);
             registerMethods();
 
-            DATE_TIME_TYPE.__setAttribute("min", new PythonDateTime(LocalDate.of(1, 1, 1),
+            DATE_TIME_TYPE.$setAttribute("min", new PythonDateTime(LocalDate.of(1, 1, 1),
                     LocalTime.MAX));
-            DATE_TIME_TYPE.__setAttribute("max", new PythonDateTime(LocalDate.of(9999, 12, 31),
+            DATE_TIME_TYPE.$setAttribute("max", new PythonDateTime(LocalDate.of(9999, 12, 31),
                     LocalTime.MIN));
-            DATE_TIME_TYPE.__setAttribute("resolution", new PythonTimeDelta(Duration.ofNanos(1000L)));
+            DATE_TIME_TYPE.$setAttribute("resolution", new PythonTimeDelta(Duration.ofNanos(1000L)));
 
             PythonOverloadImplementor.createDispatchesFor(DATE_TIME_TYPE);
         } catch (NoSuchMethodException e) {
@@ -300,7 +300,7 @@ public static PythonDateTime of(int year, int month, int day, int hour, int minu
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String name) {
+    public PythonLikeObject $getAttributeOrNull(String name) {
         switch (name) {
             case "hour":
                 return hour;
@@ -315,7 +315,7 @@ public PythonLikeObject __getAttributeOrNull(String name) {
             case "tzinfo":
                 return tzinfo;
             default:
-                return super.__getAttributeOrNull(name);
+                return super.$getAttributeOrNull(name);
         }
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTime.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTime.java
index f401ba59..770cbab9 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTime.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTime.java
@@ -43,9 +43,9 @@ public class PythonTime extends AbstractPythonLikeObject {
         try {
             registerMethods();
 
-            TIME_TYPE.__setAttribute("min", new PythonTime(LocalTime.MAX));
-            TIME_TYPE.__setAttribute("max", new PythonTime(LocalTime.MIN));
-            TIME_TYPE.__setAttribute("resolution", new PythonTimeDelta(Duration.ofNanos(1000L)));
+            TIME_TYPE.$setAttribute("min", new PythonTime(LocalTime.MAX));
+            TIME_TYPE.$setAttribute("max", new PythonTime(LocalTime.MIN));
+            TIME_TYPE.$setAttribute("resolution", new PythonTimeDelta(Duration.ofNanos(1000L)));
 
             PythonOverloadImplementor.createDispatchesFor(TIME_TYPE);
         } catch (NoSuchMethodException e) {
@@ -133,7 +133,7 @@ public PythonTime(LocalTime localTime, ZoneId zoneId, int fold) {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String name) {
+    public PythonLikeObject $getAttributeOrNull(String name) {
         switch (name) {
             case "hour":
                 return hour;
@@ -148,7 +148,7 @@ public PythonLikeObject __getAttributeOrNull(String name) {
             case "fold":
                 return fold;
             default:
-                return super.__getAttributeOrNull(name);
+                return super.$getAttributeOrNull(name);
         }
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTimeDelta.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTimeDelta.java
index c0138915..68daffce 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTimeDelta.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTimeDelta.java
@@ -38,10 +38,10 @@ public class PythonTimeDelta extends AbstractPythonLikeObject implements PythonL
             PythonLikeComparable.setup(TIME_DELTA_TYPE);
             registerMethods();
 
-            TIME_DELTA_TYPE.__setAttribute("min", new PythonTimeDelta(Duration.ofDays(-999999999)));
-            TIME_DELTA_TYPE.__setAttribute("max", new PythonTimeDelta(Duration.ofDays(1000000000)
+            TIME_DELTA_TYPE.$setAttribute("min", new PythonTimeDelta(Duration.ofDays(-999999999)));
+            TIME_DELTA_TYPE.$setAttribute("max", new PythonTimeDelta(Duration.ofDays(1000000000)
                     .minusNanos(1000)));
-            TIME_DELTA_TYPE.__setAttribute("resolution", new PythonTimeDelta(Duration.ofNanos(1000)));
+            TIME_DELTA_TYPE.$setAttribute("resolution", new PythonTimeDelta(Duration.ofNanos(1000)));
 
             PythonOverloadImplementor.createDispatchesFor(TIME_DELTA_TYPE);
         } catch (NoSuchMethodException e) {
@@ -133,7 +133,7 @@ public PythonTimeDelta(Duration duration) {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String name) {
+    public PythonLikeObject $getAttributeOrNull(String name) {
         switch (name) {
             case "days":
                 return days;
@@ -142,7 +142,7 @@ public PythonLikeObject __getAttributeOrNull(String name) {
             case "microseconds":
                 return microseconds;
             default:
-                return super.__getAttributeOrNull(name);
+                return super.$getAttributeOrNull(name);
         }
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/errors/PythonBaseException.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/errors/PythonBaseException.java
index 56e08786..029a8ff0 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/errors/PythonBaseException.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/errors/PythonBaseException.java
@@ -50,8 +50,8 @@ public PythonBaseException(PythonLikeType type, List args) {
         this.type = type;
         this.args = args;
         this.dict = new HashMap<>();
-        __setAttribute("args", PythonLikeTuple.fromList(args));
-        __setAttribute("__cause__", PythonNone.INSTANCE);
+        $setAttribute("args", PythonLikeTuple.fromList(args));
+        $setAttribute("__cause__", PythonNone.INSTANCE);
     }
 
     public PythonBaseException(PythonLikeType type, String message) {
@@ -59,8 +59,8 @@ public PythonBaseException(PythonLikeType type, String message) {
         this.type = type;
         this.args = List.of(PythonString.valueOf(message));
         this.dict = new HashMap<>();
-        __setAttribute("args", PythonLikeTuple.fromList(args));
-        __setAttribute("__cause__", PythonNone.INSTANCE);
+        $setAttribute("args", PythonLikeTuple.fromList(args));
+        $setAttribute("__cause__", PythonNone.INSTANCE);
     }
 
     /**
@@ -81,34 +81,34 @@ public Throwable fillInStackTrace() {
     public Throwable initCause(Throwable cause) {
         super.initCause(cause);
         if (cause instanceof PythonLikeObject pythonError) {
-            __setAttribute("__cause__", pythonError);
+            $setAttribute("__cause__", pythonError);
         } else {
-            __setAttribute("__cause__", new JavaObjectWrapper(cause));
+            $setAttribute("__cause__", new JavaObjectWrapper(cause));
         }
         return this;
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
         return dict.get(attributeName);
     }
 
     @Override
-    public void __setAttribute(String attributeName, PythonLikeObject value) {
+    public void $setAttribute(String attributeName, PythonLikeObject value) {
         dict.put(attributeName, value);
     }
 
     @Override
-    public void __deleteAttribute(String attributeName) {
+    public void $deleteAttribute(String attributeName) {
         dict.remove(attributeName);
     }
 
     public PythonLikeTuple $getArgs() {
-        return (PythonLikeTuple) __getAttributeOrError("args");
+        return (PythonLikeTuple) $getAttributeOrError("args");
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return type;
     }
 }
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonBoolean.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonBoolean.java
index 346f5644..41baaa85 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonBoolean.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonBoolean.java
@@ -95,13 +95,13 @@ public static boolean isTruthful(PythonLikeObject tested) {
         } else if (tested instanceof Map) {
             return ((Map) tested).size() == 0;
         } else {
-            PythonLikeType testedType = tested.__getType();
-            PythonLikeFunction boolMethod = (PythonLikeFunction) testedType.__getAttributeOrNull("__bool__");
+            PythonLikeType testedType = tested.$getType();
+            PythonLikeFunction boolMethod = (PythonLikeFunction) testedType.$getAttributeOrNull("__bool__");
             if (boolMethod != null) {
                 return isTruthful(boolMethod.$call(List.of(tested), Map.of(), null));
             }
 
-            PythonLikeFunction lenMethod = (PythonLikeFunction) testedType.__getAttributeOrNull("__len__");
+            PythonLikeFunction lenMethod = (PythonLikeFunction) testedType.$getAttributeOrNull("__len__");
             if (lenMethod != null) {
                 return isTruthful(lenMethod.$call(List.of(tested), Map.of(), null));
             }
@@ -119,7 +119,7 @@ public static PythonBoolean valueOf(boolean result) {
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return BuiltinTypes.BOOLEAN_TYPE;
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonFloat.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonFloat.java
index 7980da01..75e424b2 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonFloat.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonFloat.java
@@ -54,8 +54,8 @@ private static PythonLikeType registerMethods() throws NoSuchMethodException {
                 } else if (value instanceof PythonFloat) {
                     return value;
                 } else {
-                    PythonLikeType valueType = value.__getType();
-                    PythonLikeFunction asFloatFunction = (PythonLikeFunction) (valueType.__getAttributeOrError("__float__"));
+                    PythonLikeType valueType = value.$getType();
+                    PythonLikeFunction asFloatFunction = (PythonLikeFunction) (valueType.$getAttributeOrError("__float__"));
                     return asFloatFunction.$call(List.of(value), Map.of(), null);
                 }
             } else {
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonInteger.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonInteger.java
index 942f6ea9..bdbc9173 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonInteger.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonInteger.java
@@ -51,8 +51,8 @@ private static PythonLikeType registerMethods() throws NoSuchMethodException {
                 } else if (value instanceof PythonFloat) {
                     return ((PythonFloat) value).asInteger();
                 } else {
-                    PythonLikeType valueType = value.__getType();
-                    PythonLikeFunction asIntFunction = (PythonLikeFunction) (valueType.__getAttributeOrError("__int__"));
+                    PythonLikeType valueType = value.$getType();
+                    PythonLikeFunction asIntFunction = (PythonLikeFunction) (valueType.$getAttributeOrError("__int__"));
                     return asIntFunction.$call(List.of(value), Map.of(), null);
                 }
             } else {
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/CPythonType.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/CPythonType.java
index 21cebdfe..8f18849c 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/CPythonType.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/CPythonType.java
@@ -44,7 +44,7 @@ private CPythonType(OpaquePythonReference pythonReference) {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
         switch (attributeName) {
             case "__eq__":
                 return cachedAttributeMap.computeIfAbsent(attributeName,
@@ -114,19 +114,19 @@ public PythonLikeObject __getAttributeOrNull(String attributeName) {
     }
 
     @Override
-    public void __setAttribute(String attributeName, PythonLikeObject value) {
+    public void $setAttribute(String attributeName, PythonLikeObject value) {
         cachedAttributeMap.put(attributeName, value);
         CPythonBackedPythonInterpreter.setAttributeOnPythonReference(pythonReference, attributeName, value);
     }
 
     @Override
-    public void __deleteAttribute(String attributeName) {
+    public void $deleteAttribute(String attributeName) {
         cachedAttributeMap.remove(attributeName);
         CPythonBackedPythonInterpreter.deleteAttributeOnPythonReference(pythonReference, attributeName);
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return BuiltinTypes.TYPE_TYPE;
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/JavaObjectWrapper.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/JavaObjectWrapper.java
index 9c301c80..e1b52d8f 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/JavaObjectWrapper.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/JavaObjectWrapper.java
@@ -83,7 +83,7 @@ private Method getGetterMethod(Field field) {
             getterName = (field.getType().equals(boolean.class) ? "is" : "get")
                     + capitalizedName;
         }
-        PythonLikeObject object = type.__getAttributeOrNull(getterName);
+        PythonLikeObject object = type.$getAttributeOrNull(getterName);
         if (object instanceof JavaMethodReference methodReference) {
             return methodReference.getMethod();
         }
@@ -97,7 +97,7 @@ private Method getSetterMethod(Field field) {
                 propertyName.isEmpty() ? "" : propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
         String setterName = "set" + capitalizedName;
 
-        PythonLikeObject object = type.__getAttributeOrNull(setterName);
+        PythonLikeObject object = type.$getAttributeOrNull(setterName);
         if (object instanceof JavaMethodReference methodReference) {
             return methodReference.getMethod();
         }
@@ -234,7 +234,7 @@ public Object getWrappedObject() {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
         Field field = attributeNameToMemberListMap.get(attributeName);
         if (field == null) {
             return null;
@@ -255,7 +255,7 @@ public PythonLikeObject __getAttributeOrNull(String attributeName) {
     }
 
     @Override
-    public void __setAttribute(String attributeName, PythonLikeObject value) {
+    public void $setAttribute(String attributeName, PythonLikeObject value) {
         Field field = attributeNameToMemberListMap.get(attributeName);
         if (field == null) {
             throw new AttributeError("(%s) object does not have attribute (%s)."
@@ -275,12 +275,12 @@ public void __setAttribute(String attributeName, PythonLikeObject value) {
     }
 
     @Override
-    public void __deleteAttribute(String attributeName) {
+    public void $deleteAttribute(String attributeName) {
         throw new IllegalArgumentException("Cannot delete attributes on type '" + objectClass + "'");
     }
 
     @Override
-    public PythonLikeType __getType() {
+    public PythonLikeType $getType() {
         return type;
     }
 
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonLikeFunctionWrapper.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonLikeFunctionWrapper.java
index 7fefa909..a0cf51fc 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonLikeFunctionWrapper.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonLikeFunctionWrapper.java
@@ -33,24 +33,24 @@ public void setWrapped(PythonLikeFunction wrapped) {
         return wrapped.$call(positionalArguments, namedArguments, callerInstance);
     }
 
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
-        return wrapped.__getAttributeOrNull(attributeName);
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
+        return wrapped.$getAttributeOrNull(attributeName);
     }
 
-    public PythonLikeObject __getAttributeOrError(String attributeName) {
-        return wrapped.__getAttributeOrError(attributeName);
+    public PythonLikeObject $getAttributeOrError(String attributeName) {
+        return wrapped.$getAttributeOrError(attributeName);
     }
 
-    public void __setAttribute(String attributeName, PythonLikeObject value) {
-        wrapped.__setAttribute(attributeName, value);
+    public void $setAttribute(String attributeName, PythonLikeObject value) {
+        wrapped.$setAttribute(attributeName, value);
     }
 
-    public void __deleteAttribute(String attributeName) {
-        wrapped.__deleteAttribute(attributeName);
+    public void $deleteAttribute(String attributeName) {
+        wrapped.$deleteAttribute(attributeName);
     }
 
-    public PythonLikeType __getType() {
-        return wrapped.__getType();
+    public PythonLikeType $getType() {
+        return wrapped.$getType();
     }
 
     public PythonLikeObject $method$__getattribute__(PythonString pythonName) {
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonObjectWrapper.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonObjectWrapper.java
index 57abfa58..de047714 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonObjectWrapper.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/wrappers/PythonObjectWrapper.java
@@ -33,20 +33,20 @@ public OpaquePythonReference getWrappedObject() {
     }
 
     @Override
-    public PythonLikeObject __getAttributeOrNull(String attributeName) {
+    public PythonLikeObject $getAttributeOrNull(String attributeName) {
         return cachedAttributeMap.computeIfAbsent(attributeName,
                 key -> CPythonBackedPythonInterpreter.lookupAttributeOnPythonReference($cpythonReference,
                         attributeName, $instanceMap));
     }
 
     @Override
-    public void __setAttribute(String attributeName, PythonLikeObject value) {
+    public void $setAttribute(String attributeName, PythonLikeObject value) {
         cachedAttributeMap.put(attributeName, value);
         CPythonBackedPythonInterpreter.setAttributeOnPythonReference($cpythonReference, attributeName, value);
     }
 
     @Override
-    public void __deleteAttribute(String attributeName) {
+    public void $deleteAttribute(String attributeName) {
         cachedAttributeMap.remove(attributeName);
         CPythonBackedPythonInterpreter.deleteAttributeOnPythonReference($cpythonReference, attributeName);
     }
@@ -63,7 +63,7 @@ public int compareTo(PythonObjectWrapper other) {
             return 0;
         }
 
-        PythonLikeFunction lessThan = (PythonLikeFunction) __getType().__getAttributeOrError("__lt__");
+        PythonLikeFunction lessThan = (PythonLikeFunction) $getType().$getAttributeOrError("__lt__");
         PythonLikeObject result = lessThan.$call(List.of(this, other), Map.of(), null);
 
         if (result instanceof PythonBoolean) {
@@ -73,8 +73,8 @@ public int compareTo(PythonObjectWrapper other) {
                 return 1;
             }
         } else {
-            throw new NotImplementedError("Cannot compare " + this.__getType().getTypeName() +
-                    " with " + other.__getType().getTypeName());
+            throw new NotImplementedError("Cannot compare " + this.$getType().getTypeName() +
+                    " with " + other.$getType().getTypeName());
         }
     }
 
@@ -87,7 +87,7 @@ public boolean equals(Object o) {
             return false;
         }
         PythonObjectWrapper other = (PythonObjectWrapper) o;
-        Object maybeEquals = __getType().__getAttributeOrNull("__eq__");
+        Object maybeEquals = $getType().$getAttributeOrNull("__eq__");
         if (!(maybeEquals instanceof PythonLikeFunction)) {
             return super.equals(o);
         }
@@ -101,7 +101,7 @@ public boolean equals(Object o) {
 
     @Override
     public int hashCode() {
-        Object maybeHash = __getType().__getAttributeOrNull("__hash__");
+        Object maybeHash = $getType().$getAttributeOrNull("__hash__");
         if (!(maybeHash instanceof PythonLikeFunction)) {
             return super.hashCode();
         }
@@ -121,7 +121,7 @@ public int hashCode() {
 
     @Override
     public String toString() {
-        Object maybeStr = __getType().__getAttributeOrNull("__str__");
+        Object maybeStr = $getType().$getAttributeOrNull("__str__");
         if (!(maybeStr instanceof PythonLikeFunction)) {
             return super.toString();
         }
diff --git a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/util/StringFormatter.java b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/util/StringFormatter.java
index 46e94ed5..d07da993 100644
--- a/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/util/StringFormatter.java
+++ b/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/util/StringFormatter.java
@@ -273,7 +273,7 @@ private static String performInterpolateConversion(String flags, Optional precision + 1)
@@ -337,7 +337,7 @@ private static String performInterpolateConversion(String flags, Optional precision + 1)
@@ -352,7 +352,7 @@ private static String performInterpolateConversion(String flags, Optional