Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
62956963
Commit
62956963
authored
Nov 03, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example for methods and fields
parent
420d71ea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
typon/trans/tests/pyext.post.py
typon/trans/tests/pyext.post.py
+4
-1
typon/trans/tests/pyext.py
typon/trans/tests/pyext.py
+6
-3
No files found.
typon/trans/tests/pyext.post.py
View file @
62956963
import
pyext
print
(
"Imported:"
,
pyext
.
add
(
5
,
3
),
pyext
.
fibo
(
10
),
pyext
.
squares
(),
pyext
.
Person
(
"jean"
,
123
))
\ No newline at end of file
p
=
pyext
.
Person
(
"jean"
,
123
)
print
(
"Imported:"
,
pyext
.
add
(
5
,
3
),
pyext
.
fibo
(
10
),
pyext
.
squares
(),
p
)
print
(
p
.
afficher
(
"Bonjour"
))
print
(
p
.
name
,
p
.
age
)
\ No newline at end of file
typon/trans/tests/pyext.py
View file @
62956963
...
...
@@ -9,8 +9,9 @@ class Person:
name
:
str
age
:
int
def
afficher
(
self
):
print
(
self
.
name
,
self
.
age
)
def
afficher
(
self
,
msg
:
str
):
print
(
msg
,
","
,
self
.
name
,
self
.
age
)
return
123
def
add
(
x
,
y
):
return
x
+
y
...
...
@@ -25,4 +26,6 @@ def squares() -> list[int]:
return
np
.
square
([
x
for
x
in
range
(
5
)])
if
__name__
==
"__main__"
:
print
(
"Python:"
,
add
(
5
,
3
),
fibo
(
10
),
squares
(),
Person
(
"jean"
,
123
))
\ No newline at end of file
p
=
Person
(
"jean"
,
123
)
print
(
"Python:"
,
add
(
5
,
3
),
fibo
(
10
),
squares
(),
p
)
p
.
afficher
(
"Bonjour"
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment