That would not be well defined for an arbitrary function space (consider DG spaces for example). However, for other spaces I guess you could define it through something like this (not very effective though):
from dolfin import *
mesh = UnitCubeMesh(4,4,4)
mesh.init(3,2)
V = FunctionSpace(mesh, "CG", 2)
D = mesh.topology().dim()
dm = V.dofmap()
facet_dofs = [None]*mesh.num_facets()
for cell_idx in xrange(mesh.num_cells()):
cell = Cell(mesh, cell_idx)
facets = cell.entities(D-1)
for local_facet_idx, global_facet_idx in enumerate(facets):
local_facet_dofs = dm.tabulate_facet_dofs(local_facet_idx)
facet_dofs[global_facet_idx] = dm.cell_dofs(cell_idx)[local_facet_dofs]
print facet_dofs