Created
February 8, 2018 19:01
-
-
Save rafaelbeirigo/2258cdbb0bda40974701d0cf9888b476 to your computer and use it in GitHub Desktop.
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
(defvar my/skeleton-python-property-list-a) | |
(defvar my/skeleton-python-property-list-b) | |
(defvar my/skeleton-python-property-list-c) | |
(define-skeleton my/skeleton-python-class | |
"Skeleton for a class in Python." | |
"Class name: " | |
> "class " str | |
"(" | |
((skeleton-read "Base class: ") str ", ") | |
& (nil nil -2 ")") | |
| (nil nil -1) | |
":"\n | |
> "def __init__(self, " | |
(setq my/skeleton-python-property-list-a nil) | |
(setq my/skeleton-python-property-list-b nil) | |
(setq my/skeleton-python-property-list-c nil) | |
((skeleton-read "Property: ") str & ", " | |
'(push str my/skeleton-python-property-list-a)) | |
-2 "):" | |
;; reverse list | |
'(while (setq a (pop my/skeleton-python-property-list-a)) | |
(progn (push a my/skeleton-python-property-list-b) | |
(push a my/skeleton-python-property-list-c))) | |
((pop my/skeleton-python-property-list-b) | |
\n > "self._" str " = " str) | |
\n "pass" | |
\n | |
((pop my/skeleton-python-property-list-c) | |
\n "@property" | |
\n "def " str "(self):" | |
\n "return self._" str | |
\n | |
\n "@" str ".setter" | |
\n "def " str "(self, value):" | |
\n "self._" str " = value" | |
\n "pass" | |
\n | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment