Title: adding a new @classmethod to an existing class · Issue #1173 · realpython/python-guide · GitHub
Open Graph Title: adding a new @classmethod to an existing class · Issue #1173 · realpython/python-guide
X Title: adding a new @classmethod to an existing class · Issue #1173 · realpython/python-guide
Description: I have a python programming issue which I have not solved. In python3, using 'from opencadd.structure.core import Structure' defines the class Structure. The section of the Structure code that I need to modify is @classmethod @redo.retri...
Open Graph Description: I have a python programming issue which I have not solved. In python3, using 'from opencadd.structure.core import Structure' defines the class Structure. The section of the Structure code that I ne...
X Description: I have a python programming issue which I have not solved. In python3, using 'from opencadd.structure.core import Structure' defines the class Structure. The section of the Structure code t...
Opengraph URL: https://github.com/realpython/python-guide/issues/1173
X: @github
Domain: Github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"adding a new @classmethod to an existing class","articleBody":"I have a python programming issue which I have not solved. \n \nIn python3, using 'from opencadd.structure.core import Structure'\n\ndefines the class Structure. The section of the Structure code that I need to modify is\n\n @classmethod\n @redo.retriable(attempts=10, sleeptime=2)\n def from_pdbid(cls, pdbid):\n import mmtf\n\n return cls(mmtf.fetch(pdbid))\n\nwhere I would like to include\n\n # New method for CIF files\n @classmethod\n def from_cif(cls, filepath: str):\n \"\"\"\n Create a Structure object from a local CIF file.\n \"\"\"\n parser = MMCIFParser()\n structure_data = parser.get_structure(\"cif_file\", filepath)\n # ... (processing to build Volkamer Structure object)\n return cls(atoms, residues, bonds)\n\nThis will skip trying to execute mmtf.fetch (which will timeout because pdb is no longer available for mmtf.fetch).\nInstead using Structure.from_cif will avoid this issue and retrieve the file. \n\nSo far, I have not been able to do this successfully. Many blogs offer suggestions about adding a classmethod, \nbut I have failed and am asking for help from python exports. \n\nThanks in advance,\nDavid\nFortran, R, Matlab, C, AWK, Perl, no Python\n\n\n","author":{"url":"https://github.com/llevoc","@type":"Person","name":"llevoc"},"datePublished":"2025-09-19T19:01:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1173/python-guide/issues/1173"}
| 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:d72b6aa6-f894-ed1a-a2db-680d7d24d645 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D304:106F3E:D965FA:139D4A5:6A6324FB |
| html-safe-nonce | fb58957e75c7bff406315ae9ec9b55638a90cf45506f2e7c71d6875c1afa04e4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzA0OjEwNkYzRTpEOTY1RkE6MTM5RDRBNTo2QTYzMjRGQiIsInZpc2l0b3JfaWQiOiIzOTgyNzg5MTMzMTc4NDQ3MDk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fba28d28a684791f0fad8612947e356d22005b74122a8f887de1ca45df9a3936 |
| hovercard-subject-tag | issue:3435561894 |
| 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/realpython/python-guide/1173/issue_layout |
| twitter:image | https://opengraph.githubassets.com/16b8d84799eee07c0dbfe0a153c9da99ced9ce5c83df533a315115eae3df152a/realpython/python-guide/issues/1173 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/16b8d84799eee07c0dbfe0a153c9da99ced9ce5c83df533a315115eae3df152a/realpython/python-guide/issues/1173 |
| og:image:alt | I have a python programming issue which I have not solved. In python3, using 'from opencadd.structure.core import Structure' defines the class Structure. The section of the Structure code that I ne... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | llevoc |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1a6c056e02f174fffc096c521ec0ff6fb83e40a2ec8cb8875466ec1524872dd6 |
| turbo-cache-control | no-preview |
| go-import | github.com/realpython/python-guide git https://github.com/realpython/python-guide.git |
| octolytics-dimension-user_id | 5448020 |
| octolytics-dimension-user_login | realpython |
| octolytics-dimension-repository_id | 1481305 |
| octolytics-dimension-repository_nwo | realpython/python-guide |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1481305 |
| octolytics-dimension-repository_network_root_nwo | realpython/python-guide |
| 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 | 6a93e25585f487ddff9e3996c06d5b869d6e1828 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width