OCU Test Review Flashcards
(20 cards)
What is a namespace in Python?
A logical container for objects
What are some common pythonic expressions?
lambda functions, list comprehensions, generator expressions, unpacking function arguments, etc. (anything from Chapter 5)
Is datetime built in to python or does it require a module to use?
It requires a module - date, time, datetime, calendar
True or False: Code is read more often than it is written
True! - from the BDFL (Guido van Rossum) himself.
What is a Python decorator?
A function that modifies other functions.
How can you make a class inherit from another class?
Import the base class in the sub-class file Add the base class to the constructor of the sub-class Use base class data in the subclass file
Which function helps a sub class inherit the constructor of the base class?
super()
A class method takes the parameter(s):
(cls)
Doctrings and comments should be used:
To explain HOW and WHY the code works
Can you look at metadata using Python?
Yes! Metaprogramming!
Does every method in your class need to have a decorator?
No! Decorators are functions that modify other functions. If they don’t need to be modified, you don’t need a decorator!
True or False: There is no support for third party libraries in Python
FALSE - pypi.org!
Can subclasses inherit from multiple base classes in Python?
Yes! Multiple inheritance - method resolution order helps!
Which module(s) help with testing?
pytest, unittest
What does the DBAPI do?
The DBAPI standardizes interaction with DBMSystems
Are there GUI frameworks for Python?
Yes! PyQt5 was the one we saw.
What are some ways to support concurrency in Python?
Threading, multiprocessing, async
Does python support asynchronous programming?
Yes! Async is available.
Can you set different alert levels for logging?
Yes! Info - Warning - Critical!
Are there separate modules for XML and JSON support in Python?
Yes!
XML - xml
JSON - json