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: patch-diff.githubusercontent.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:92ee0cf8-defe-f306-a92e-468a3e2f85e0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD78:337755:8B32C2:BC3BD8:69701067 |
| html-safe-nonce | 1c60c4cc0a9bb57b7f7b6f18c3a590e91b2d3964c55af03e6ed16da21dcb8505 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDc4OjMzNzc1NTo4QjMyQzI6QkMzQkQ4OjY5NzAxMDY3IiwidmlzaXRvcl9pZCI6Ijg2MjgwMzA4NjM0OTAxNTg2OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3e279c70c030c54891f97e2f38a1324886a8927a0802b0f3f099ed47158189dd |
| 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 | 043a09521e81f00c45482046b3f38390b8b292cf9a86ad665a632633a072c05c |
| 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 | 98881eadf8ae73000970c42161c094b0809b1330 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width