Does WiFiClient work on a Yún to send data over a certain IP and port to be received by a Python socket?
No, that code is only for the WiFi shield.  For the Yun you need to look at the Bridge library that is bundled with the IDE. It allows you to run commands and perform actions on the Linux based Atheros portion of the Yun which is what has access to the WiFi.