Keywords

25 tutorials Updated 23 Sep 2019

  1. 1 The "and" keyword in Python The "and" keyword in Python implements the logical "AND" operator. It returns the first operand if it is False else the second operand. 20 Dec 2017
  2. 2 As keyword in Python The As keyword in Python is used in import statement to bind a name to a module name, in with statements to name the resource and in except clause 23 Dec 2017
  3. 3 The assert keyword in Python assert is a keyword in Python.The assert() statement accepts a Boolean Condition as its parameter and halts the execution with an AssertionError if the expression evaluates to False. 26 Dec 2017
  4. 4 break keyword in Python break is a keyword in Python. The break statement makes execution to move to the next enclosing block. A sample python program using break is provided. 27 Dec 2017
  5. 5 Class keyword in Python The class keyword in Python is used to represent a concept. A concept or a class in object oriented paradigm is created using the class keyword. 23 Nov 2017
  6. 6 def keyword in Python The def keyword in Python is used for defining a global function, a class method, a special class method like __init__ of a class. 24 Nov 2017
  7. 7 del keyword in Python The del keyword removes a name from local scope, global scope, removes one or more attributes from a class instance, removes elements from iterables. The Python examples remove names from various scopes and try accessing the same names again, printing the resulting NameError and AttributeError. 11 Sep 2019
  8. 8 else keyword in exception handling The else keyword in Python in the context of exception handling is provided for the no exception, no return, no continue and no break scenario.For the try block else block is an optional one. 23 May 2019
  9. 9 except keyword The except key word marks an exception handler for one of the exceptions a try block is enclosed for. After handling an exception, program continues after the try block. 21 May 2019
  10. 10 The False keyword in python The False keyword in Python represents the negative truth value of Boolean logic and it belongs to the type bool. 19 Jan 2017
  11. 11 The "finally" keyword in Python The "finally" keyword in Python marks the cleanup code after the try block. The "finally" block is executed after the execution of except and else handlers. The Python example explains how resource leakages are prevented with finally blocks. 22 May 2019
  12. 12 global keyword in Python The global keyword in Python allows a name in an inner scope to be bound with the global scope. The Python example code demonstrates a scenario with and without using the global keyword. 12 Sep 2019
  13. 13 import keyword in Python The import keyword uses Python's module import mechanism to load a module. Once a module is loaded, it binds the name of the module to the current scope. The whole namespace provided by the module can be accessed using the module name. 19 Sep 2019
  14. 14 Lambda functions in Python Lambda functions in Python anonymous function objects that are created by the lambda expressions through the keyword lambda. An anonymous function does not have a name. Lambda expressions are useful for writing small functions which are useful in narrow contexts. 8 Sep 2019
  15. 15 The None keyword in Python The keyword None in Python is used to represent absence of value in an identifier. None is the only value of type NoneType in Python. 19 Jan 2017
  16. 16 The nonlocal keyword in Python The nonlocal keyword in Python binds a name to the outer scope. If the outer scope does not have the name present, it will resolve to the next outer scope. 12 Sep 2019
  17. 17 The not keyword in Python The not keyword in python implements the negation or logical complement. If the operand is True it returns False and returns True otherwise.Example and Output is Provided. 23 Dec 2017
  18. 18 The "or" keyword in Python The "or" keyword in Python implements the logical OR operator. The "or" operator returns True, if at least one of the operands evaluate to True. Examples are given with output. 23 Dec 2017
  19. 19 pass statement pass statement in Python acts as a place holder while defining blocks for if, for, while, function definitions. pass does not execute anything and it is not a comment. 16 Mar 2017
  20. 20 raise keyword in Python The raise keyword in python is used to programmatically generate an exception to indicate an error condition. The generated exception is handled by a matching except handler. 21 May 2019
  21. 21 Return Statement In Python The return statement in Python returns controls to the enclosing function with or without a value.Multiple examples are provided for the return statement. 20 Dec 2017
  22. 22 True keyword True keyword in python is a constant that represents the true value of the python bool type. Any expression that does not evaluate to False will return True. 16 Mar 2017
  23. 23 try statement in Python In Python try statement encloses a block of code for which exception handling needs to be provided. The try block typically is followed by a set of except blocks and an optional finally block. 20 May 2019
  24. 24 with statement in Python The with keyword enables python code to use a context manager as supported by the Python Programming language. The expression after the with statement returns the context and assigns it to an assignment target after the as keyword(if one is specified). 23 Sep 2019
  25. 25 Yield statement in Python The yield in python makes a function a generator function.A generator function return a generator iterator that return a value when __next__() is called. 8 Mar 2017