Chapter 10, Basic Networking – Socket Programming

  1. Socket programming involves writing computer programs that enable processes to communicate with each other across a computer network.
  2. In distributed computing, a remote procedure call is when a computer program causes a procedure to execute in a different address space, which is coded as if it were a normal procedure call, without the programmer explicitly coding the details for the remote interaction.
  3. Following is the answer:
import filename (import file)
from filename import function1 (import specific function)
from filename import function1, function2(import multiple functions)
from filename import * (import all the functions)
  1. The main difference between lists and a tuples is the fact that lists are mutable whereas tuples are immutable. A mutable data type means that a Python object of this type can be modified. Immutable means that a Python object of this type cannot be modified.
  2. You can't have a dict with duplicate keys, because in the backend it uses an hashing mechanism.
  3. urllib and urllib2 are both Python modules that perform URL request related stuff but offer different functionalities.
    urllib2 can accept a request object to set the headers for a URL request, urllib accepts only a URL. Python requests encode the parameters automatically so you just pass them as simple arguments.