File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
PythonForDelphi/Components/Sources/Core Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -97,10 +97,14 @@ function NewPythonList( const ASize : Integer = 0 ): Variant;
9797function NewPythonTuple ( const ASize : Integer ): Variant;
9898function NewPythonDict : Variant;
9999
100+ // Not really needed since you can assign a PythonVariant to a string anyway
101+ // but it is slightly faster and in some places avoids the declaration of a variable
102+ function VarPythonAsString (AValue : Variant) : string;
103+
100104function None : Variant;
101105function Ellipsis : Variant;
102106function MainModule : Variant; // return the main module that's used for executing a script.
103- function BuiltinModule : Variant; // return the builtin module
107+ function BuiltinModule : Variant; // return the builtin module
104108function SysModule : Variant; // return the builtin module 'sys'
105109function DatetimeModule : Variant; // return the builtin module 'datetime'
106110function Import ( const AModule : AnsiString ) : Variant; // import a Python module and return the module object.
@@ -636,6 +640,15 @@ function NewPythonDict: Variant;
636640 end ; // of with
637641end ;
638642
643+ function VarPythonAsString (AValue : Variant) : string;
644+ begin
645+ if VarIsPython(AValue) then
646+ Result := TPythonVarData(AValue).VPython.AsString
647+ else
648+ Result := AValue;
649+ end ;
650+
651+
639652function None : Variant;
640653begin
641654 with GetPythonEngine do
You can’t perform that action at this time.
0 commit comments