This is not supposed to work as you expect. Edit mode is for working with  geometry or data of selected object(s), object mode is for working with the objects in the scene. You can hide and show objects in object mode, and in edit mode you hide or show components of the objects like vertices, edges and faces. Modes are supposed to separate functionality like this for a single object or for multiple objects in the scene.

The operator to show hidden objects actually works from edit mode fine, so no need to wite any scripts actually, you could make a hotkey. In order to do so, you can go to User Preferences(<kbd>  F4  </Kbd> -> <Kbd>  P  </kbd>), Keymap tab, then navigate to 3d View Mesh, Mesh(Global) section: 

[![enter image description here][1]][1]

Then add a new hotkey there for `object.hide_view_clear`
[![enter image description here][2]][2]
 You can set any key, but I set <kbd> Ctrl </Kbd> + <Kbd> Alt </Kbd> + <Kbd> Shift </Kbd> + <Kbd> H </kbd>, since that is not used and sort of makes sense.  You will be able to show hidden form edit mode then, but for full hiding functionality you need to be able to select objects in object mode. 

And by the way, if you are wondering how one finds out about what command to use, I just checked the Info editor after performing the command in the viewport: 

[![enter image description here][3]][3]


  [1]: https://i.sstatic.net/iBVRa.png
  [2]: https://i.sstatic.net/cJ4zL.png
  [3]: https://i.sstatic.net/WHj7X.png