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
#3
(Dec-29-2021, 07:06 PM)deanhystad Wrote: This is not something you should ever need to do. That you think you need something like this is a flashing neon sign that says "This is a BAD design!"

Why do you have a bunch of variables that you want to collect into a list? If you have things that should be collections, they should be created as collections. Variables for individual objects should be fairly rare in programs, usually existing for fleeting moments in time where they are used to represent an item in a collection or an attribute of an object.

I'm sorry but you're overthinking this. I asked out of curiosity, because I was playing around with things. I'm not designing anything. I'm just checking what's possible and what's not.
Reply


Messages In This Thread
RE: how to easily create a list of already existing item - by CompleteNewb - Dec-29-2021, 07:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a new subclass in a Python extension based on an existing class voidtrance 6 1,461 Mar-25-2025, 06:37 PM
Last Post: voidtrance
  Delete strings from a list to create a new only number list Dvdscot 8 3,438 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 2,890 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
Question Finding string in list item jesse68 8 3,212 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  Remove an item from a list contained in another item in python CompleteNewb 19 8,988 Nov-11-2021, 06:43 AM
Last Post: Gribouillis
  count item in list korenron 8 4,942 Aug-18-2021, 06:40 AM
Last Post: naughtyCat
  Create SQLite columns from a list or tuple? snakes 6 12,542 May-04-2021, 12:06 PM
Last Post: snakes
  Time.sleep: stop appending item to the list if time is early quest 0 2,413 Apr-13-2021, 11:44 AM
Last Post: quest
  Create variable and list dynamically quest_ 12 6,625 Jan-26-2021, 07:14 PM
Last Post: quest_
  How to run a pytest test for each item in a list arielma 0 3,124 Jan-06-2021, 10:40 PM
Last Post: arielma

Forum Jump:

User Panel Messages

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