Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only create wrappers for methods with a legal Python name
^methods nowadays lists
	-> (Mu:D \fles: *%_) { #`(Method+{<anon>}|109046056) ... }
which obviously cannot be used as a method name in Python.

Since a Perl 6 subclass of a Python class may want to use names that
would not be legal in Python (e.g. hypenated-names), it's good to filter
those anyway.
  • Loading branch information
niner committed Apr 28, 2015
1 parent b45abdf commit 9838e88
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/Inline/Python.pm6
Expand Up @@ -379,6 +379,7 @@ method create_subclass(Str $package, Str $class, Str $subclass_name) {
my $subclass = ::($subclass_name);
my $methods = $subclass\
.^methods\
.grep({$_.gist ~~ /^\w+$/})\
.map({" def {$_.gist}(self, *args): return perl6.invoke(self.__p6_index__, '{$_.gist}', args)"})\
.join("\n");
my $baseclass_name = $package eq '__main__' ?? $class !! "$package.$class";
Expand Down

0 comments on commit 9838e88

Please sign in to comment.