*** pm90_ has quit IRC | 00:26 | |
*** pm90_ has joined #openstack-sdks | 00:27 | |
*** briancurtin has joined #openstack-sdks | 00:51 | |
*** briancurtin has joined #openstack-sdks | 00:51 | |
*** stevemar has joined #openstack-sdks | 00:56 | |
*** briancurtin has quit IRC | 02:18 | |
*** sigmavirus24_awa is now known as sigmavirus24 | 02:33 | |
stevemar | sigmavirus24, ping | 03:27 |
---|---|---|
sigmavirus24 | stevemar: sup? | 03:33 |
stevemar | sigmavirus24, i have a random python question that is bugging me... if you are free-ish | 03:33 |
stevemar | outlined here: http://paste.openstack.org/show/155489/ it feels like such a noobie question | 03:34 |
* sigmavirus24 looks | 03:36 | |
openstackgerrit | Zhiyuan Cai proposed openstack/python-openstackclient: Check if service.name available before access https://review.openstack.org/144857 | 03:36 |
sigmavirus24 | if you're looking to de-dup Users you need to define __hash__ | 03:36 |
sigmavirus24 | on Py2 by default it uses id(obj) | 03:36 |
sigmavirus24 | on Py3 that would be busted iirc | 03:36 |
stevemar | sigmavirus24, ahhh okay, i guess you would need for define __hash__ anytime you use objects? | 03:37 |
sigmavirus24 | not necessarily every time, but anytime you're defining a custom object and you want it to hash consistently, yes | 03:39 |
sigmavirus24 | so if you want any instance of User with id 1234 to be able to be used as a key in a dictionary (or to be the same in a set) you need to define __hash__ | 03:40 |
sigmavirus24 | and all it need return is an id | 03:40 |
stevemar | okay, i'll look into that, but if it's broken in py33 then that's nothing i want to use :( | 03:41 |
stevemar | if all else fails, i'll use: http://paste.openstack.org/show/155495/ | 03:41 |
stevemar | it's not as pretty, but it'll work | 03:42 |
sigmavirus24 | stevemar: sorry, __hash__ isn't broken | 03:42 |
sigmavirus24 | relying on id(obj) is broken | 03:42 |
sigmavirus24 | so what your'e doing now would break because those objects aren't explicitly hashable | 03:42 |
stevemar | so it should probably be defined here https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/v3/users.py#L27-L34 | 03:46 |
sigmavirus24 | stevemar: fwiw, with GitHub's API, every object has a url attribute and I use hash(url) | 03:46 |
sigmavirus24 | stevemar: or it could be on keystoneclient.base.Resource | 03:46 |
sigmavirus24 | which seems to come from oslo-incubator's apiclient | 03:48 |
stevemar | yep, or there too | 03:48 |
stevemar | i think they use id(obj) as you mentioned | 03:48 |
sigmavirus24 | That's just what python defaults to :( https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/openstack/common/apiclient/base.py#L426 | 03:49 |
sigmavirus24 | They're not defining it | 03:49 |
stevemar | nice | 03:54 |
sigmavirus24 | I really kind of want oslo-incubator's apiclient to be so much better/more than it is | 03:54 |
sigmavirus24 | I couldn't find any blueprints around it though | 03:55 |
sigmavirus24 | (perhaps didn't look in the right place) | 03:55 |
sigmavirus24 | I also wonder how necessary it is now with the sdk | 03:55 |
stevemar | sigmavirus24, well the sdk is still a bit a ways away | 03:59 |
stevemar | (i think so anyway) | 03:59 |
sigmavirus24 | Yeah I get that | 04:07 |
*** pm90_ has quit IRC | 04:13 | |
*** sigmavirus24 is now known as sigmavirus24_awa | 04:54 | |
openstackgerrit | Merged openstack/python-openstackclient: Add endpoint v3 docs https://review.openstack.org/144540 | 05:07 |
openstackgerrit | OpenStack Proposal Bot proposed openstack/python-openstackclient: Imported Translations from Transifex https://review.openstack.org/144829 | 06:11 |
openstackgerrit | Steve Martinelli proposed openstack/python-openstackclient: Allow user list to filter by project https://review.openstack.org/142210 | 06:44 |
*** stevemar has quit IRC | 07:13 | |
*** stevemar has joined #openstack-sdks | 14:55 | |
*** sigmavirus24_awa is now known as sigmavirus24 | 15:34 | |
*** briancurtin has joined #openstack-sdks | 16:25 | |
*** briancurtin has quit IRC | 16:35 | |
*** subscope has joined #openstack-sdks | 17:44 | |
*** subscope has quit IRC | 18:00 | |
*** stevemar has quit IRC | 18:19 | |
*** pm90_ has joined #openstack-sdks | 22:38 | |
*** notmyname_ has joined #openstack-sdks | 23:03 | |
*** pm90_ has quit IRC | 23:04 | |
*** notmyname has quit IRC | 23:06 | |
*** notmyname_ is now known as notmyname | 23:06 |
Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!