{"action":"created","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3087","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3087/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3087/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3087/events","html_url":"https://github.com/tomchristie/django-rest-framework/issues/3087","id":91839918,"number":3087,"title":"Setting with tuple value shouldn't be converted into list","user":{"login":"devoto13","id":823594,"avatar_url":"https://avatars.githubusercontent.com/u/823594?v=3","gravatar_id":"","url":"https://api.github.com/users/devoto13","html_url":"https://github.com/devoto13","followers_url":"https://api.github.com/users/devoto13/followers","following_url":"https://api.github.com/users/devoto13/following{/other_user}","gists_url":"https://api.github.com/users/devoto13/gists{/gist_id}","starred_url":"https://api.github.com/users/devoto13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devoto13/subscriptions","organizations_url":"https://api.github.com/users/devoto13/orgs","repos_url":"https://api.github.com/users/devoto13/repos","events_url":"https://api.github.com/users/devoto13/events{/privacy}","received_events_url":"https://api.github.com/users/devoto13/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-29T15:40:58Z","updated_at":"2015-06-29T15:43:50Z","closed_at":"2015-06-29T15:43:50Z","body":"When accessing setting though `from rest_framework.settings import api_settings` it will be converted from tuple to list (unless it's empty tuple). This behavior is inconsistent.\r\n\r\n### Failing test case\r\n\r\n```\r\nfrom rest_framework.settings import api_settings\r\nfrom rest_framework.test import TestCase\r\n\r\n\r\nclass TestSettings(TestCase):\r\n    def test_setting_type_is_not_changed(self):\r\n        self.assertTrue(isinstace(api_settings.DEFAULT_THROTTLE_CLASSES, tuple))\r\n```\r\n\r\nWill pass with these settings:\r\n\r\n```\r\nREST_FRAMEWORK = {\r\n    'DEFAULT_THROTTLE_CLASSES': ()\r\n}\r\n```\r\n\r\nBut will fail with these ones:\r\n\r\n```\r\nREST_FRAMEWORK = {\r\n    'DEFAULT_THROTTLE_CLASSES': (\r\n        'rest_framework.throttling.AnonRateThrottle',\r\n        'rest_framework.throttling.UserRateThrottle',\r\n    )\r\n}\r\n```\r\n\r\n### Expected behavior\r\n\r\nSetting type is not changed, when it is imported through `from rest_framework.settings import api_settings`.\r\n\r\n### Investigation\r\n\r\nIt seems issue comes from `rest_framework/settings.py:perform_import()` and can be easily fixed. I can submit pull request if it's considered a bug and not intended behavior."},"comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/comments/116737437","html_url":"https://github.com/tomchristie/django-rest-framework/issues/3087#issuecomment-116737437","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3087","id":116737437,"user":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T15:43:50Z","updated_at":"2015-06-29T15:43:50Z","body":"Coercing to lists is intended. Don't make assumptions in the code about the type of tuple vs list, just treat them as an immutable iterable. You shouldn't really need to perform type checking on them anywhere, and can just use `isinstance(..., (tuple, list))` if you really do want to do so."}}