workspace
stringclasses 1
value | channel
stringclasses 1
value | sentences
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
| sentence_id
stringlengths 44
53
| timestamp
float64 1.5B
1.56B
| __index_level_0__
int64 0
106k
|
---|---|---|---|---|---|---|---|
pythondev | help | ¯\_(ツ)_/¯ | 2019-03-13T09:15:33.416900 | Hiroko | pythondev_help_Hiroko_2019-03-13T09:15:33.416900 | 1,552,468,533.4169 | 13,121 |
pythondev | help | with your description, could be anything | 2019-03-13T09:15:40.417200 | Hiroko | pythondev_help_Hiroko_2019-03-13T09:15:40.417200 | 1,552,468,540.4172 | 13,122 |
pythondev | help | Sounds like whatever you're accessing doesn't want you to do so. | 2019-03-13T09:29:26.417900 | Melynda | pythondev_help_Melynda_2019-03-13T09:29:26.417900 | 1,552,469,366.4179 | 13,123 |
pythondev | help | anyone here well versed in yapf? I’ve just switched to it from autopep8 and I want to enforce a certain behavior.
In one instance, I have this:
```candidates = Channel.select().where((Channel.name**'HowToPronounce%') | (Channel.name**'Pronunciation%'))```
and yapf formats it the way I want:
``` candidates = Channel.select().where(
(Channel.name**'HowToPronounce%') | (Channel.name**'Pronunciation%')
)
```
later in the same file, I have
```videos_to_evaluate = YoutubeVideo.select().where((YoutubeVideo.views < 10000) & (YoutubeVideo.interesting == None))```
but it formats it as
```
videos_to_evaluate = YoutubeVideo.select(
).where((YoutubeVideo.views < 10000) & (YoutubeVideo.interesting == None))
```
Is there a way to make it always format like the former, where a method call with no parameters doesn’t get split? | 2019-03-13T09:50:07.420600 | Carrol | pythondev_help_Carrol_2019-03-13T09:50:07.420600 | 1,552,470,607.4206 | 13,124 |
pythondev | help | I have a general idea why the POST is returning that error... prolly missing something in either the header and/or the parameters that I inputted. It is possible, but theoretically my script can be considered a bot... hm... wonder what would happen if I add a sleep() line... | 2019-03-13T10:00:29.422500 | Nieves | pythondev_help_Nieves_2019-03-13T10:00:29.422500 | 1,552,471,229.4225 | 13,125 |
pythondev | help | Or maybe I need to view the docs for bots on that particular site... | 2019-03-13T10:01:19.423200 | Nieves | pythondev_help_Nieves_2019-03-13T10:01:19.423200 | 1,552,471,279.4232 | 13,126 |
pythondev | help | Also, can’t reveal details yet since it is related to security. Once responsible disclosure occurs and they fix it (for real), I will share. Maybe. | 2019-03-13T10:05:41.424700 | Nieves | pythondev_help_Nieves_2019-03-13T10:05:41.424700 | 1,552,471,541.4247 | 13,127 |
pythondev | help | Does anyone have experience with serverless coding? I'm strongly considering going serverless for a new app I want to build cause of the amazing initial cost savings, but I am curious about how to do tests with it. I've seen enough code without tests to know that I DEFINITELY want tests in my code base | 2019-03-13T10:21:54.431400 | Ursula | pythondev_help_Ursula_2019-03-13T10:21:54.431400 | 1,552,472,514.4314 | 13,128 |
pythondev | help | Make sure nothing breaks?^^^ | 2019-03-13T10:22:39.432100 | Nieves | pythondev_help_Nieves_2019-03-13T10:22:39.432100 | 1,552,472,559.4321 | 13,129 |
pythondev | help | That is basics for testing | 2019-03-13T10:22:52.432700 | Nieves | pythondev_help_Nieves_2019-03-13T10:22:52.432700 | 1,552,472,572.4327 | 13,130 |
pythondev | help | The big thing for testing with serverless is honestly the same with testing otherwise - make sure it's easy to decouple your code from whatever is calling it (i.e. the serverless framework) and then test against expected inputs. | 2019-03-13T10:23:37.434800 | Karoline | pythondev_help_Karoline_2019-03-13T10:23:37.434800 | 1,552,472,617.4348 | 13,131 |
pythondev | help | i.e. relying more on unit and integration tests than higher level tests | 2019-03-13T10:24:54.437400 | Karoline | pythondev_help_Karoline_2019-03-13T10:24:54.437400 | 1,552,472,694.4374 | 13,132 |
pythondev | help | let's say I have a function that takes as an input three integers separated by spaces. I'm trying to map each integer provided as input to another value. something like:
```
weight = [2, 4, 6]
def computeWeight(input):
computedWeight = []
for i, n in enumerate(input.split()):
computedWeight.append(n*weight[i])
return computedWeight
so computeWeight("1 2 1") should return [2, 8, 6]
```
but my logic seems to be a bit off :sweat_smile: | 2019-03-13T10:25:34.438600 | Genaro | pythondev_help_Genaro_2019-03-13T10:25:34.438600 | 1,552,472,734.4386 | 13,133 |
pythondev | help | Ok, I will have to look into these types of tests then, thanks <@Karoline> :taco: | 2019-03-13T10:29:09.439100 | Ursula | pythondev_help_Ursula_2019-03-13T10:29:09.439100 | 1,552,472,949.4391 | 13,134 |
pythondev | help | you need to split on the spaces, and cast n to an integer to make this work. But I’m not sure this is the best way to do it. | 2019-03-13T10:29:56.439300 | Ingeborg | pythondev_help_Ingeborg_2019-03-13T10:29:56.439300 | 1,552,472,996.4393 | 13,135 |
pythondev | help | ahhh, yeah casting n to an integer seems to make it return the right result.
but i agree, i'm not sure if this is the best way to do it | 2019-03-13T10:32:08.439800 | Genaro | pythondev_help_Genaro_2019-03-13T10:32:08.439800 | 1,552,473,128.4398 | 13,136 |
pythondev | help | you could try a list comprehension | 2019-03-13T10:32:32.440000 | Shawana | pythondev_help_Shawana_2019-03-13T10:32:32.440000 | 1,552,473,152.44 | 13,137 |
pythondev | help | I really need to get better at using list comprehensions. i'm not sure how would I refactor this code to use a list comprehension instead :sweat_smile: | 2019-03-13T10:33:52.440400 | Genaro | pythondev_help_Genaro_2019-03-13T10:33:52.440400 | 1,552,473,232.4404 | 13,138 |
pythondev | help | If I was you I would split the logic and use list comprehension to make it a little neater. Something along the lines of
```
weight = [2, 4, 6]
input_ = [int(i) for i in input.split()]
computed_weight = [w*i for w, i in zip(weight, input_)]
``` | 2019-03-13T10:34:52.440600 | Ingeborg | pythondev_help_Ingeborg_2019-03-13T10:34:52.440600 | 1,552,473,292.4406 | 13,139 |
pythondev | help | yea, that's it
```
weight = [2, 4, 6]
input_ = ("1 2 1")
computed_weight = [w * i for w, i in zip(weight, [int(c) for c in input_.split()])]
``` | 2019-03-13T10:39:34.440800 | Shawana | pythondev_help_Shawana_2019-03-13T10:39:34.440800 | 1,552,473,574.4408 | 13,140 |
pythondev | help | or even shorter: `computed_weight = [w * int(i) for w, i in zip(weight, input_.split())]` | 2019-03-13T10:40:35.441000 | Shawana | pythondev_help_Shawana_2019-03-13T10:40:35.441000 | 1,552,473,635.441 | 13,141 |
pythondev | help | ahhhhh this is beautiful!! thanks so much <@Shawana> & <@Ingeborg> :taco:
I knew there had to be a better way to do this :sweat_smile: I'll study this code in detail | 2019-03-13T10:42:10.441300 | Genaro | pythondev_help_Genaro_2019-03-13T10:42:10.441300 | 1,552,473,730.4413 | 13,142 |
pythondev | help | your function would then be:
```
def compute_weight(input_, weight):
return [w * int(i) for w, i in zip(weight, input_.split())]
``` | 2019-03-13T10:46:37.441700 | Shawana | pythondev_help_Shawana_2019-03-13T10:46:37.441700 | 1,552,473,997.4417 | 13,143 |
pythondev | help | Can you guys evaluate my class and function comments here? I’m trying to get the format correct before I keep moving.
```
class HashTable():
"""A horribly simple HashTable implementation.
"""
def get(self, key):
"""Fetches the value of the given previous set key.
Args:
key (int or str or float): The key of the value of interest.
Returns:
any or None: The value that belongs to this key or None if not found.
"""
raise NotImplementedError
def put(self, key, value):
"""Stores the given value, relating it to the given key.
Args:
key (int or str or float): The key of the value of interest.
value (any): The value to store for this key.
"""
raise NotImplementedError
```
Torch me. I want to learn what’s good to do. | 2019-03-13T11:41:49.443000 | Cammie | pythondev_help_Cammie_2019-03-13T11:41:49.443000 | 1,552,477,309.443 | 13,144 |
pythondev | help | Use magic methods instead of `.get` and `.put` | 2019-03-13T11:42:29.443700 | Jonas | pythondev_help_Jonas_2019-03-13T11:42:29.443700 | 1,552,477,349.4437 | 13,145 |
pythondev | help | <https://docs.python.org/3/reference/datamodel.html#object.__getitem__> | 2019-03-13T11:42:50.444000 | Jonas | pythondev_help_Jonas_2019-03-13T11:42:50.444000 | 1,552,477,370.444 | 13,146 |
pythondev | help | then you can do `hashtable[key]` and `hashtable[key] = item` | 2019-03-13T11:43:06.444300 | Jonas | pythondev_help_Jonas_2019-03-13T11:43:06.444300 | 1,552,477,386.4443 | 13,147 |
pythondev | help | if you're targeting python 3, most of those docstrings are redundant | 2019-03-13T11:43:34.444700 | Jonas | pythondev_help_Jonas_2019-03-13T11:43:34.444700 | 1,552,477,414.4447 | 13,148 |
pythondev | help | `def __getitem__(self, key: Union[int, str, float]) -> Any` | 2019-03-13T11:43:53.445300 | Jonas | pythondev_help_Jonas_2019-03-13T11:43:53.445300 | 1,552,477,433.4453 | 13,149 |
pythondev | help | and if you're using the dunder methods the first line of the docstrings is also redundant | 2019-03-13T11:44:42.445900 | Jonas | pythondev_help_Jonas_2019-03-13T11:44:42.445900 | 1,552,477,482.4459 | 13,150 |
pythondev | help | ```class HashTable:
"A horribly simple HashTable implementation."
def __getitem__(self, key: Union[int, str, float]) -> Any:
raise NotImplementedError()
def __setitem__(self, key: Union[int, str, float], value: Any):
raise NotImplementedError()``` | 2019-03-13T11:45:51.447300 | Jonas | pythondev_help_Jonas_2019-03-13T11:45:51.447300 | 1,552,477,551.4473 | 13,151 |
pythondev | help | you can reduce the duplication of `Union[int, str, float]` by doing `Hashable = Union[int, str, float]` at the top, and `key: Hashable` in the signature. | 2019-03-13T11:46:37.447800 | Jonas | pythondev_help_Jonas_2019-03-13T11:46:37.447800 | 1,552,477,597.4478 | 13,152 |
pythondev | help | that being said, you would avoid specifying those types. Python objects have a `__hash__` method that returns "something that can be hashed", which in cPython is an integer | 2019-03-13T11:47:15.448400 | Jonas | pythondev_help_Jonas_2019-03-13T11:47:15.448400 | 1,552,477,635.4484 | 13,153 |
pythondev | help | So there isn't much reason to not just accept any "hashable" object as the key | 2019-03-13T11:47:44.449000 | Jonas | pythondev_help_Jonas_2019-03-13T11:47:44.449000 | 1,552,477,664.449 | 13,154 |
pythondev | help | in that case, the code would be | 2019-03-13T11:48:15.449300 | Jonas | pythondev_help_Jonas_2019-03-13T11:48:15.449300 | 1,552,477,695.4493 | 13,155 |
pythondev | help | ```
from typing import Hashable, Any
class HashTable:
"A horribly simple HashTable implementation."
def __getitem__(self, key: Hashable) -> Any:
raise NotImplementedError()
def __setitem__(self, key: Hashable, value: Any):
raise NotImplementedError()``` | 2019-03-13T11:49:06.449800 | Jonas | pythondev_help_Jonas_2019-03-13T11:49:06.449800 | 1,552,477,746.4498 | 13,156 |
pythondev | help | If you want your hashtable to be a 'true' Mapping implementation, you'd just do this: | 2019-03-13T11:49:30.450400 | Jonas | pythondev_help_Jonas_2019-03-13T11:49:30.450400 | 1,552,477,770.4504 | 13,157 |
pythondev | help | ```from collections.abc import MutableMapping
class HashTable(MutableMapping):
pass```
you'd then need to fill in the 5 special methods documented here: <https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes> | 2019-03-13T11:50:27.451600 | Jonas | pythondev_help_Jonas_2019-03-13T11:50:27.451600 | 1,552,477,827.4516 | 13,158 |
pythondev | help | Those are methods to get the length, iterate all keys, delete, set and update items. Once you've done that your class can in theory be used anywhere a dictionary can be. | 2019-03-13T11:51:04.452700 | Jonas | pythondev_help_Jonas_2019-03-13T11:51:04.452700 | 1,552,477,864.4527 | 13,159 |
pythondev | help | Is it really magic? | 2019-03-13T11:54:34.452900 | Nieves | pythondev_help_Nieves_2019-03-13T11:54:34.452900 | 1,552,478,074.4529 | 13,160 |
pythondev | help | ;) | 2019-03-13T11:54:37.453100 | Nieves | pythondev_help_Nieves_2019-03-13T11:54:37.453100 | 1,552,478,077.4531 | 13,161 |
pythondev | help | Im reading an article on building microservices (<https://medium.com/@ssola/building-microservices-with-python-part-i-5240a8dcc2fb>). It talks about using flask-injector. I am not too sure what a dependency injector is or why its neccessary, i have never used one. The official documentation goes too deep too quickly, does anyone know a good resource for me to understand this? | 2019-03-13T12:10:53.455200 | Ted | pythondev_help_Ted_2019-03-13T12:10:53.455200 | 1,552,479,053.4552 | 13,162 |
pythondev | help | <https://medium.freecodecamp.org/a-quick-intro-to-dependency-injection-what-it-is-and-when-to-use-it-7578c84fa88f> found this one from a quick google search | 2019-03-13T12:15:41.455600 | Carlo | pythondev_help_Carlo_2019-03-13T12:15:41.455600 | 1,552,479,341.4556 | 13,163 |
pythondev | help | examples are Java but the concepts are there and examples are really, really simple so shouldn't be a problem | 2019-03-13T12:16:01.456200 | Carlo | pythondev_help_Carlo_2019-03-13T12:16:01.456200 | 1,552,479,361.4562 | 13,164 |
pythondev | help | Thanks | 2019-03-13T12:16:11.456600 | Ted | pythondev_help_Ted_2019-03-13T12:16:11.456600 | 1,552,479,371.4566 | 13,165 |
pythondev | help | interesting to see DI in python | 2019-03-13T12:16:24.457000 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:16:24.457000 | 1,552,479,384.457 | 13,166 |
pythondev | help | doesn’t really have too much of a place in dynamic languages, IMO | 2019-03-13T12:16:36.457400 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:16:36.457400 | 1,552,479,396.4574 | 13,167 |
pythondev | help | what do you mean? | 2019-03-13T12:17:55.458400 | Carlo | pythondev_help_Carlo_2019-03-13T12:17:55.458400 | 1,552,479,475.4584 | 13,168 |
pythondev | help | DI is used to dynamically bind dependencies based on a configuration | 2019-03-13T12:18:23.458900 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:18:23.458900 | 1,552,479,503.4589 | 13,169 |
pythondev | help | with java, you would need it because its a statically typed language | 2019-03-13T12:18:45.459500 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:18:45.459500 | 1,552,479,525.4595 | 13,170 |
pythondev | help | so you can inject dependencies at runtime, rather than compiletime | 2019-03-13T12:19:00.460100 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:19:00.460100 | 1,552,479,540.4601 | 13,171 |
pythondev | help | with dynamic languages like python, well.. its dynamic | 2019-03-13T12:19:14.460600 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:19:14.460600 | 1,552,479,554.4606 | 13,172 |
pythondev | help | so you don’t need that injection, because its already built in the language features | 2019-03-13T12:19:37.461300 | Hiroko | pythondev_help_Hiroko_2019-03-13T12:19:37.461300 | 1,552,479,577.4613 | 13,173 |
pythondev | help | well... you don't need the concept of a dedicated "DI container" that much indeed | 2019-03-13T12:21:01.461900 | Carlo | pythondev_help_Carlo_2019-03-13T12:21:01.461900 | 1,552,479,661.4619 | 13,174 |
pythondev | help | as a general pattern though DI can help a lot with respecting IoC | 2019-03-13T12:22:09.463300 | Carlo | pythondev_help_Carlo_2019-03-13T12:22:09.463300 | 1,552,479,729.4633 | 13,175 |
pythondev | help | from what i understand in the context of java you would use DI, but in python can i not just import it? | 2019-03-13T12:23:56.463900 | Ted | pythondev_help_Ted_2019-03-13T12:23:56.463900 | 1,552,479,836.4639 | 13,176 |
pythondev | help | don't pytest fixtures count as dependency injection? | 2019-03-13T12:34:46.464700 | Jonas | pythondev_help_Jonas_2019-03-13T12:34:46.464700 | 1,552,480,486.4647 | 13,177 |
pythondev | help | afaik yes | 2019-03-13T12:35:23.465100 | Carlo | pythondev_help_Carlo_2019-03-13T12:35:23.465100 | 1,552,480,523.4651 | 13,178 |
pythondev | help | <@Ted> basically dependency injection is a subset of a pattern known as Inversion of Control, basically meaning objects/functions receive their dependencies instead of creating them themselves | 2019-03-13T12:48:10.466300 | Carlo | pythondev_help_Carlo_2019-03-13T12:48:10.466300 | 1,552,481,290.4663 | 13,179 |
pythondev | help | DI is a way to provide these dependencies to the dependants | 2019-03-13T12:48:29.466700 | Carlo | pythondev_help_Carlo_2019-03-13T12:48:29.466700 | 1,552,481,309.4667 | 13,180 |
pythondev | help | Thanks I think i sort of understand it. im just going to play around with the package until i fully get it | 2019-03-13T12:49:42.468800 | Ted | pythondev_help_Ted_2019-03-13T12:49:42.468800 | 1,552,481,382.4688 | 13,181 |
pythondev | help | Why Java stuff in Py? | 2019-03-13T12:59:57.470500 | Nieves | pythondev_help_Nieves_2019-03-13T12:59:57.470500 | 1,552,481,997.4705 | 13,182 |
pythondev | help | Never mix two languages together unless it is unavoidable and no module/lib is available | 2019-03-13T13:00:25.471400 | Nieves | pythondev_help_Nieves_2019-03-13T13:00:25.471400 | 1,552,482,025.4714 | 13,183 |
pythondev | help | But I think I missed most of the conversation | 2019-03-13T13:00:35.471800 | Nieves | pythondev_help_Nieves_2019-03-13T13:00:35.471800 | 1,552,482,035.4718 | 13,184 |
pythondev | help | It's a concept, not an implementation :+1: | 2019-03-13T13:00:50.472200 | Jonas | pythondev_help_Jonas_2019-03-13T13:00:50.472200 | 1,552,482,050.4722 | 13,185 |
pythondev | help | one that's prevalent in Java | 2019-03-13T13:01:03.472400 | Jonas | pythondev_help_Jonas_2019-03-13T13:01:03.472400 | 1,552,482,063.4724 | 13,186 |
pythondev | help | Ah. Yeah. Java is bad... it just is. | 2019-03-13T13:01:44.472900 | Nieves | pythondev_help_Nieves_2019-03-13T13:01:44.472900 | 1,552,482,104.4729 | 13,187 |
pythondev | help | (Doesn’t like Python much either) | 2019-03-13T13:01:57.473200 | Nieves | pythondev_help_Nieves_2019-03-13T13:01:57.473200 | 1,552,482,117.4732 | 13,188 |
pythondev | help | meh | 2019-03-13T13:47:49.473600 | Carlo | pythondev_help_Carlo_2019-03-13T13:47:49.473600 | 1,552,484,869.4736 | 13,189 |
pythondev | help | I might not like it that much, but it didn't get to where it is by being _that_ terrible I guess :stuck_out_tongue: | 2019-03-13T13:48:31.474300 | Carlo | pythondev_help_Carlo_2019-03-13T13:48:31.474300 | 1,552,484,911.4743 | 13,190 |
pythondev | help | but again I work with a lot of PHP and JS so I probably like pain a little bit too much? | 2019-03-13T13:49:05.475000 | Carlo | pythondev_help_Carlo_2019-03-13T13:49:05.475000 | 1,552,484,945.475 | 13,191 |
pythondev | help | Is there such a thing as a Comprehension (like a list comprehension or dict comprehension) that does not return an iterable? | 2019-03-13T14:21:34.477200 | Romelia | pythondev_help_Romelia_2019-03-13T14:21:34.477200 | 1,552,486,894.4772 | 13,192 |
pythondev | help | Use case: I'm using list comprehensions to return a single value that I do not need to be a list object. I just want the single item returned. But I like the utility of list comprehensions for sorting through lists. | 2019-03-13T14:25:47.478200 | Romelia | pythondev_help_Romelia_2019-03-13T14:25:47.478200 | 1,552,487,147.4782 | 13,193 |
pythondev | help | you could use a lambda? | 2019-03-13T14:26:32.478400 | Hiroko | pythondev_help_Hiroko_2019-03-13T14:26:32.478400 | 1,552,487,192.4784 | 13,194 |
pythondev | help | you could get the `[0]` index? | 2019-03-13T14:29:38.478900 | Joette | pythondev_help_Joette_2019-03-13T14:29:38.478900 | 1,552,487,378.4789 | 13,195 |
pythondev | help | I've done the `[0]` trick before but wondered if there were other ways | 2019-03-13T14:31:10.479500 | Romelia | pythondev_help_Romelia_2019-03-13T14:31:10.479500 | 1,552,487,470.4795 | 13,196 |
pythondev | help | you could use a generator expression and `next` | 2019-03-13T14:37:16.480000 | Joette | pythondev_help_Joette_2019-03-13T14:37:16.480000 | 1,552,487,836.48 | 13,197 |
pythondev | help | `next((i for in in some_list))` | 2019-03-13T14:37:29.480300 | Joette | pythondev_help_Joette_2019-03-13T14:37:29.480300 | 1,552,487,849.4803 | 13,198 |
pythondev | help | I don't see any problem with using the list index though | 2019-03-13T14:37:56.480800 | Joette | pythondev_help_Joette_2019-03-13T14:37:56.480800 | 1,552,487,876.4808 | 13,199 |
pythondev | help | Just felt dirty to me for some reason :stuck_out_tongue: | 2019-03-13T14:41:05.481500 | Romelia | pythondev_help_Romelia_2019-03-13T14:41:05.481500 | 1,552,488,065.4815 | 13,200 |
pythondev | help | put it in a `try/except IndexError` block and call it a day ¯\_(ツ)_/¯ | 2019-03-13T14:42:39.481900 | Joette | pythondev_help_Joette_2019-03-13T14:42:39.481900 | 1,552,488,159.4819 | 13,201 |
pythondev | help | Perhaps `var = ",".join([i for i in list_of_thing if i == x])` would work? | 2019-03-13T14:44:14.483400 | Romelia | pythondev_help_Romelia_2019-03-13T14:44:14.483400 | 1,552,488,254.4834 | 13,202 |
pythondev | help | That way, if there WAS more than one output in the list for some reason at least it would return one value? | 2019-03-13T14:44:57.484000 | Romelia | pythondev_help_Romelia_2019-03-13T14:44:57.484000 | 1,552,488,297.484 | 13,203 |
pythondev | help | Does the `[0]` work with a generator, or does it require a list conversion? | 2019-03-13T14:45:19.484600 | Sasha | pythondev_help_Sasha_2019-03-13T14:45:19.484600 | 1,552,488,319.4846 | 13,204 |
pythondev | help | it requires a list | 2019-03-13T14:45:31.485200 | Joette | pythondev_help_Joette_2019-03-13T14:45:31.485200 | 1,552,488,331.4852 | 13,205 |
pythondev | help | rather, it won't work with a generator, unless you use `list` first | 2019-03-13T14:45:52.485800 | Joette | pythondev_help_Joette_2019-03-13T14:45:52.485800 | 1,552,488,352.4858 | 13,206 |
pythondev | help | eh i hate to be a crossposting crossposter but if anyone loves dealing with wonky noob `import` bugs and doesn't follow <#C07EW4DNE|learning_python> i just wall-of-text'd over there | 2019-03-13T15:53:44.488500 | Claudine | pythondev_help_Claudine_2019-03-13T15:53:44.488500 | 1,552,492,424.4885 | 13,207 |
pythondev | help | hi | 2019-03-13T17:54:03.489600 | Tasha | pythondev_help_Tasha_2019-03-13T17:54:03.489600 | 1,552,499,643.4896 | 13,208 |
pythondev | help | HI, I'm confused! When i create a custom class that inherites from Exception, then i extend this class with subclasses, how does Python reverse the lookup to the base class?
```
class ParentError(Exception):
message("parent msg")
class ChildError(Parent):
message(" child msg")
# raise an error somewhere:
raise ChildError()
# then somewhere catch the Child error via the Parent:
try:
except Parent as err:
. # catches ChildError() ...? ``` | 2019-03-13T17:54:22.490100 | Tasha | pythondev_help_Tasha_2019-03-13T17:54:22.490100 | 1,552,499,662.4901 | 13,209 |
pythondev | help | with `__subclasses__()`? | 2019-03-13T17:57:50.490500 | Tasha | pythondev_help_Tasha_2019-03-13T17:57:50.490500 | 1,552,499,870.4905 | 13,210 |
pythondev | help | my guess is that it just uses `isinstance()` check | 2019-03-13T18:29:05.490900 | Kendra | pythondev_help_Kendra_2019-03-13T18:29:05.490900 | 1,552,501,745.4909 | 13,211 |
pythondev | help | was wrong. | 2019-03-13T18:35:42.491700 | Kendra | pythondev_help_Kendra_2019-03-13T18:35:42.491700 | 1,552,502,142.4917 | 13,212 |
pythondev | help | ok thanks anyway | 2019-03-13T18:36:21.492400 | Tasha | pythondev_help_Tasha_2019-03-13T18:36:21.492400 | 1,552,502,181.4924 | 13,213 |
pythondev | help | It probably uses `.mro()` | 2019-03-13T18:36:49.493100 | Kendra | pythondev_help_Kendra_2019-03-13T18:36:49.493100 | 1,552,502,209.4931 | 13,214 |
pythondev | help | but if you want to know details you'd have to look into C code | 2019-03-13T18:37:00.493500 | Kendra | pythondev_help_Kendra_2019-03-13T18:37:00.493500 | 1,552,502,220.4935 | 13,215 |
pythondev | help | why do you need to know this? | 2019-03-13T18:37:45.494600 | Kendra | pythondev_help_Kendra_2019-03-13T18:37:45.494600 | 1,552,502,265.4946 | 13,216 |
pythondev | help | I have a 4D Numpy array from which I want to delete the first two elements around axis 0. I tried ```A = A[2:,:,:,:]``` | 2019-03-13T18:38:45.497000 | Angele | pythondev_help_Angele_2019-03-13T18:38:45.497000 | 1,552,502,325.497 | 13,217 |
pythondev | help | But the result looks incorrect | 2019-03-13T18:38:53.497500 | Angele | pythondev_help_Angele_2019-03-13T18:38:53.497500 | 1,552,502,333.4975 | 13,218 |
pythondev | help | ahh, at work today another developer asked me to just use the parent class to catch the exceptions, lik ein the example | 2019-03-13T18:38:54.497600 | Tasha | pythondev_help_Tasha_2019-03-13T18:38:54.497600 | 1,552,502,334.4976 | 13,219 |
pythondev | help | i just cant understand hjow it works lol | 2019-03-13T18:39:01.498000 | Tasha | pythondev_help_Tasha_2019-03-13T18:39:01.498000 | 1,552,502,341.498 | 13,220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.