This repository was archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Correctif n°1 #145
Open
MarcFriedli
wants to merge
4
commits into
HE-Arc:master
Choose a base branch
from
MarcFriedli:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+50
−50
Open
Correctif n°1 #145
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d377328
Correctif n°1 : ajout du lien vers la documentation officielle de pyt…
MarcFriedli de7556e
modification d'une partie du texte d'introduction : suppression de la…
MarcFriedli f8f79f2
Modification du texte, suppression de parties ineptes, ajout d'une pa…
MarcFriedli 199ba0f
Correctif : oubli de guillemets.
MarcFriedli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
modification d'une partie du texte d'introduction : suppression de la…
… partie concernant java car j'étais parti sur une mauvaise base. Remplacement par un texte indiquant que les dunders sont privés. Modification de la fonction ajouter de la classe Main pour utiliser un dunder
commit de7556e869bbbb69e659405e9ff3f4d26970b22c
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,19 @@ Introduction | |
|
||
Le mot dunder est un raccourci de *Double UNDERscore* et représente toutes les méthodes Python qui commencent et finissent par un double underscore (par ex. ``__init__()``). | ||
|
||
Les dunders sont des méthodes très puissantes et régulièrement utilisées en python. Ce sont des méthodes universelles que toute classe possède (un peu à l'image de la class Object dans Java). | ||
Les dunders sont des méthodes très puissantes et régulièrement utilisées en python. Un dunder est toujours une méthode privée appartenant à une classe. La particularité de ces méthodes et qu'elles ne sont jamais directement appelées mais toujours implicitement ou explicitement | ||
|
||
.. Quel lien entre Object de Java et les dunders? | ||
|
||
Cependant, dans python, les dunders sont rarement appelés directement. | ||
|
||
.. todo:: Un peu imprécis car il n'y a pas que des méthodes. ``__name__`` ou ``__file__`` | ||
|
||
Par exemple : | ||
par exemple : | ||
|
||
.. code-block:: python3 | ||
|
||
toto = new MyClass() | ||
x = MyClass() #fera appel au dunder __init__() de la classe MyClass | ||
str(x) #fera appel au dunder __str__() de la classe MyClass | ||
str(12) #fera appel au dunder __str__() de la classe Integer | ||
|
||
|
||
fera appel aux méthodes ``__new__()`` et ``__init__()`` même si ces méthodes n'ont pas été surchargées. | ||
.. todo:: Un peu imprécis car il n'y a pas que des méthodes. ``__name__`` ou ``__file__`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.. c'est un peu la base de la programmation orienté objet... | ||
|
||
Les dunders ont des méthodes raccourci qui vont directement les appeler (autre raison pour laquelle on utilise régulièrement les dunders sans s'en rendre compte) : | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fatigue + traduction approximative = phrase incorrecte... Mille excuses, je n'aurai pas dû push ces inepties.
J'ai juste une question concernant votre review sur les méthodes privées. Est-ce que vous entendez par là qu'une méthode __myMethod(self) sera privée et (presque) inaccessible hors de sa classe ? Ou il y a quelque chose qui concerne plus les dunders que je suis censé trouvé ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_method
et__method
sont des conventions oui.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sinon, pas de problème prenez votre temps et faites tous les pushes que vous voulez. Dites-moi quand vous estimez que c'est bon.