Skip to content

Instantly share code, notes, and snippets.

"""
>>> class Example(object):
... @private
... def private_method(self):
... print 'method privated called'
...
... def public_method(self):
... self.private_method()
... print 'method public called'
'''
>>> class Pessoa(object):
... filho_de = None
... filhos = []
...
>>> class Joao(Pessoa):
... pass
>>> Joao.filhos
=====buildout.cfg======
[buildout]
directory = hello_world.py
=======================
=====hello_world.py====
print 'hello world'
=======================
'''
The BNF for this small infix calculator looks like:
<expr> ::= <num>
| (<num>)
| (+ <expr> <expr>)
| (- <expr> <expr>)
| (* <expr> <expr>)
| (/ <expr> <expr>)
| (^ <expr> <expr>)
'''
>>> calcular('1')
1
>>> calcular('(+ 1 2)')
3
'''
from pyparsing import Word, White, nums, Literal, OneOrMore, Group
'''
>>> calcular('1')
1
>>> calcular('(+ 1 2)')
3
>>> calcular('(+ (- 1 2) 3)')
2
#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
# 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
# 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"""
[extensions]
extdiff =
fetch =
rebase =
mq =
histedit = /usr/bin/histedit.py
pager =
transplant =
graphlog =
bookmarks =