Wikipedia:Reference desk/Archives/Computing/2021 February 18

= February 18 =

Tuples being immutable
With this code:

oldies = (122,125,116,114,119) oldies = oldies[2:] print(oldies)

I get "(116,114,119)" for my output, but I thought that tuples are supposed to be immutable? Or would this count as a replacement of a tuple rather than as an edit of a tuple, thus making it allowed whereas edits of tuples are NOT allowed? Futurist110 (talk) 04:17, 18 February 2021 (UTC)
 * You're replacing the reference to the tuple, not the tuple itself. You can't edit the tuple itself but you can replace it outright because you're not using the same tuple. Python has no typing, only optional type hints, so variable references can be modified to anything. WhoAteMyButter ( 📨 │ 📝 ) 04:56, 18 February 2021 (UTC)
 * To elaborate on the likely source of confusion: is always a valid Python assignment, which replaces (rebinds?) the name foo to the value.  is somewhat similar, assuming some_sequence[index] is valid. foo[index] = some_value superficially looks similar but is in fact very different; it tries to change the value referenced by foo without rebinding.  Tigraan Click here to contact me 09:22, 18 February 2021 (UTC)
 * As "proof" of how this works, you can display  before and after the second assignment, and you'll see that it changes, meaning that   has become a different object. In contrast, if   was an array and you made the assignment   then the id would remain the same. AndrewWTaylor (talk) 11:41, 18 February 2021 (UTC)

Windows 10 not showing battery percentage for Bluetooth headphones.
From recent days, Windows 10 not showing battery percentage for Bluetooth headphones. How to fix this? Rizosome (talk) 12:11, 18 February 2021 (UTC)
 * I didn't realize bluetooth headphones report their battery status to the computer. With the old-style BT earpiece and speaker that I use, the computer just doesn't know the device's charge level.  Instead, an LED on the device starts blinking when it needs a recharge.  I wonder if the BT profiles for those devices even give it a way to report the battery level. Has anyone ever seen anything like that? 2601:648:8200:970:0:0:0:C942 (talk) 22:36, 18 February 2021 (UTC)
 * Battery level reporting is optional for bluetooth devices, so it varies from device to device. If the headphones used to show a percentage, and don't anymore, that's a problem with the headphones (broken bluetooth comms?) WhoAteMyButter ( 📨 │ 📝 ) 04:52, 19 February 2021 (UTC)

so there is no fix? Rizosome (talk) 05:46, 19 February 2021 (UTC)
 * Try with another pair of headphones that supports battery reporting. If it still doesn't work, it's an issue with Windows 10. WhoAteMyButter ( 📨 │ 📝 ) 05:50, 19 February 2021 (UTC)