This file contains hidden or 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
""" | |
>>> class Example(object): | |
... @private | |
... def private_method(self): | |
... print 'method privated called' | |
... | |
... def public_method(self): | |
... self.private_method() | |
... print 'method public called' |
This file contains hidden or 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
''' | |
>>> class Pessoa(object): | |
... filho_de = None | |
... filhos = [] | |
... | |
>>> class Joao(Pessoa): | |
... pass | |
>>> Joao.filhos |
This file contains hidden or 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
=====buildout.cfg====== | |
[buildout] | |
directory = hello_world.py | |
======================= | |
=====hello_world.py==== | |
print 'hello world' | |
======================= |
This file contains hidden or 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
''' | |
The BNF for this small infix calculator looks like: | |
<expr> ::= <num> | |
| (<num>) | |
| (+ <expr> <expr>) | |
| (- <expr> <expr>) | |
| (* <expr> <expr>) | |
| (/ <expr> <expr>) | |
| (^ <expr> <expr>) |
This file contains hidden or 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
''' | |
>>> calcular('1') | |
1 | |
>>> calcular('(+ 1 2)') | |
3 | |
''' | |
from pyparsing import Word, White, nums, Literal, OneOrMore, Group |
This file contains hidden or 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
''' | |
>>> calcular('1') | |
1 | |
>>> calcular('(+ 1 2)') | |
3 | |
>>> calcular('(+ (- 1 2) 3)') | |
2 |
This file contains hidden or 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
#lang scheme | |
; http://pheattarchive.emporia.edu/courses/2002/cs220f02/anotherSchemeTtutorial/excercises.htm | |
; Exercise 1: | |
; Write a recursive procedure (positions 1st e) which returns a list of numbers corresponding | |
; to the position of every occurrence of element e in the list 1st. | |
; Assume the first element of the list is element 0. For example: | |
; (positions '(a b f b a f b b) 'b) ==> (1 3 6 7) | |
; | |
; hint: use a helper function |
This file contains hidden or 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
# estrutura de pastas: | |
# foo | |
# | abc.py | |
# |-- bar | |
# | |-- xyz.py | |
# imagine que o diretório atual é bar e você quer importar abc | |
import sys | |
import os |
This file contains hidden or 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
# coding: utf-8 | |
import os | |
import sys | |
import time | |
def clear_screen(): | |
clear = sys.platform == 'win32' and 'cls' or 'clear' | |
os.system(clear) | |
bonecos = [(r""" |
This file contains hidden or 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
[extensions] | |
extdiff = | |
fetch = | |
rebase = | |
mq = | |
histedit = /usr/bin/histedit.py | |
pager = | |
transplant = | |
graphlog = | |
bookmarks = |
OlderNewer