Setting in memory workspace in ArcPy?

I'm going to throw an answer on here because both answers thus far aren't 100% correct.

There are 2 items which can vary from tool to tool.

  1. if it honors the workspace environment (this item is always documented on the tool help page)
  2. if it can make use of the in_memory workspace (this item may not be explicitly documented. You're more likely to see a note if it DOES NOT support in_memory)

To simply answer the "can you set the environment workspace to in_memory". The answer is YES.

>>> import arcpy
>>> arcpy.env.workspace = r"in_memory"
>>> arcpy.CopyFeatures_management(r"c:\temp\foo.shp", "myinmemoutput")
<Result 'in_memory\\myinmemoutput'>
>>> arcpy.Exists("myinmemoutput")
True

Snap Pour Point does honor the workspace environment per it's documentation and explained Python samples. And a test shows you can write output to in_memory and work with that variable reference...to put into another tool, or save the result

>>> import arcpy
>>> arcpy.env.workspace = r"in_memory"
>>> arcpy.CheckOutExtension("SPATIAL")
u'CheckedOut'
>>> snapOut = arcpy.sa.SnapPourPoint("e:/gpservices101/hydro/US30m/test.gdb/sourcepoint", "e:/gpservices101/hydro/US30m/Region08a/Input/elev_cm", 1,"PourPtID")
>>> snapOut
in_memory\SnapPou_sour1
>>> arcpy.Exists(snapOut)
True
>>> snapOut.save(r"c:\temp\todisk.tif")
>>> arcpy.Exists(r"c:\temp\todisk.tif")
True