The new Pi 3 has built in Wifi, great! But it'll never be as good as a USB adapter with proper antenna, although it might often be sufficient.
Out of the box, if I connect it to wifi using the onboard adapter and then add a second USB adapter is connects the second one in tandem (ie both connect to the same network and get distinct IP addresses via DHCP). This is a waste of DHCP allocation resources and (correct me if I'm wrong) could cause routing issues?
What I'd like is to have the Pi use the built in adapter if that's the only one present but switch to the added adapter if one is present (and working[1]), switching back to the on-board one otherwise.
None of this is Pi-specific of-course, the same would apply to any laptop with built in adapter where an additional dongle might be used periodically. However my Googling has so far only thrown up more permanent solutions, and not automatic switching between them.
[1] Ideally it would fail over to the onboard adapter if the USB one wasn't reliable, but I'd settle for it always using USB if present, and onboard otherwise.
I'm guessing I should be able to detect the arrival/departure of wlan1 and use it to enable/disable wlan0?