- Write functions() in lower case, KEYWORDS in upper.
START
each keyword clause
ON
a new line.- Use either
camelCase
orsnake_case
for node identifiers but be consistent. - Relationship type names should use
UPPER_CASE_AND_UNDERSCORES
. - Label names should use
CamelCaseWithInitialCaps
. MATCH (clauses)-->(should)-->(always)-->(use)-->(parentheses)-->(around)-->(nodes)
- Backticks `cân éscape odd-ch@racter$ & keyw0rd$` but should be a code smell.
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
try: | |
unicode | |
except NameError: | |
# Python 3 | |
def ustr(s, encoding="utf-8"): | |
if isinstance(s, str): | |
return s | |
try: | |
return s.decode(encoding) | |
except AttributeError: |
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
def is_collection(obj): | |
""" Returns true for any iterable which is not a string or byte sequence. | |
""" | |
try: | |
if isinstance(obj, unicode): | |
return False | |
except NameError: | |
pass | |
if isinstance(obj, bytes): | |
return False |
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
from itertools import cycle, islice | |
def round_robin(*iterables): | |
""" Cycle through a number of iterables, returning | |
the next item from each in turn. | |
round_robin('ABC', 'D', 'EF') --> A D E B F C | |
Original recipe credited to George Sakkis | |
Python 2/3 cross-compatibility tweak by Nigel Small |
NewerOlder