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 | is there a channel where i can ask for help with my algorithm or abstract solution to a given problem, without posting any code? Or rather get feedback if i did well or where i could improve. | 2019-04-15T07:24:40.402100 | Leida | pythondev_help_Leida_2019-04-15T07:24:40.402100 | 1,555,313,080.4021 | 18,821 |
pythondev | help | would <#C8W1XRJSE|architecture> be the right place? | 2019-04-15T07:29:38.402700 | Leida | pythondev_help_Leida_2019-04-15T07:29:38.402700 | 1,555,313,378.4027 | 18,822 |
pythondev | help | here is as good as any | 2019-04-15T07:32:07.403000 | Hiroko | pythondev_help_Hiroko_2019-04-15T07:32:07.403000 | 1,555,313,527.403 | 18,823 |
pythondev | help | alright :smile: | 2019-04-15T07:35:07.403200 | Leida | pythondev_help_Leida_2019-04-15T07:35:07.403200 | 1,555,313,707.4032 | 18,824 |
pythondev | help | The problem:
```Create a programme that uses any text file with random content as an input, and checks all the words contained in such text file for letter combinations consisting of more than 3 letters.
Programme output will consist in up to 10 most common letter combinations and their difference in percentage displayed as a table and a bar chart.
``` | 2019-04-15T07:35:28.403500 | Leida | pythondev_help_Leida_2019-04-15T07:35:28.403500 | 1,555,313,728.4035 | 18,825 |
pythondev | help | Sample solution:```
The content of the input file:
hall feels heels
Output:
Frequencies:
eels: 28.57%
feel: 14.29%
heel: 14.29%
hall: 14.29%
feels: 14.29%
heels: 14.29%
``` | 2019-04-15T07:35:44.403700 | Leida | pythondev_help_Leida_2019-04-15T07:35:44.403700 | 1,555,313,744.4037 | 18,826 |
pythondev | help | My solution:```
1. Character stream -> 2. word detector and input buffer -> 3. combinations finder -> 4. storage. -> End of file -> 5. sorting -> 6. table/graph output.
1. Character stream.
Reads the file one character at a time.
2. Word detector and input buffer.
Has internal memory for several characters. When an invalid character is received the buffer is reset to empty. When there are 4 or more characters in the buffer, the contents of the buffer are emited to the next function in the pipeline. Even after emitting, the contents are kept. Only invalid characters reset the buffer.
3. Combinations finder.
The received word is the first combination. It gets emitted into the following function. Remove the first character in the word. If the length is atleast 4 emit that too. Keep removing the first letter and emitting until there are less than 4 characters.
4. Storage.
Stores the combination and the occurance count. If the combination exists add 1 to the counter. If it doesnt exist set it to 1. After adding each occurance add 1 to total counter.
End of file reached.
5. Sorting.
Read through the stored data and keep track of the 10 most used combinations.
6. Print table and diagram.
Table - each row is the combination + the occurance percentage. Percentage is the number of occurances/total combinations * 100%.
Diagram can be an ascii of |-------. Percentage * “-” as the bar.
Both need some formating to look nice.
``` | 2019-04-15T07:35:59.403900 | Leida | pythondev_help_Leida_2019-04-15T07:35:59.403900 | 1,555,313,759.4039 | 18,827 |
pythondev | help | The goal is to optimize it to the max, handle all the errors and general showing off of skills ^^ | 2019-04-15T07:39:44.404600 | Leida | pythondev_help_Leida_2019-04-15T07:39:44.404600 | 1,555,313,984.4046 | 18,828 |
pythondev | help | `collections.Counter(file.read().split(“ “)).most_common(10)` | 2019-04-15T08:10:03.405900 | Jonas | pythondev_help_Jonas_2019-04-15T08:10:03.405900 | 1,555,315,803.4059 | 18,829 |
pythondev | help | Recently I have started to import modules or other scripts inside functions so they are only imported if I need them. Is this good practice? If not, why? | 2019-04-15T08:20:14.406900 | Conchita | pythondev_help_Conchita_2019-04-15T08:20:14.406900 | 1,555,316,414.4069 | 18,830 |
pythondev | help | ```
def collect(url):
import request
# do something
``` | 2019-04-15T08:21:25.408100 | Conchita | pythondev_help_Conchita_2019-04-15T08:21:25.408100 | 1,555,316,485.4081 | 18,831 |
pythondev | help | would have to split the words into combinations tho: "words" becomes "word", "ords", "words" | 2019-04-15T08:27:14.409000 | Leida | pythondev_help_Leida_2019-04-15T08:27:14.409000 | 1,555,316,834.409 | 18,832 |
pythondev | help | i like the Counter tho :smile: | 2019-04-15T08:28:18.409200 | Leida | pythondev_help_Leida_2019-04-15T08:28:18.409200 | 1,555,316,898.4092 | 18,833 |
pythondev | help | probably better for performance, but i think PEP8 prefers if all imports are at the top of the file. I might be wrong though
<https://www.python.org/dev/peps/pep-0008/#imports> | 2019-04-15T08:29:24.409400 | Renay | pythondev_help_Renay_2019-04-15T08:29:24.409400 | 1,555,316,964.4094 | 18,834 |
pythondev | help | so `split()` should be replaced by some `tokenize()` | 2019-04-15T08:29:30.409700 | Leida | pythondev_help_Leida_2019-04-15T08:29:30.409700 | 1,555,316,970.4097 | 18,835 |
pythondev | help | umm i think i have seen it used in the wild but in general if you have a function in a file that needs some imports but its never used then why have the function? | 2019-04-15T08:37:36.410800 | Leida | pythondev_help_Leida_2019-04-15T08:37:36.410800 | 1,555,317,456.4108 | 18,836 |
pythondev | help | what happens when you try to import again? | 2019-04-15T08:39:02.412200 | Leida | pythondev_help_Leida_2019-04-15T08:39:02.412200 | 1,555,317,542.4122 | 18,837 |
pythondev | help | wouldnt that incur some overhead? | 2019-04-15T08:39:16.412500 | Leida | pythondev_help_Leida_2019-04-15T08:39:16.412500 | 1,555,317,556.4125 | 18,838 |
pythondev | help | import are cached so not really | 2019-04-15T08:39:33.412900 | Jimmy | pythondev_help_Jimmy_2019-04-15T08:39:33.412900 | 1,555,317,573.4129 | 18,839 |
pythondev | help | but I think it's considered good practice to have all imports at the same place (the top) | 2019-04-15T08:39:51.413400 | Jimmy | pythondev_help_Jimmy_2019-04-15T08:39:51.413400 | 1,555,317,591.4134 | 18,840 |
pythondev | help | I could see an use case if importing a module takes a lot of time otherwise meh | 2019-04-15T08:40:36.414100 | Jimmy | pythondev_help_Jimmy_2019-04-15T08:40:36.414100 | 1,555,317,636.4141 | 18,841 |
pythondev | help | The functions are there because they are sometime used | 2019-04-15T08:40:46.414400 | Conchita | pythondev_help_Conchita_2019-04-15T08:40:46.414400 | 1,555,317,646.4144 | 18,842 |
pythondev | help | because you'll need to duplicate import for each function to be sure it's imported there | 2019-04-15T08:40:56.414900 | Jimmy | pythondev_help_Jimmy_2019-04-15T08:40:56.414900 | 1,555,317,656.4149 | 18,843 |
pythondev | help | so more work for almost no gain | 2019-04-15T08:41:03.415300 | Jimmy | pythondev_help_Jimmy_2019-04-15T08:41:03.415300 | 1,555,317,663.4153 | 18,844 |
pythondev | help | Yes someone linked me the pep-8 guide where it states you should have all imports in the first lines | 2019-04-15T08:41:36.416100 | Conchita | pythondev_help_Conchita_2019-04-15T08:41:36.416100 | 1,555,317,696.4161 | 18,845 |
pythondev | help | Yep it does say that! Thanks! | 2019-04-15T08:41:48.416200 | Conchita | pythondev_help_Conchita_2019-04-15T08:41:48.416200 | 1,555,317,708.4162 | 18,846 |
pythondev | help | the only case I can see using imports locally in a function is if you’re doing something with async tasks that don’t get called frequently | 2019-04-15T08:54:20.416900 | Hiroko | pythondev_help_Hiroko_2019-04-15T08:54:20.416900 | 1,555,318,460.4169 | 18,847 |
pythondev | help | I would also say that its a negative for readability and knowing what stuff is being used | 2019-04-15T08:55:06.417400 | Hiroko | pythondev_help_Hiroko_2019-04-15T08:55:06.417400 | 1,555,318,506.4174 | 18,848 |
pythondev | help | for example, you have a file with lots of functions in it that are dedicated to a thing. If you continually import locally, you get lots of duplicated imports | 2019-04-15T08:55:49.418200 | Hiroko | pythondev_help_Hiroko_2019-04-15T08:55:49.418200 | 1,555,318,549.4182 | 18,849 |
pythondev | help | The other case is if you have circular imports | 2019-04-15T08:57:06.419200 | Jonas | pythondev_help_Jonas_2019-04-15T08:57:06.419200 | 1,555,318,626.4192 | 18,850 |
pythondev | help | which happens in some specific cases that are hard to avoid. But in general, no, please don't do that kind of import :smile: Add them to the top. | 2019-04-15T08:57:36.420100 | Jonas | pythondev_help_Jonas_2019-04-15T08:57:36.420100 | 1,555,318,656.4201 | 18,851 |
pythondev | help | if you have circular imports you ought to look at refactoring your code. There are ways around it | 2019-04-15T08:58:56.421000 | Renay | pythondev_help_Renay_2019-04-15T08:58:56.421000 | 1,555,318,736.421 | 18,852 |
pythondev | help | I think you want <https://docs.python.org/3/library/itertools.html#itertools.product> for tha | 2019-04-15T08:59:02.421100 | Jonas | pythondev_help_Jonas_2019-04-15T08:59:02.421100 | 1,555,318,742.4211 | 18,853 |
pythondev | help | not always unfortunately :disappointed: | 2019-04-15T08:59:13.421900 | Jonas | pythondev_help_Jonas_2019-04-15T08:59:13.421900 | 1,555,318,753.4219 | 18,854 |
pythondev | help | and in some cases refactoring the code is worse | 2019-04-15T08:59:33.422500 | Jonas | pythondev_help_Jonas_2019-04-15T08:59:33.422500 | 1,555,318,773.4225 | 18,855 |
pythondev | help | you end up splitting your code out in illogical places just to avoid it | 2019-04-15T08:59:44.422800 | Jonas | pythondev_help_Jonas_2019-04-15T08:59:44.422800 | 1,555,318,784.4228 | 18,856 |
pythondev | help | but in general your approach is sound <@Leida>. Try and code it and we can give more feedback | 2019-04-15T09:01:06.423000 | Jonas | pythondev_help_Jonas_2019-04-15T09:01:06.423000 | 1,555,318,866.423 | 18,857 |
pythondev | help | thank you for taking a look! | 2019-04-15T09:03:28.423200 | Leida | pythondev_help_Leida_2019-04-15T09:03:28.423200 | 1,555,319,008.4232 | 18,858 |
pythondev | help | Meh. In C-like languages, declaring all variables at the top of the scope used to be required, then it held on as a style guide rule, and then finally fell out of favor a long time ago. Because declaring names close to the point of use is useful. Python imports are a similar mechanism, so the PEP8 rule always seemed wrong as a hard rule. Prefer the top, but don't insist on it. | 2019-04-15T10:03:47.431800 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:03:47.431800 | 1,555,322,627.4318 | 18,859 |
pythondev | help | problem I see with that is when you’re declaring at points of multiple usage, the scope of the import doesn’t bubble up | 2019-04-15T10:06:19.432900 | Hiroko | pythondev_help_Hiroko_2019-04-15T10:06:19.432900 | 1,555,322,779.4329 | 18,860 |
pythondev | help | so you end up having to import the same thing multiple times | 2019-04-15T10:06:38.433300 | Hiroko | pythondev_help_Hiroko_2019-04-15T10:06:38.433300 | 1,555,322,798.4333 | 18,861 |
pythondev | help | and whats the “point of usage”? | 2019-04-15T10:06:47.433700 | Hiroko | pythondev_help_Hiroko_2019-04-15T10:06:47.433700 | 1,555,322,807.4337 | 18,862 |
pythondev | help | that can work the first time around for a simple thing, but I can see that being a pain in the butt for a larger project | 2019-04-15T10:07:21.434300 | Hiroko | pythondev_help_Hiroko_2019-04-15T10:07:21.434300 | 1,555,322,841.4343 | 18,863 |
pythondev | help | Sure, so the widely used ones go at the top. In general, doing a good job at organizing will probably lead to that. But maybe in a less critical script I'm defining a CLI at the bottom and that's where I want argparse and sys if that's the only place I need it | 2019-04-15T10:13:47.438300 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:13:47.438300 | 1,555,323,227.4383 | 18,864 |
pythondev | help | Extreme point of usage example `import pdb; pdb.set_trace()` | 2019-04-15T10:18:49.439300 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:18:49.439300 | 1,555,323,529.4393 | 18,865 |
pythondev | help | I use that alot, FWIW | 2019-04-15T10:24:53.439600 | Hiroko | pythondev_help_Hiroko_2019-04-15T10:24:53.439600 | 1,555,323,893.4396 | 18,866 |
pythondev | help | but it never makes it to a code commit | 2019-04-15T10:25:00.439900 | Hiroko | pythondev_help_Hiroko_2019-04-15T10:25:00.439900 | 1,555,323,900.4399 | 18,867 |
pythondev | help | Sure, but I'm arguing that the reasons that familiar idiom is useful don't vanish in literally all other cases | 2019-04-15T10:27:52.441300 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:27:52.441300 | 1,555,324,072.4413 | 18,868 |
pythondev | help | Interesting brain teaser from our CEO today:
> Write down the equation:
> 65 – 43 = 21.
> You’ll notice that this is not correct. 65 minus 43 equals 22, not 21. The object is to move exactly two of the digits to create a correct equation. There is no trick in the puzzle’s wording. In the answer, the minus and equal signs do not move.
I had a go using itertools to enumerate all possible swaps, and no equation is correct. But then I realised you can move digits rather than swap them: ie. `654 + 3 = 21` | 2019-04-15T10:29:12.444700 | Jonas | pythondev_help_Jonas_2019-04-15T10:29:12.444700 | 1,555,324,152.4447 | 18,869 |
pythondev | help | So my question is: How would you solve this in Python? There has to be an elegant way, but it's escaping me | 2019-04-15T10:29:29.445600 | Jonas | pythondev_help_Jonas_2019-04-15T10:29:29.445600 | 1,555,324,169.4456 | 18,870 |
pythondev | help | Pandas uses it to manage some optional dependencies <https://github.com/pandas-dev/pandas/blob/v0.24.2/pandas/core/frame.py#L2119-L2131> . Is this the best possible way? Maybe not, but neither should they be forced to restructure "because PEP8" | 2019-04-15T10:30:30.447200 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:30:30.447200 | 1,555,324,230.4472 | 18,871 |
pythondev | help | I have a function that accepts kwargs into it, but then also within that function I call other functions that I pass different kwargs to, is there a specific naming convention to follow when this situation occurs?
```
def my_func(a, b, **kwargs):
if 'something' in kwargs:
#do something
#is there a specific naming convention?
kwargs = {'something_else':True}
c = 'Hello'
d = 'world'
call_other_function(c , d, **kwargs)
``` | 2019-04-15T10:31:08.448000 | Arturo | pythondev_help_Arturo_2019-04-15T10:31:08.448000 | 1,555,324,268.448 | 18,872 |
pythondev | help | maybe using `itertools.combinations` ? :thinking_face: | 2019-04-15T10:33:04.448500 | Jimmy | pythondev_help_Jimmy_2019-04-15T10:33:04.448500 | 1,555,324,384.4485 | 18,873 |
pythondev | help | yeah, but you need to account for all possible movements | 2019-04-15T10:34:46.448800 | Jonas | pythondev_help_Jonas_2019-04-15T10:34:46.448800 | 1,555,324,486.4488 | 18,874 |
pythondev | help | that is, switching two numbers as well as shifting them between expressions | 2019-04-15T10:35:06.449000 | Jonas | pythondev_help_Jonas_2019-04-15T10:35:06.449000 | 1,555,324,506.449 | 18,875 |
pythondev | help | And, exactly two movements | 2019-04-15T10:36:33.449200 | Jonas | pythondev_help_Jonas_2019-04-15T10:36:33.449200 | 1,555,324,593.4492 | 18,876 |
pythondev | help | that's actually a tricky one hehe | 2019-04-15T10:38:06.449500 | Carlo | pythondev_help_Carlo_2019-04-15T10:38:06.449500 | 1,555,324,686.4495 | 18,877 |
pythondev | help | I was going on about some solution using all permutations then moving operands around but kinda forgot about the two movements thing lol | 2019-04-15T10:38:47.449700 | Carlo | pythondev_help_Carlo_2019-04-15T10:38:47.449700 | 1,555,324,727.4497 | 18,878 |
pythondev | help | options? | 2019-04-15T10:39:43.450100 | Jettie | pythondev_help_Jettie_2019-04-15T10:39:43.450100 | 1,555,324,783.4501 | 18,879 |
pythondev | help | kwargs is a convention when you declare a function, but apart from that if you create a dict to later unpack into another function call you're free to use any name | 2019-04-15T10:40:15.450800 | Jettie | pythondev_help_Jettie_2019-04-15T10:40:15.450800 | 1,555,324,815.4508 | 18,880 |
pythondev | help | it reminds me when <@Genesis> used to ask some trick question :stuck_out_tongue: | 2019-04-15T10:41:19.450900 | Jimmy | pythondev_help_Jimmy_2019-04-15T10:41:19.450900 | 1,555,324,879.4509 | 18,881 |
pythondev | help | If it was one we could just do something super hacky: `[eval(x) for x in itertools.permutations(['6', '5', '-', '4', '3', '==', '2', '1'])]` | 2019-04-15T10:41:52.451100 | Jonas | pythondev_help_Jonas_2019-04-15T10:41:52.451100 | 1,555,324,912.4511 | 18,882 |
pythondev | help | :grimacing: | 2019-04-15T10:42:09.451300 | Genesis | pythondev_help_Genesis_2019-04-15T10:42:09.451300 | 1,555,324,929.4513 | 18,883 |
pythondev | help | obviously catching any invalid syntax errors, but it would enumerate all possible movements. | 2019-04-15T10:42:11.451500 | Jonas | pythondev_help_Jonas_2019-04-15T10:42:11.451500 | 1,555,324,931.4515 | 18,884 |
pythondev | help | but yeah, accounting for exactly two moves? I'm really not sure how to do that | 2019-04-15T10:42:32.451700 | Jonas | pythondev_help_Jonas_2019-04-15T10:42:32.451700 | 1,555,324,952.4517 | 18,885 |
pythondev | help | To handle shifts, maybe start by getting a list of each digit. And then do some slicing. Not sure that will pan out | 2019-04-15T10:44:29.451900 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:44:29.451900 | 1,555,325,069.4519 | 18,886 |
pythondev | help | This is fun. I'll write you up an answer in 30ish minutes | 2019-04-15T10:44:42.452100 | Genesis | pythondev_help_Genesis_2019-04-15T10:44:42.452100 | 1,555,325,082.4521 | 18,887 |
pythondev | help | Fwiw, matplotlob uses `subplot_kws`, `scatter_kws`. | 2019-04-15T10:46:03.453800 | Hildegard | pythondev_help_Hildegard_2019-04-15T10:46:03.453800 | 1,555,325,163.4538 | 18,888 |
pythondev | help | ```In [71]: for a1, b1, c1 in itertools.filterfalse(lambda a: sum(a)!=6, itertools.product(range(1, 4), range(1, 4), range(1, 4))):
...: for a_group, b_group, c_group in itertools.filterfalse(lambda a: len(set(a[0] + a[1] + a[2])) != len(numbers), itertools.product(itertools.permutations(numbers, a1), itertools.permutations(numbers, b1), itertools.permutations(numbers, c1))):
...: # print(a_group, b_group, c_group)
...: a = int("".join(a_group))
...: b = int("".join(b_group))
...: c = int("".join(c_group))
...: if (a - b) == c:
...: print(a, b, c)
...: break
...:
...:``` This bruteforces every possible combination of those numbers in that sum, and it still doesn't find anything valid :confused: | 2019-04-15T11:04:07.454500 | Jonas | pythondev_help_Jonas_2019-04-15T11:04:07.454500 | 1,555,326,247.4545 | 18,889 |
pythondev | help | im reading online that you can call an dictionary index via 'd.keys()[0]'. however, im getting an error ''dict_keys' object does not support indexing'. Is this truly possible? | 2019-04-15T11:06:37.455400 | Nenita | pythondev_help_Nenita_2019-04-15T11:06:37.455400 | 1,555,326,397.4554 | 18,890 |
pythondev | help | > There is no trick in the puzzle’s wording
<@Jonas> if that's the case I have a feeling this doesn't mean "there is no trick at all" | 2019-04-15T11:06:38.455500 | Carlo | pythondev_help_Carlo_2019-04-15T11:06:38.455500 | 1,555,326,398.4555 | 18,891 |
pythondev | help | what python version? | 2019-04-15T11:07:02.455800 | Clemmie | pythondev_help_Clemmie_2019-04-15T11:07:02.455800 | 1,555,326,422.4558 | 18,892 |
pythondev | help | 3 | 2019-04-15T11:07:40.456000 | Nenita | pythondev_help_Nenita_2019-04-15T11:07:40.456000 | 1,555,326,460.456 | 18,893 |
pythondev | help | it did say that in 2 you can use .keys()[index], but was hoping there was some method in 3 | 2019-04-15T11:08:01.456700 | Nenita | pythondev_help_Nenita_2019-04-15T11:08:01.456700 | 1,555,326,481.4567 | 18,894 |
pythondev | help | I think in 3 they changed `.keys()` to return a `dict_keys` object instead of a standard list, which might be causing that issue | 2019-04-15T11:08:40.458100 | Cherish | pythondev_help_Cherish_2019-04-15T11:08:40.458100 | 1,555,326,520.4581 | 18,895 |
pythondev | help | yeah, in python 3 `keys()` is a view object - you want to do `list(d.keys())[0]` | 2019-04-15T11:08:48.458300 | Clemmie | pythondev_help_Clemmie_2019-04-15T11:08:48.458300 | 1,555,326,528.4583 | 18,896 |
pythondev | help | ```python -c "d = {'a': 1, 'b': 2}; print(type(d.keys()))"
<class 'dict_keys'>``` | 2019-04-15T11:08:50.458500 | Cherish | pythondev_help_Cherish_2019-04-15T11:08:50.458500 | 1,555,326,530.4585 | 18,897 |
pythondev | help | alright, perfectly solved my problem. Thank you. List seems to be a very power function (if its a function :confused:, i read that len() isn't considered a function). | 2019-04-15T11:10:03.459400 | Nenita | pythondev_help_Nenita_2019-04-15T11:10:03.459400 | 1,555,326,603.4594 | 18,898 |
pythondev | help | list isn’t a function - when you call that around an iterable you are `cast` ing | 2019-04-15T11:11:44.459800 | Clemmie | pythondev_help_Clemmie_2019-04-15T11:11:44.459800 | 1,555,326,704.4598 | 18,899 |
pythondev | help | <@Jonas> doesnt look like you considered changing the answer as well | 2019-04-15T11:13:10.459900 | Genesis | pythondev_help_Genesis_2019-04-15T11:13:10.459900 | 1,555,326,790.4599 | 18,900 |
pythondev | help | I think I did? that's `c_group`. In any case, the apparent solution was `65 - 4^3 = 1^2` :joy: | 2019-04-15T11:14:22.460100 | Jonas | pythondev_help_Jonas_2019-04-15T11:14:22.460100 | 1,555,326,862.4601 | 18,901 |
pythondev | help | Oof | 2019-04-15T11:15:42.460600 | Genesis | pythondev_help_Genesis_2019-04-15T11:15:42.460600 | 1,555,326,942.4606 | 18,902 |
pythondev | help | a bit tricky | 2019-04-15T11:21:12.460800 | Jimmy | pythondev_help_Jimmy_2019-04-15T11:21:12.460800 | 1,555,327,272.4608 | 18,903 |
pythondev | help | I may be opening a can of worms with this question, but I'm a little confused on which tool I should use to handle python environments and packages. In my research I'm coming across things like `virtualenv`, `pipenv`, `poetry`, `conda`/`anaconda`. What's _good_, or what is considered _best practice_? | 2019-04-15T11:31:18.463300 | Nicholle | pythondev_help_Nicholle_2019-04-15T11:31:18.463300 | 1,555,327,878.4633 | 18,904 |
pythondev | help | I personally use Pyenv and virtualenvwrapper. The first is to “install” any python version you want either globally or locally and the second is to create environments, super convenient… check out this gist <https://gist.github.com/SebastiaAgramunt/5185ccf8637e69f611bd1217a98289b2> | 2019-04-15T11:47:07.463800 | Lance | pythondev_help_Lance_2019-04-15T11:47:07.463800 | 1,555,328,827.4638 | 18,905 |
pythondev | help | if you start now with python and data science anaconda is perhaps the easiest approach. Let me know if it helps or need me to explain something | 2019-04-15T11:48:34.464000 | Lance | pythondev_help_Lance_2019-04-15T11:48:34.464000 | 1,555,328,914.464 | 18,906 |
pythondev | help | Thanks, that makes sense. I think my problem is that I'm coming from languages with a _de-facto_ package management system (`npm`, `cargo`, `stack`, etc), and I'm finding that python doesn't have a _standard_ per se, and there are benefits and disadvantages to each approach. | 2019-04-15T11:58:41.464400 | Nicholle | pythondev_help_Nicholle_2019-04-15T11:58:41.464400 | 1,555,329,521.4644 | 18,907 |
pythondev | help | Well, in Python the package manager is pip. If you look at a typical python project there’s always a requirements.txt (you do ```pip install -r requirements.txt``` to install those in your environment) with all the packages you need and in the docu the python version the developer has used. I don’t know a lot of software development though… | 2019-04-15T12:04:42.464600 | Lance | pythondev_help_Lance_2019-04-15T12:04:42.464600 | 1,555,329,882.4646 | 18,908 |
pythondev | help | here’s the way to package your software <https://packaging.python.org/tutorials/packaging-projects/> | 2019-04-15T12:06:23.464900 | Lance | pythondev_help_Lance_2019-04-15T12:06:23.464900 | 1,555,329,983.4649 | 18,909 |
pythondev | help | Part of your confusion about a standard is that Python has been around for longer than most of those other languages, so they got to benefit from starting out with a single officially-approved package management system. They knew it was needed, and included it from the start. Python didn't have that benefit, so it has a bunch of different options available. | 2019-04-15T12:24:58.465200 | Carmen | pythondev_help_Carmen_2019-04-15T12:24:58.465200 | 1,555,331,098.4652 | 18,910 |
pythondev | help | *from where people rolled their own solutions, and so did everyone else. | 2019-04-15T12:25:18.465400 | Carmen | pythondev_help_Carmen_2019-04-15T12:25:18.465400 | 1,555,331,118.4654 | 18,911 |
pythondev | help | a bit disingenuous honestly | 2019-04-15T12:37:08.465700 | Carlo | pythondev_help_Carlo_2019-04-15T12:37:08.465700 | 1,555,331,828.4657 | 18,912 |
pythondev | help | "There is no trick in the puzzle’s wording" but "moving" didn't mean what was implied :stuck_out_tongue: | 2019-04-15T12:38:03.465900 | Carlo | pythondev_help_Carlo_2019-04-15T12:38:03.465900 | 1,555,331,883.4659 | 18,913 |
pythondev | help | ok, i just ran into a huge pickle. I have a single dictionary that is assigned across a multitude of dates. Therefore, each date has its own dictionary. The problem is when I update a value in any of the dictionaries, every date's dictionary updates with the same value. In other words, its acting as a single dictionary rather than each date having its own independant dictionary. How can i get around this?] | 2019-04-15T12:39:29.467700 | Nenita | pythondev_help_Nenita_2019-04-15T12:39:29.467700 | 1,555,331,969.4677 | 18,914 |
pythondev | help | I need to assign each date it's own dictionary but how can i do that with a for loop and keep it from using the same dictionary? I just need it to copy the dictionary structure and keep it independant to its' date. | 2019-04-15T12:40:32.468700 | Nenita | pythondev_help_Nenita_2019-04-15T12:40:32.468700 | 1,555,332,032.4687 | 18,915 |
pythondev | help | We need to see some code to figure out exactly what's going wrong. | 2019-04-15T12:41:29.469100 | Carmen | pythondev_help_Carmen_2019-04-15T12:41:29.469100 | 1,555,332,089.4691 | 18,916 |
pythondev | help | My first guess without seeing anything is that you're probably declaring a single dictionary to start, and then assigning that dictionary reference to multiple variables. | 2019-04-15T12:41:55.469900 | Carmen | pythondev_help_Carmen_2019-04-15T12:41:55.469900 | 1,555,332,115.4699 | 18,917 |
pythondev | help | <@Nenita> you'll have to make a copy of the dictionary for each date, not assign the same dict | 2019-04-15T12:41:58.470100 | Carlo | pythondev_help_Carlo_2019-04-15T12:41:58.470100 | 1,555,332,118.4701 | 18,918 |
pythondev | help | None | 2019-04-15T12:42:42.470600 | Nenita | pythondev_help_Nenita_2019-04-15T12:42:42.470600 | 1,555,332,162.4706 | 18,919 |
pythondev | help | `copy.deepcopy` is your friend. <https://docs.python.org/3.7/library/copy.html> | 2019-04-15T12:42:52.471200 | Carmen | pythondev_help_Carmen_2019-04-15T12:42:52.471200 | 1,555,332,172.4712 | 18,920 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.