I opened .py
file to edit in SublimeText project. Inported library (from django import db
)
and wrote db.
to show autocompletion. But nothing happens.
""" | |
2015 year calculations. | |
>>> # we missing 32 in this year pow(2,5) | |
>>> pow(2,5) | |
32 | |
>>> 1024+512+256+128+64+0+16+8+4+2+1 | |
2015 | |
>>> bin(2015) | |
'0b11111011111' |
$ brew config | |
HOMEBREW_VERSION: 0.9.5 | |
ORIGIN: https://github.com/Homebrew/homebrew | |
HEAD: dcb3cf09cba68f891bb8eda4b1735b50996a85b9 | |
Last commit: 6 hours ago | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_REPOSITORY: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com | |
CPU: quad-core 64-bit ivybridge |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
def get_prime_number(index): | |
''' | |
Return prime number by given index. | |
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. | |
Args: |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
class Singleton(type): | |
def __call__(self, *args, **kwargs): | |
if 'instance' not in self.__dict__: | |
self.instance = super(Singleton, self).__call__(*args, **kwargs) | |
return self.instance | |
def login_required(function=None, message=None): | |
""" | |
Decorator for views that checks that the user is logged in, | |
or show error page with message. | |
>>> We can use any of this forms of decorator: | |
>>> | |
>>> # 1. without parameters | |
>>> @login_required | |
>>> def my_function(request): |
''' | |
My example of code for Django project | |
See also my Open Source project here: https://github.com/1st/django-startup | |
@author Anton Danilchenko <anton.danilchenko@me.com> | |
''' | |
# app_name/urls.py |
echo @У-И. *УЙЛO | tr '@-.:%*' ПTHTHX |
class A(object): | |
def aa(self): | |
print 'in A' | |
return self.__class__.__name__ | |
class B(A): | |
def bb(self): | |
print 'in B' | |
return super(B, self).aa() |