Re: Another question about pythonic syntax, yea!

Be careful when removing items using for loops.
if you do some thing like this.
x [1, 2, 3, 4, 5, 6, 7]
for item in x:
  if item == 3 x.remove(item)

the index will skp the next element, so 4 will not be checked. if you have
x = [1, 2, 3, 3, 4, 5]
will only remove the first number 3 element in the list.
for those cases is better use list comprehension instead for loops.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : The Dwarfer via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : thggamer via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : majno via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : majno via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : majno via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : majno via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : majno via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : The Dwarfer via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : targor via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector

Reply via email to