{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Kurtis Pykes",
  "title_listed": "7 Code Smells You Should Know About And Avoid",
  "keywords": "代码异味,重构",
  "domain": "数据处理",
  "content_type": "深度技术解析",
  "is_paid_flag": "部分免费/会员墙",
  "url": "https://towardsdatascience.com/7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5/",
  "publish_date": "2022-04",
  "corpus_stage": "预训练/SFT",
  "notes": "",
  "id": "95c02eb19057",
  "collected_at": "2026-10-01T23:59:56",
  "title": "7 Code Smells You Should Know About And Avoid | Towards Data Science",
  "body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Programming](https://towardsdatascience.com/category/programming/)\n# 7 Code Smells You Should Know About And Avoid\n#2 Using Print Statements to Debug\n[Kurtis Pykes](https://towardsdatascience.com/author/kurtispykes/)\nApril 27, 20229 min read\n![Photo by charlesdeluvio on Unsplash](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/0vtjchAzRXaZ5jqMU-scaled.jpg)\nPhoto by [charlesdeluvio](https://unsplash.com/@charlesdeluvio?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)\nPrograms do not necessarily have to crash to alert of issues within them: some other factors may serve as severe warnings that an issue could be on the horizon. For example, if you smelt gas or smoke somewhere in your house, it could indicate that you've got a gas leak or there's something burning. Both scenarios require investigation before it becomes a major issue (i.e. your house explodes).\nA code smell can be thought of as smelling gas or smoke in your home. Your code wouldn't stop executing because it's present, but it's worth investigating before it blows out of proportion. It serves as an indicative warning that your code needs some attention.\n> \"'Smells are certain structures in the code that indicate violation of fundamental design principles and negatively impact design quality'. Code smells are usually not bugs; they are not technically incorrect and do not prevent the program from functioning. Instead, they indicate weaknesses in design that may slow down development or increase the risk of bugs or failures in the future. Bad code smells can be an indicator of factors that contribute to technical debt.\" \n>   * [**Source** : [Wikipedia](https://en.wikipedia.org/wiki/Code_smell)]\n> \n\nThe mere presence of a code smell does not equate to a bug, but its smell warrants a cause for concern worth investigating. All programmers would agree that it's much less effort and cost less time to prevent a bug before we encounter it - getting rid of code smells is one way to ensure this.\nTo reduce the number of code smells, it's important to know what they look like. In this article, we will cover seven of them in non-chronological order.\nLearn this step by step with the interactive [Computer Science](https://roadmap.sh/computer-science) roadmap.\n## 1 Using print statements to debug\nPrint statements are likely to be one of the first built-ins you learn in your programming journey (i.e. most people's first program is `print(\"Hello World\")`). There's nothing inherently wrong with print statements, except that developers often get too attached to them.\nHow do you know if you're too attached to print statements? _**If you're using it to debug your code.**_\nPrint statements are easy to implement, hence it does an extremely good job of deceiving people into thinking it's the best way to debug their code. However, debugging with print usually requires you to perform multiple iterations of running your program before you display the necessary information to fix a bug in your code - it works out longer, especially as you go back and delete all of them.\nThere are two solutions that are better than using print debugging: 1) using a debugger to run your program one line at a time and 2) using log files to record large amounts of information from your program that can be compared with previous runs.\nI prefer using log files which can easily be done in Python with the built-in `logging` module.\ntext\n\n```\nimport logging \n```\n\ntext\n\n```\nlogging.basicConfig(\n    filename = \"log_age.txt\", \n    level = logging.DEBUG,\n    format = \"%(asctime)s - %(levelname)s - %(message)s\") \n```\n\ntext\n\n```\nlogging.debug(\"This is a log message.\") \n```\n\n## 2 Duplicate code\nThe most common code smell you'll find in programs is likely to be duplicated code. It's so easy to recognize duplicate code: all you have to do is consider where you could have simply copied and pasted code in different parts of a program. Thus, duplicate code may be defined as code that's repeated in more than one location.\ntext\n\n```\nprint(\"What would you like for breakfast?\")\nbreakfast = input()\nprint(f\"One {breakfast} coming up\")\n```\n\ntext\n\n```\nprint(\"What would you like for lunch?\")\nlunch = input()\nprint(f\"One {lunch} coming up\")\n```\n\ntext\n\n```\nprint(\"What would you like for dinner?\")\ndinner = input()\nprint(f\"One {dinner} coming up\")\n```\n\nOn the surface, duplicate code looks harmless. Where it becomes a thorn in the backside is when updates or changes to the code must be made. Changing one copy of the duplicate code means changes must be made to all areas of the code, and forgetting to do so can result in costly, hard to detect, bugs in your program.\nThe solution to this problem is pretty straightforward: deduplicate the code. We can easily make code appear once in our programs by leveraging the power of functions or loops.\ntext\n\n```\ndef ask_meal(meal_of_the_day:str) -> str: \n    print(f\"What would you like to eat for {meal_of_the_day}\")\n    meal = input()\n    return f\"One {meal} coming up\"\n\nmeals_of_the_day = [\"breakfast\", \"lunch\", \"dinner\"]\n```\n\ntext\n\n```\nfor meal in meals_of_the_day: \n    ask_meal(meal)\n```\n\nSome people take duplication to an extreme level and seek to deduplicate their code anytime they've copied and pasted. Though there may be some programmers that argue for it, at times it can be overkill. You can probably get away with copying and pasting code once or twice but if it occurs three times, create a function or loop to fix it.\n## 3 Magic numbers\nSometimes we have to use numbers in our code; Some numbers that we use in our source code can cause extreme confusion to other developers - and to yourself if [or when] you have to revisit the code in the future. These numbers are called _**magic numbers**_.\n> \"The term magic number or magic constant refers to the anti-pattern of using numbers directly in source code.\"\n>   * [**Source** : [Wikipeida](https://en.wikipedia.org/wiki/Magic_number_\\(programming\\))]\n> \n\nMagic numbers are considered a code smell because they don't give any indication as to why they're present - it obscures the developer's intention in choosing that specific number. Thus, your code is less readable, harder for you and other developers to update or change in the future, and much more prone to subtle errors like typos.\nConsider the following scenario:\ntext\n\n```\nfrom sklearn.model_selection import train_test_split\n```\n\ntext\n\n```\nX_train, X_test, y_train, y_test = train_test_split(\n    X, \n    y, \n    0.3, \n    0.7, \n    25, \n    True, \n    None\n)\n```\n\nIn the code above we've imported the `train_test_split` function from Scikit-learn and instantiated it with some hyperparameters that seem to have no clear meaning.\nOne solution to make this code more readable is to add informative comments that tell us why we've chosen that specific number.\ntext\n\n```\nfrom sklearn.model_selection import train_test_split\n```\n\ntext\n\n```\nX_train, X_test, y_train, y_test = train_test_split(\n    X # features array, \n    y # labels, \n    0.3 # test size, \n    0.7 # train size, \n    25 # random state, \n    True # shuffle, \n    None # stratify\n)\n```\n\nA much more informative way to solve this code smell is to use a _**constant**_. Constants are data valuables that remain the same each time a program is executed. [I'm not sure about other languages but] In Python, we typically write constants in uppercase letters to inform others (and remind ourselves) that their values shouldn't change after their initial assignment.\nYou'll often see constants defined in configurations or as a global variable at the beginning of a script.\ntext\n\n```\nfrom sklearn.model_selection import train_test_split\n```\n\ntext\n\n```\nTEST_SIZE = 0.3\nTRAIN_SIZE = 0.7\nRANDOM_STATE = 25\nSHUFFLE = True\nSTRATIFY = None\n```\n\ntext\n\n```\nX_train, X_test, y_train, y_test = train_test_split(\n    X, \n    y, \n    TEST_SIZE, \n    TRAIN_SIZE, \n    RANDOM_STATE, \n    SHUFFLE, \n    STRATIFY\n)\n```\n\nHow much more readable is that?\n_**Note**_ _: It would also help to call the parameter names and set them equal to the constant for extra security._\nIt's important you use separate constants instead of using one to solve two problems. The reason for this is that they can be changed independently in the future which usually results in much less hassle.\n## 4 Leaving commented out code in place\nComments in your code are definitely seen as a good practice when it's informative. Sometimes, we even comment out code temporarily to see how the remaining code runs without the line we've removed - possibly while we're debugging - there's nothing inherently wrong with that either.\nWhere it becomes a problem is when programmers get lazy. One such example of this laziness is commenting out code but leaving the commented out code in place.\nThe reason commented out code in place is a code smell is because it's ambiguous. Other programmers would see the commented-out code as a complete mystery and would have no idea about what conditions should bring it back into the program.\ntext\n\n```\nwalk()\n# run()\nsprint()\nstop()\n```\n\nWhy is `run()` commented out? When would it be okay to uncomment `run()`? If it's not needed then remove the code.\n## 5 Dead code\nAll dead code in your program must be dealt with to save computation and memory.\n> \"dead code is a section in the source code of a program which is executed but whose result is never used in any other computation.\"\n>   * [**Source** : [Wikipedia](https://en.wikipedia.org/wiki/Dead_code#:~:text=In%20some%20areas%20of%20computer,wastes%20computation%20time%20and%20memory.)]\n> \n\nHaving dead code in your programs is extremely misleading. Other programmers reading your code may not catch on right away and assume it's a working part of code when in reality, it does nothing but wastes space.\ntext\n\n```\n# Code source: https://twitter.com/python_engineer/status/1510165975253069824?s=20&amp;t=VsOWz55ZILPXCz6NMgJtEg\n```\n\ntext\n\n```\nclass TodoItem: \n    def __init__(self, state=None):\n        self.state = state if state else -1 \n\n    def __str__(self): \n        if self.state == -1: \n            return \"UNDEFINED\"\n        elif self.state == 0: \n            return \"UNSET\" \n        else: \n            return \"SET\"\n```\n\nAt first glance, this code looks okay but there's a bug in it: the code can never be set to 0 because the evaluation in the `self.state` variable will set 0 to `False`. Thus, setting the state to 0 will return `UNDEFINED` instead of `UNSET`.\ntext\n\n```\nclass TodoItem: \n    def __init__(self, state=None):\n        self.state = state if state is not None else -1 \n\n    def __str__(self): \n        if self.state == -1: \n            return \"UNDEFINED\"\n        elif self.state == 0: \n            return \"UNSET\" \n        else: \n            return \"SET\"\n```\n\n_**Note** : See this [video](https://www.youtube.com/watch?v=_9yJdVl-K9M&t=59s) by Python Engineer to get the full explanation._\n## 6 Storing variables with numeric suffixes\nI've been caught by this code smell a few times - until this day I'm not fully free from it; Sometimes, we may need to keep track of several instances of the same type of data. In such circumstances, it's incredibly tempting to reuse a name and add a suffix to it so it's stored in a different namespace in the program.\ntext\n\n```\nperson_1 = \"John\" \nperson_2 = \"Doe\"\nperson_3 = \"Michael\n```\n\nThe reason why this code smell is a code smell is that a suffix doesn't serve as a good description of what is contained in each variable or the difference between the variables. It also doesn't give any indication as to how many variables are present within your program - you don't want to search through 1000+ lines of code to ensure there are no other numbers.\nA better solution would be:\ntext\n\n```\npeople = [\"John\", \"Doe\", \"Michael\"] \n```\n\nDon't take this as an instruction to change all variables that end in a number: some variables deserve to end in a number, especially if the number is part of the distinct name of the data you're storing.\n## 7 Unnecessary classes (Python specific)\nProgramming languages like Java use classes to organize code in a program. Python instead uses modules. Thus, trying to use classes in Python as you would in Java (to organize code) isn't going to be effective.\nCode in Python isn't required to exist in a class, and sometimes, using classes can be overkill.\nTake this class for example:\ntext\n\n```\nclass Human:\n    def __init__(self, name: str): \n        self.name = name\n```\n\ntext\n\n```\n    def introduction(self): \n        return f\"Hi, my name is {self.name}\"\n```\n\ntext\n\n```\nperson = Human(\"Kurtis\")\nprint(person.introduction()) \n```\n\ntext\n\n```\n\"\"\"\nHi, my name is Kurtis\n\"\"\"\n```\n\nA major defining factor as to why this class does not need to be a class is that it only has one function. As a rule of thumb, a class does not need to be a class in Python if it only contains one method or only static methods. It's better to write a function instead.\nTo learn more about this concept, check out Jack Diederich's PyCon 2012 talk on why we should \"[Stop Writing Classes](https://www.youtube.com/watch?v=o9pEzgHorH0).\"\n_Thanks for reading._\n**Connect with me:** [LinkedIn](https://www.linkedin.com/in/kurtispykes/) [Twitter](https://twitter.com/KurtisPykes) [Instagram](https://www.instagram.com/kurtispykes/)\nIf you enjoy reading stories like this one and wish to support my writing, consider [becoming a Medium member](https://kurtispykes.medium.com/membership). With a $5 a month commitment, you unlock unlimited access to stories on Medium. If you use [my sign-up link](https://kurtispykes.medium.com/membership), I'll receive a small commission.\nAlready a member? [Subscribe](https://kurtispykes.medium.com/subscribe) to be notified when I publish.\n> [**Get an email whenever Kurtis Pykes publishes.**](https://kurtispykes.medium.com/subscribe)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657084566_vncpf1.jpeg)\nWritten By\n## [Kurtis Pykes](https://towardsdatascience.com/author/kurtispykes/)\n[See all from Kurtis Pykes](https://towardsdatascience.com/author/kurtispykes/)\n[Education](https://towardsdatascience.com/tag/education/)[Programming](https://towardsdatascience.com/tag/programming/)[Python](https://towardsdatascience.com/tag/python/)[Tech](https://towardsdatascience.com/tag/tech/)[Technology](https://towardsdatascience.com/tag/technology/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2F7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5%2F&title=7%20Code%20Smells%20You%20Should%20Know%20About%20And%20Avoid)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2F7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5%2F&title=7%20Code%20Smells%20You%20Should%20Know%20About%20And%20Avoid)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2F7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5%2F&text=7%20Code%20Smells%20You%20Should%20Know%20About%20And%20Avoid)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/1YDHHh1Qst1vsUoIn0n1fCw-scaled.jpeg)](https://towardsdatascience.com/optimization-of-a-weekly-production-plan-with-python-and-gurobi-part-1-d1257ad29a9/)\n## [Optimization of a weekly production plan with Python and Gurobi - Part 1](https://towardsdatascience.com/optimization-of-a-weekly-production-plan-with-python-and-gurobi-part-1-d1257ad29a9/)\n[](https://towardsdatascience.com/7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5/)\nLearn how to solve optimization problems using Python and the mathematical solver Gurobi.\n[Soulard Baptiste](https://towardsdatascience.com/author/soulard-baptiste-bs/)\nOctober 9, 20206 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/12/1f0G4yk0STR3lDHlBxAoikg-scaled.jpeg)](https://towardsdatascience.com/machine-learning-on-macos-with-an-amd-gpu-and-plaidml-55a46fe94bc0/)\n## [Machine Learning on macOS with an AMD GPU and PlaidML](https://towardsdatascience.com/machine-learning-on-macos-with-an-amd-gpu-and-plaidml-55a46fe94bc0/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nWant to train machine learning models on your Mac's integrated AMD GPU or an external graphics card? Look no further than PlaidML.\n[Alex Wulff](https://towardsdatascience.com/author/alexwulff/)\nDecember 14, 20203 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/1ZeZwqXFt0ywSPauD9_ViLw-scaled.jpeg)](https://towardsdatascience.com/creating-a-project-updates-tracker-in-excel-using-vba-c085e6fe05a8/)\n## [Creating a Project Updates Tracker in Excel Using VBA](https://towardsdatascience.com/creating-a-project-updates-tracker-in-excel-using-vba-c085e6fe05a8/)\n[Programming](https://towardsdatascience.com/category/programming/)\nThree simple steps to track project updates in Excel and log them\n[Himalaya Bir Shrestha](https://towardsdatascience.com/author/himalaya.birshrestha/)\nSeptember 2, 20237 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/08/1xfcrW9qZHd7x17Y1gh3N_w.png)](https://towardsdatascience.com/what-is-good-code-an-actionable-introduction-1cad30551ad4/)\n## [What is good code?](https://towardsdatascience.com/what-is-good-code-an-actionable-introduction-1cad30551ad4/)\n[Programming](https://towardsdatascience.com/category/programming/)\nA 10-minute actionable introduction.\n[Pratick Roy](https://towardsdatascience.com/author/pratickroy/)\nAugust 4, 202012 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/07/101IMR8gb7kwdEP5iFYrGow-scaled.jpeg)](https://towardsdatascience.com/data-factory-generic-datasets-a998b832f060/)\n## [Keep your Data Factory clean with generic datasets](https://towardsdatascience.com/data-factory-generic-datasets-a998b832f060/)\n[Technology](https://towardsdatascience.com/category/technology/)\nHow to create generic, reusable datasets in Azure Data Factory for Blob storage and SQL DB\n[Miia Rämö](https://towardsdatascience.com/author/miiaramo/)\nJuly 19, 20215 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/02/19u2K-G5y8R6qvto_kf9fYA.png)](https://towardsdatascience.com/fixing-your-machine-learning-models-failure-points-e3ec0a047895/)\n## [Fixing Your Machine Learning Model's Failure Points](https://towardsdatascience.com/fixing-your-machine-learning-models-failure-points-e3ec0a047895/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nA step-by-step guide on finding and understanding problems in your machine learning model - and fixing them!\n[Abubakar Abid](https://towardsdatascience.com/author/abidlabs/)\nFebruary 22, 20216 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/1YLZXNPJ1Q4oo1HjQz00Jcg-scaled.jpeg)](https://towardsdatascience.com/thoughts-on-finding-a-data-science-project-d4b74893f50/)\n## [Thoughts on Finding a Data Science Project](https://towardsdatascience.com/thoughts-on-finding-a-data-science-project-d4b74893f50/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nSometimes you need to let a project go to someone else at work, and that's okay.\n[Rose Day](https://towardsdatascience.com/author/rjday/)\nOctober 18, 20205 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/04/10ae0i0xcHxkhOd6CGzcNaQ.jpeg)](https://towardsdatascience.com/setting-up-a-gcp-pub-sub-integration-with-python-6bf3fab111f8/)\n## [Setting up a GCP Pub/Sub Integration with Python](https://towardsdatascience.com/setting-up-a-gcp-pub-sub-integration-with-python-6bf3fab111f8/)\n[Programming](https://towardsdatascience.com/category/programming/)\nA guide to unlocking data streaming for Python applications with the Google Cloud Platform\n[Andrew Didinchuk](https://towardsdatascience.com/author/appliedarchitect/)\nApril 25, 20214 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/08/0Xc3vZLwtr_BiGERL-scaled.jpg)](https://towardsdatascience.com/how-do-machine-learning-and-signal-processing-blend-4f48afbb6dce/)\n## [How do Machine Learning and Signal Processing Blend?](https://towardsdatascience.com/how-do-machine-learning-and-signal-processing-blend-4f48afbb6dce/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nAn Overview Of IBM's \"Advanced Machine Learning and Signal Processing\" on Coursera\n[Keenan Kon](https://towardsdatascience.com/author/keenankon/)\nAugust 2, 20209 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607631/image?etag=1781543525510&width=500&height=500) Critical Mistakes Companies Make When Integrating AI/ML into Their Processes ](https://towardsdatascience.com/critical-mistakes-companies-make-when-integrating-ai-ml-into-their-processes/ \"Critical Mistakes Companies Make When Integrating AI/ML into Their Processes\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n\n\n",
  "metadata": {
    "title": "7 Code Smells You Should Know About And Avoid | Towards Data Science",
    "description": "#2 Using Print Statements to Debug",
    "keywords": null,
    "author": "Kurtis Pykes",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "7 Code Smells You Should Know About And Avoid",
    "og:description": "#2 Using Print Statements to Debug",
    "og:url": "https://towardsdatascience.com/7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/0vtjchAzRXaZ5jqMU-scaled.jpg",
    "og:image:width": "1980",
    "og:image:height": "2560",
    "og:image:type": "image/jpeg",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Kurtis Pykes",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "9 min read",
    "article:published_time": "2022-04-27T17:34:23.000Z",
    "article:modified_time": "2022-04-27T17:34:23.000Z",
    "article:author": "https://towardsdatascience.com/author/kurtispykes/"
  },
  "paywall": {
    "listed_paid": true,
    "detected": false,
    "marker": "",
    "public_only": true,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_000.txt",
      "chars": 16
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_001.txt",
      "chars": 138
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_002.txt",
      "chars": 41
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_003.txt",
      "chars": 100
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_004.txt",
      "chars": 88
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_005.txt",
      "chars": 91
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_006.txt",
      "chars": 213
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_007.txt",
      "chars": 50
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_008.txt",
      "chars": 53
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_009.txt",
      "chars": 120
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_010.txt",
      "chars": 53
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_011.txt",
      "chars": 207
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_012.txt",
      "chars": 53
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_013.txt",
      "chars": 82
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_014.txt",
      "chars": 150
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_015.txt",
      "chars": 31
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_016.txt",
      "chars": 112
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_017.txt",
      "chars": 283
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_018.txt",
      "chars": 295
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_019.txt",
      "chars": 56
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_020.txt",
      "chars": 37
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_021.txt",
      "chars": 74
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_022.txt",
      "chars": 74
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_023.txt",
      "chars": 55
    },
    {
      "language": "txt",
      "file": "attachments/95c02eb19057/code/block_024.txt",
      "chars": 30
    }
  ],
  "images": [
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/0vtjchAzRXaZ5jqMU-scaled.jpg",
      "alt": "Photo by charlesdeluvio on Unsplash",
      "local_path": "attachments/95c02eb19057/images/000.jpg",
      "bytes": 615037,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/1YDHHh1Qst1vsUoIn0n1fCw-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/001.jpeg",
      "bytes": 635197,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/12/1f0G4yk0STR3lDHlBxAoikg-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/002.jpeg",
      "bytes": 420711,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/1ZeZwqXFt0ywSPauD9_ViLw-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/003.jpeg",
      "bytes": 273166,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/08/1xfcrW9qZHd7x17Y1gh3N_w.png",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/004.png",
      "bytes": 6478,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/07/101IMR8gb7kwdEP5iFYrGow-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/005.jpeg",
      "bytes": 946680,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/02/19u2K-G5y8R6qvto_kf9fYA.png",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/006.png",
      "bytes": 33028,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/1YLZXNPJ1Q4oo1HjQz00Jcg-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/007.jpeg",
      "bytes": 839002,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/04/10ae0i0xcHxkhOd6CGzcNaQ.jpeg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/008.jpeg",
      "bytes": 323416,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/08/0Xc3vZLwtr_BiGERL-scaled.jpg",
      "alt": "",
      "local_path": "attachments/95c02eb19057/images/009.jpg",
      "bytes": 560409,
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [
    {
      "src": "https://www.youtube.com/watch?v=_9yJdVl-K9M&t=59s",
      "quality": "unavailable",
      "local_path": "",
      "note": "无1080p且无720p，未交付更低清晰度"
    },
    {
      "src": "https://www.youtube.com/watch?v=o9pEzgHorH0",
      "quality": "unavailable",
      "local_path": "",
      "note": "无1080p且无720p，未交付更低清晰度"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/kurtispykes/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/education/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/python/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/tech/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/technology/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/optimization-of-a-weekly-production-plan-with-python-and-gurobi-part-1-d1257ad29a9/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/soulard-baptiste-bs/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/machine-learning-on-macos-with-an-amd-gpu-and-plaidml-55a46fe94bc0/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/alexwulff/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/creating-a-project-updates-tracker-in-excel-using-vba-c085e6fe05a8/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://unsplash.com/@charlesdeluvio"
    },
    {
      "type": "external",
      "href": "https://unsplash.com"
    },
    {
      "type": "external",
      "href": "https://en.wikipedia.org/wiki/Code_smell"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/computer-science"
    },
    {
      "type": "external",
      "href": "https://en.wikipedia.org/wiki/Magic_number_(programming)"
    },
    {
      "type": "external",
      "href": "https://en.wikipedia.org/wiki/Dead_code"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/watch?t=59s&v=_9yJdVl-K9M"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/watch?v=o9pEzgHorH0"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/in/kurtispykes/"
    },
    {
      "type": "external",
      "href": "https://twitter.com/KurtisPykes"
    },
    {
      "type": "external",
      "href": "https://www.instagram.com/kurtispykes/"
    },
    {
      "type": "external",
      "href": "https://kurtispykes.medium.com/membership"
    },
    {
      "type": "external",
      "href": "https://kurtispykes.medium.com/subscribe"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=7+Code+Smells+You+Should+Know+About+And+Avoid&u=https%3A%2F%2Ftowardsdatascience.com%2F7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=7+Code+Smells+You+Should+Know+About+And+Avoid&url=https%3A%2F%2Ftowardsdatascience.com%2F7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=7+Code+Smells+You+Should+Know+About+And+Avoid&url=https%3A%2F%2Ftowardsdatascience.com%2F7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T11:11:49Z",
  "source_url": "https://towardsdatascience.com/7-code-smells-you-should-know-about-and-avoid-b1edf066c3a5/",
  "delivery_status": "excluded_paid",
  "discovery_status": "excluded_paid",
  "missing_reason": "按原约定排除付费/会员全文"
}