Title: FrozenJSON · Issue #20 · fluentpython/example-code · GitHub
Open Graph Title: FrozenJSON · Issue #20 · fluentpython/example-code
X Title: FrozenJSON · Issue #20 · fluentpython/example-code
Description: example 19-5 FrozenJSON def __init__(self, mapping): self.__data = dict(mapping) ➊ def __getattr__(self, name): ➋ if hasattr(self.__data, name): return getattr(self.__data, name) ➌ else: return FrozenJSON.build(self.__data[name]) ➍ self....
Open Graph Description: example 19-5 FrozenJSON def __init__(self, mapping): self.__data = dict(mapping) ➊ def __getattr__(self, name): ➋ if hasattr(self.__data, name): return getattr(self.__data, name) ➌ else: return Fro...
X Description: example 19-5 FrozenJSON def __init__(self, mapping): self.__data = dict(mapping) ➊ def __getattr__(self, name): ➋ if hasattr(self.__data, name): return getattr(self.__data, name) ➌ else: return Fro...
Opengraph URL: https://github.com/fluentpython/example-code/issues/20
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"FrozenJSON","articleBody":"example 19-5 FrozenJSON \r\n```\r\ndef __init__(self, mapping):\r\n self.__data = dict(mapping) ➊\r\n\r\n def __getattr__(self, name): ➋\r\n if hasattr(self.__data, name):\r\n return getattr(self.__data, name) ➌\r\n else:\r\n return FrozenJSON.build(self.__data[name]) ➍\r\n```\r\nself.__data is a dict ,function hasattr(object, name) the first parameter is object,so hasattr(self.__data, name) always return False,so step ➌ never return . am i right?","author":{"url":"https://github.com/xiaochuntu","@type":"Person","name":"xiaochuntu"},"datePublished":"2018-05-24T08:39:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/20/example-code/issues/20"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f521ee7a-5c70-4973-49b0-2aca0221c372 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B38:1C7458:87787D5:B2C1BAE:696DE9EC |
| html-safe-nonce | 8a8486409c6e9a400723cea89f52508fa2e88a541d2a2d34a911b698778a0916 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjM4OjFDNzQ1ODo4Nzc4N0Q1OkIyQzFCQUU6Njk2REU5RUMiLCJ2aXNpdG9yX2lkIjoiMjQzMTI4MDc5NTAzNzMyOTkwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3492a0635d65c3a15dc0a6ffba99557bb9fa8001029cff0699355c3a77885251 |
| hovercard-subject-tag | issue:326019519 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fluentpython/example-code/20/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ad0b630cee3632e7aabe5d16a5de658251611d9d34ec063608d97f159a38228/fluentpython/example-code/issues/20 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ad0b630cee3632e7aabe5d16a5de658251611d9d34ec063608d97f159a38228/fluentpython/example-code/issues/20 |
| og:image:alt | example 19-5 FrozenJSON def __init__(self, mapping): self.__data = dict(mapping) ➊ def __getattr__(self, name): ➋ if hasattr(self.__data, name): return getattr(self.__data, name) ➌ else: return Fro... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | xiaochuntu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4922b452d03cd8dbce479d866a11bc25b59ef6ee2da23aa9b0ddefa6bd4d0064 |
| turbo-cache-control | no-preview |
| go-import | github.com/fluentpython/example-code git https://github.com/fluentpython/example-code.git |
| octolytics-dimension-user_id | 9216311 |
| octolytics-dimension-user_login | fluentpython |
| octolytics-dimension-repository_id | 25216588 |
| octolytics-dimension-repository_nwo | fluentpython/example-code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 25216588 |
| octolytics-dimension-repository_network_root_nwo | fluentpython/example-code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7e5ae23c70136152637ceee8d6faceb35596ec46 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width