Python Forum
how to easily create a list of already existing item
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to easily create a list of already existing item
#15
Can't stress enough how much of a bad idea something like this is (as has been suggested previously), because you can end up with overcomplicated code that's difficult to understand. In the majority of programs, you really don't need to use things like locals, etc. as there are better ways to design things.

I do speak from experience too - I had to work on a system many years ago where I really had no choice but to use locals and friends. The reason was the other parts of the codebase I needed to use did some very strange things so that was the only way to get access to the data I needed. The code I had to write was unreadable really and unfortunately, it would have been too big a job to rewrite the rest in a more sensible way (and the code was poorly tested, making matters worse).

You'd do well to listen to people's advice when something is a bad idea and spend more time on learning useful techniques.
buran likes this post
Reply


Messages In This Thread
RE: how to easily create a list of already existing item - by ndc85430 - Dec-30-2021, 07:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Delete strings from a list to create a new only number list Dvdscot 8 1,604 May-01-2023, 09:06 PM
Last Post: deanhystad
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 1,585 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
Question Finding string in list item jesse68 8 1,936 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  Remove an item from a list contained in another item in python CompleteNewb 19 5,902 Nov-11-2021, 06:43 AM
Last Post: Gribouillis
  count item in list korenron 8 3,548 Aug-18-2021, 06:40 AM
Last Post: naughtyCat
  Create SQLite columns from a list or tuple? snakes 6 8,827 May-04-2021, 12:06 PM
Last Post: snakes
  Time.sleep: stop appending item to the list if time is early quest 0 1,897 Apr-13-2021, 11:44 AM
Last Post: quest
  Create variable and list dynamically quest_ 12 4,512 Jan-26-2021, 07:14 PM
Last Post: quest_
  How to run a pytest test for each item in a list arielma 0 2,391 Jan-06-2021, 10:40 PM
Last Post: arielma
  How to create a linked list and call it? loves 12 4,655 Nov-22-2020, 03:50 PM
Last Post: loves

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020