Skip to content

Instantly share code, notes, and snippets.

@agritheory
Last active May 26, 2022 21:53
Show Gist options
  • Save agritheory/8d76913e59ed7f0ed0e527a094add6c3 to your computer and use it in GitHub Desktop.
Save agritheory/8d76913e59ed7f0ed0e527a094add6c3 to your computer and use it in GitHub Desktop.
In [1]: simple_dictionary = {'celtics': "Let's go", 'heat': 'Beat the'}
In [2]: simple_dictionary.get('la')
In [3]: simple_dictionary.get('la', '!!!')
Out[3]: '!!!'
In [4]: frappe_dictionary = frappe._dict({'celtics': "Let's go", 'heat': 'Beat the'})
In [5]: frappe_dictionary.get('la')
In [6]: frappe_dictionary.get('la', '!!!')
Out[6]: '!!!'
In [7]: class MyClass():
...: an_attribute: ""
...:
In [8]: mc = MyClass()
In [9]: mc.an_attribute = 'Celtics'
In [10]: mc.an_attribute
Out[10]: 'Celtics'
In [11]: mc.get('la')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
----> 1 mc.get('la')
AttributeError: 'MyClass' object has no attribute 'get'
In [13]: sales_stage = frappe.new_doc('Sales Stage')
In [14]: sales_stage.get
Out[14]: <bound method BaseDocument.get of <SalesStage: unsaved>>
In [15]: help(sales_stage.get)
# get(key=None, filters=None, limit=None, default=None) method of erpnext.crm.doctype.sales_stage.sales_stage.SalesStage instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment