Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
transaction
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
transaction
Commits
50faa092
Commit
50faa092
authored
Nov 08, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed decorator examples to emphasize the fact that functions are acting as anonymous functions.
parent
18c662e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
docs/convenience.rst
docs/convenience.rst
+6
-5
No files found.
docs/convenience.rst
View file @
50faa092
...
...
@@ -79,25 +79,26 @@ The first helper runs a function as a transaction::
Of course you can run this as a decorator::
@transaction.manager.run
def
do_somthing
():
def
_
():
"Do something"
... some something ...
Some people find this easier to read, even though the result isn't a
decorated function, but rather the result of calling it in a
transaction.
transaction. The function name, ``_`` is used here to emphasize that
the fuction is essentially being used as an anonymous function.
The run method returns the successful result of calling the function.
The function name
and docstring, if any, are added to the transaction
description.
The function name
(if it isn't ``'_'``) and docstring, if any, are
added to the transaction
description.
You can pass an integer number of times to try to the ``run`` method::
transaction.manager.run(do_somthing, 9)
@transaction.manager.run(9)
def
do_somthing
():
def
_
():
"Do something"
... some something ...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment