Skip to content

Latest commit

 

History

History
36 lines (36 loc) · 1.99 KB

python reserved keywords.md

File metadata and controls

36 lines (36 loc) · 1.99 KB
  1. and -> Logical AND operator
  2. as -> Used to create an alias
  3. assert -> Used for debugging
  4. async -> The async keyword is put in front of a function declaration to turn it into an asynchronous function.
  5. await -> The await keyword can be put in front of any async coroutine-based function to pause your code on that line until the coroutine fulfills. Then, return the resulting value.
  6. break -> Used to break out of a loop
  7. class -> Used to create a class
  8. continue -> Used to continue to the next iteration of a loop
  9. def -> Used to create a function
  10. del -> Used to delete an object
  11. elif -> Used in conditional statements, same as else if
  12. else -> Used in conditional statements - if
  13. except -> Used with exceptions, what to do when an exception occurs
  14. finally -> Used with exceptions, what to do when none of the specified exceptions solved
  15. for -> Used to create a for loop
  16. from -> Used to import specific parts of a module
  17. global -> Used to declare a global variable
  18. if -> Used to define a conditional statement
  19. import -> Used to import a module
  20. in -> Used to check if a value is present in a list, tuple, etc.
  21. is -> Used to test if two variables are equal
  22. lambda -> Used to create an anonymous function
  23. None -> Used to represent a NULL value
  24. nonlocal -> Used to declare a non-local variable
  25. not -> Logical NOT operator
  26. or -> Logical OR operator
  27. pass -> A null statement, a statement that will do nothing
  28. raise -> Used to raise an exception
  29. return -> Used to exit a function and return a value
  30. try -> Used to make a try...except statement in exception handling
  31. while -> Used to create a while loop
  32. with -> Used to simplify exception handling
  33. yield -> Used to end a function, returns a generator
  34. False-> Boolean value False
  35. True -> Boolean value True
  36. peg_parser -> It was an easter egg related to the rollout of the new PEG parser. The easter egg, along with the old LL(1) parser, will be removed in 3.10.