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 | not sure, tbh | 2017-09-30T12:52:07.000051 | Meg | pythondev_help_Meg_2017-09-30T12:52:07.000051 | 1,506,775,927.000051 | 95,203 |
pythondev | help | that gist is about four years old, but the comments seem to indicate its still valid | 2017-09-30T12:52:24.000076 | Meg | pythondev_help_Meg_2017-09-30T12:52:24.000076 | 1,506,775,944.000076 | 95,204 |
pythondev | help | looks like I use it like the SO post I linked above
```
connection.execute(transactions.insert(compile_upsert = 'ON DUPLICATE KEY UPDATE foo=foo'), my_values)
``` | 2017-09-30T12:59:43.000104 | Bruno | pythondev_help_Bruno_2017-09-30T12:59:43.000104 | 1,506,776,383.000104 | 95,205 |
pythondev | help | ill have to try | 2017-09-30T12:59:48.000038 | Bruno | pythondev_help_Bruno_2017-09-30T12:59:48.000038 | 1,506,776,388.000038 | 95,206 |
pythondev | help | is this with postgres? | 2017-09-30T13:00:24.000079 | Meg | pythondev_help_Meg_2017-09-30T13:00:24.000079 | 1,506,776,424.000079 | 95,207 |
pythondev | help | yea | 2017-09-30T13:00:30.000112 | Bruno | pythondev_help_Bruno_2017-09-30T13:00:30.000112 | 1,506,776,430.000112 | 95,208 |
pythondev | help | hey, what are you doing? | 2017-10-01T00:07:53.000069 | Phylicia | pythondev_help_Phylicia_2017-10-01T00:07:53.000069 | 1,506,816,473.000069 | 95,209 |
pythondev | help | can you help me to merge a list? | 2017-10-01T00:08:03.000080 | Phylicia | pythondev_help_Phylicia_2017-10-01T00:08:03.000080 | 1,506,816,483.00008 | 95,210 |
pythondev | help | ´´´´
#Input: [ [1, 2, 3], [1, 3, 4], [1, 7, 8], [1, 7, 9], [2, 1, 2], [2, 2, 5], [2, 5, 6], [3, 6, 7] ]
#Output = [ [1, [2, 3, 4] ], [1, [7, 8, 9] ], [2, [1, 2, 5, 6] ],[3, [6, 7] ]]
´´´´ | 2017-10-01T00:08:11.000048 | Phylicia | pythondev_help_Phylicia_2017-10-01T00:08:11.000048 | 1,506,816,491.000048 | 95,211 |
pythondev | help | What I understood here is if the succeeding list contains atleast 2 elements of the preceding list and 1 element should be common among all the lists to be merged then the 2 or more lists needs to be merged having the 1st common element outside the list. | 2017-10-01T00:30:13.000050 | Solomon | pythondev_help_Solomon_2017-10-01T00:30:13.000050 | 1,506,817,813.00005 | 95,212 |
pythondev | help | Also do u want to get solution for this list or the generalized function for any list of lists!? | 2017-10-01T00:31:46.000031 | Solomon | pythondev_help_Solomon_2017-10-01T00:31:46.000031 | 1,506,817,906.000031 | 95,213 |
pythondev | help | How do you get the output from the input? | 2017-10-01T01:16:58.000045 | Sidney | pythondev_help_Sidney_2017-10-01T01:16:58.000045 | 1,506,820,618.000045 | 95,214 |
pythondev | help | Hi guys.i want to use pybluez module but my system is mac.so how to install pybluez on Mac? | 2017-10-01T05:02:17.000059 | Jaleesa | pythondev_help_Jaleesa_2017-10-01T05:02:17.000059 | 1,506,834,137.000059 | 95,215 |
pythondev | help | is it possible to group assert statements? I want to write a test to ensure that my function returns only one of three strings: ‘M’, ‘R’, or ‘-’. | 2017-10-01T05:44:03.000006 | Chi | pythondev_help_Chi_2017-10-01T05:44:03.000006 | 1,506,836,643.000006 | 95,216 |
pythondev | help | <@Chi> `assert result in ['M', 'R', '-']` | 2017-10-01T05:47:26.000041 | Collette | pythondev_help_Collette_2017-10-01T05:47:26.000041 | 1,506,836,846.000041 | 95,217 |
pythondev | help | that’s in the assertEqual(s) class? I can’t find that syntax (using python3) | 2017-10-01T05:57:49.000051 | Chi | pythondev_help_Chi_2017-10-01T05:57:49.000051 | 1,506,837,469.000051 | 95,218 |
pythondev | help | Hello, I'd like to ask, do you have any good resources on how to deploy and maintain Python app? also with some notes on how to do updates/rollbacks, etc? Thanks for the responses | 2017-10-01T05:57:57.000049 | Tena | pythondev_help_Tena_2017-10-01T05:57:57.000049 | 1,506,837,477.000049 | 95,219 |
pythondev | help | <@Collette> wait, so your suggestion is for the program file, not the test file? | 2017-10-01T05:59:10.000027 | Chi | pythondev_help_Chi_2017-10-01T05:59:10.000027 | 1,506,837,550.000027 | 95,220 |
pythondev | help | If you're using `unittest`, that should be `assertIn` | 2017-10-01T06:01:50.000059 | Collette | pythondev_help_Collette_2017-10-01T06:01:50.000059 | 1,506,837,710.000059 | 95,221 |
pythondev | help | My example was about `pytest` | 2017-10-01T06:02:03.000106 | Collette | pythondev_help_Collette_2017-10-01T06:02:03.000106 | 1,506,837,723.000106 | 95,222 |
pythondev | help | <@Collette> got it to work. thank you! | 2017-10-01T06:17:57.000071 | Chi | pythondev_help_Chi_2017-10-01T06:17:57.000071 | 1,506,838,677.000071 | 95,223 |
pythondev | help | what's the correct way of updating setuptools? | 2017-10-01T13:17:37.000016 | Winnie | pythondev_help_Winnie_2017-10-01T13:17:37.000016 | 1,506,863,857.000016 | 95,224 |
pythondev | help | `pip install -U setuptools`? :stuck_out_tongue: | 2017-10-01T13:17:57.000027 | Suellen | pythondev_help_Suellen_2017-10-01T13:17:57.000027 | 1,506,863,877.000027 | 95,225 |
pythondev | help | Doesn't that require sudo which is bad? | 2017-10-01T13:23:55.000037 | Winnie | pythondev_help_Winnie_2017-10-01T13:23:55.000037 | 1,506,864,235.000037 | 95,226 |
pythondev | help | <@Winnie> well depends on where your packages are installed, it isn't bad if you're using it correctly | 2017-10-01T13:34:25.000122 | Mallie | pythondev_help_Mallie_2017-10-01T13:34:25.000122 | 1,506,864,865.000122 | 95,227 |
pythondev | help | System packages are going to require root, virtualenv depends on those permissions | 2017-10-01T13:35:45.000113 | Mallie | pythondev_help_Mallie_2017-10-01T13:35:45.000113 | 1,506,864,945.000113 | 95,228 |
pythondev | help | and setuptools is a system package? | 2017-10-01T13:36:21.000057 | Winnie | pythondev_help_Winnie_2017-10-01T13:36:21.000057 | 1,506,864,981.000057 | 95,229 |
pythondev | help | Well there may be a distro package for it, not sure, but by system package I meant global python packages (e.g. `/usr/local/lib/python2.7/dist-packages`) | 2017-10-01T13:41:06.000024 | Mallie | pythondev_help_Mallie_2017-10-01T13:41:06.000024 | 1,506,865,266.000024 | 95,230 |
pythondev | help | I have one there and one in 3.6 of .local | 2017-10-01T13:49:11.000016 | Winnie | pythondev_help_Winnie_2017-10-01T13:49:11.000016 | 1,506,865,751.000016 | 95,231 |
pythondev | help | Those are for those different Python versions, that is where pip packages are installed when you install globally (default without being in a venv or using `-t` on pip install). Those directories are owned by root (see with `ls -l`) | 2017-10-01T14:00:05.000167 | Mallie | pythondev_help_Mallie_2017-10-01T14:00:05.000167 | 1,506,866,405.000167 | 95,232 |
pythondev | help | If I'm doing a "large" recursion, is there a time when I would NOT want to use a generator? Trying to search the web for "when should I not use a generator" was NOT helpful. :confused: | 2017-10-01T18:25:06.000080 | Seema | pythondev_help_Seema_2017-10-01T18:25:06.000080 | 1,506,882,306.00008 | 95,233 |
pythondev | help | thank you <@Hung> for that "custom response" | 2017-10-01T18:26:02.000017 | Seema | pythondev_help_Seema_2017-10-01T18:26:02.000017 | 1,506,882,362.000017 | 95,234 |
pythondev | help | <@Seema> Without an example there isn't really an answer to that. What is a "large" recursion? If a situation fits the use of a generator I know of no particular reason you might want to avoid it. You could check on your system with `import sys; sys.getrecursionlimit()` and if you plan to recurse more than that, it's too much :smile: | 2017-10-01T18:38:42.000046 | Mallie | pythondev_help_Mallie_2017-10-01T18:38:42.000046 | 1,506,883,122.000046 | 95,235 |
pythondev | help | <@Mallie> Hey Joshua, that's pretty much my question / answer right there. "I know of no particular reason you might want to avoid it". Thanks | 2017-10-01T18:39:59.000102 | Seema | pythondev_help_Seema_2017-10-01T18:39:59.000102 | 1,506,883,199.000102 | 95,236 |
pythondev | help | Everytime I see magic or whizbang, I want to know how the trick works and if there are any exceptions or gotchas. Some of these one line yield statements are pretty slick and I get "suspicious", lol. | 2017-10-01T18:41:02.000047 | Seema | pythondev_help_Seema_2017-10-01T18:41:02.000047 | 1,506,883,262.000047 | 95,237 |
pythondev | help | Hah, that's fair. But generators do have a pretty straightforward behavior once you get used to them, so if you haven't read this yet, <https://wiki.python.org/moin/Generators>, do. Conceptually, the shorthand is the same as writing that sort of example class they have, it's just the interpreter is doing the state tracking and iterator behavior definition for you. | 2017-10-01T18:47:05.000072 | Mallie | pythondev_help_Mallie_2017-10-01T18:47:05.000072 | 1,506,883,625.000072 | 95,238 |
pythondev | help | anyone using pony orm? looks really nice | 2017-10-01T20:49:06.000044 | Bruno | pythondev_help_Bruno_2017-10-01T20:49:06.000044 | 1,506,890,946.000044 | 95,239 |
pythondev | help | Currently working with `asyncio` after not touching it for a bit. I'm trying to clean up my code that I have for an application I'm building and make it a bit more object oriented and nicer looking, however, with the async task that's set to run I'm wondering what might be the best way to set it up. Should I instantiate the class that the background task is in then when everything is setup, run the task? Or have it outside of the class object? | 2017-10-01T22:55:31.000050 | Myong | pythondev_help_Myong_2017-10-01T22:55:31.000050 | 1,506,898,531.00005 | 95,240 |
pythondev | help | This is a snippet | 2017-10-01T22:55:38.000065 | Myong | pythondev_help_Myong_2017-10-01T22:55:38.000065 | 1,506,898,538.000065 | 95,241 |
pythondev | help | <@Myong> idk, does it need to be in the class? | 2017-10-02T00:29:27.000004 | Signe | pythondev_help_Signe_2017-10-02T00:29:27.000004 | 1,506,904,167.000004 | 95,242 |
pythondev | help | If not, i feel its a bit better outside. | 2017-10-02T00:30:47.000098 | Signe | pythondev_help_Signe_2017-10-02T00:30:47.000098 | 1,506,904,247.000098 | 95,243 |
pythondev | help | I actually fixed that all up | 2017-10-02T00:30:52.000087 | Myong | pythondev_help_Myong_2017-10-02T00:30:52.000087 | 1,506,904,252.000087 | 95,244 |
pythondev | help | I'm now stuck with another small issue | 2017-10-02T00:31:02.000038 | Myong | pythondev_help_Myong_2017-10-02T00:31:02.000038 | 1,506,904,262.000038 | 95,245 |
pythondev | help | Basically I'm using the `Discord` python library and they use decorators for making groups and accessing commands that you can use. The issue I'm running into is that they use a keyword in the `@<decorator>` that is not initialized | 2017-10-02T00:33:30.000073 | Myong | pythondev_help_Myong_2017-10-02T00:33:30.000073 | 1,506,904,410.000073 | 95,246 |
pythondev | help | so it gives an error for it and I know why but I'm just attempting to figure it out | 2017-10-02T00:33:44.000151 | Myong | pythondev_help_Myong_2017-10-02T00:33:44.000151 | 1,506,904,424.000151 | 95,247 |
pythondev | help | More detail? | 2017-10-02T00:34:39.000061 | Signe | pythondev_help_Signe_2017-10-02T00:34:39.000061 | 1,506,904,479.000061 | 95,248 |
pythondev | help | One sec I'll put some small example together | 2017-10-02T00:37:43.000059 | Myong | pythondev_help_Myong_2017-10-02T00:37:43.000059 | 1,506,904,663.000059 | 95,249 |
pythondev | help | Actually, I fixed it. I just decided to go with one small class and keep the main object inline and out of a class so that the decorators which use that variable later do not throw errors. | 2017-10-02T00:40:27.000116 | Myong | pythondev_help_Myong_2017-10-02T00:40:27.000116 | 1,506,904,827.000116 | 95,250 |
pythondev | help | :+1: | 2017-10-02T00:42:35.000086 | Signe | pythondev_help_Signe_2017-10-02T00:42:35.000086 | 1,506,904,955.000086 | 95,251 |
pythondev | help | So in that snippet something like that would throw errors because bot wasn't initialized, I was just trying to figure out how to make it work | 2017-10-02T00:42:47.000023 | Myong | pythondev_help_Myong_2017-10-02T00:42:47.000023 | 1,506,904,967.000023 | 95,252 |
pythondev | help | But all I did was this | 2017-10-02T00:42:52.000085 | Myong | pythondev_help_Myong_2017-10-02T00:42:52.000085 | 1,506,904,972.000085 | 95,253 |
pythondev | help | So yeah | 2017-10-02T00:43:15.000168 | Myong | pythondev_help_Myong_2017-10-02T00:43:15.000168 | 1,506,904,995.000168 | 95,254 |
pythondev | help | Cool | 2017-10-02T00:44:37.000099 | Signe | pythondev_help_Signe_2017-10-02T00:44:37.000099 | 1,506,905,077.000099 | 95,255 |
pythondev | help | Glad you figured out all out | 2017-10-02T00:45:01.000016 | Signe | pythondev_help_Signe_2017-10-02T00:45:01.000016 | 1,506,905,101.000016 | 95,256 |
pythondev | help | I've played with it for a while, but I guess I'm too used to Django ORM. But the idea is nice | 2017-10-02T03:21:19.000192 | Mirian | pythondev_help_Mirian_2017-10-02T03:21:19.000192 | 1,506,914,479.000192 | 95,257 |
pythondev | help | hey guys where do i go for git help? | 2017-10-02T03:43:59.000015 | Alba | pythondev_help_Alba_2017-10-02T03:43:59.000015 | 1,506,915,839.000015 | 95,258 |
pythondev | help | I essentially have commits `a-b-c-d-e-f-g` in `branch1`. I want to move `d-e-f-g` into `branch2` | 2017-10-02T03:44:53.000075 | Alba | pythondev_help_Alba_2017-10-02T03:44:53.000075 | 1,506,915,893.000075 | 95,259 |
pythondev | help | been trying rebase but i can't seem to get it to work | 2017-10-02T03:45:07.000060 | Alba | pythondev_help_Alba_2017-10-02T03:45:07.000060 | 1,506,915,907.00006 | 95,260 |
pythondev | help | `a-b-c` get attached as well | 2017-10-02T03:45:14.000019 | Alba | pythondev_help_Alba_2017-10-02T03:45:14.000019 | 1,506,915,914.000019 | 95,261 |
pythondev | help | You can use cherry-pick for that | 2017-10-02T03:46:52.000207 | Ciera | pythondev_help_Ciera_2017-10-02T03:46:52.000207 | 1,506,916,012.000207 | 95,262 |
pythondev | help | I don't have the exact syntax in mind but it should help you find what you want on Google | 2017-10-02T03:47:48.000001 | Ciera | pythondev_help_Ciera_2017-10-02T03:47:48.000001 | 1,506,916,068.000001 | 95,263 |
pythondev | help | <https://stackoverflow.com/questions/1670970/how-to-cherry-pick-multiple-commits> | 2017-10-02T04:06:56.000097 | Carri | pythondev_help_Carri_2017-10-02T04:06:56.000097 | 1,506,917,216.000097 | 95,264 |
pythondev | help | Has anyone encountered "227 Entering Passive Mode" when using ftplib module.
any ftp function like `dir`, `nlst`, which contains the method like: `retrlines`, `transfercmd`, `ntransfercmd`. they all will be dead hang in there.... I try many way but didn't work out...
my code example: <https://repl.it/Lv0h/1> | 2017-10-02T05:18:58.000383 | Kelli | pythondev_help_Kelli_2017-10-02T05:18:58.000383 | 1,506,921,538.000383 | 95,265 |
pythondev | help | <@Kelli> no point providing a repl if we can't access the ftp box :slightly_smiling_face: | 2017-10-02T05:21:13.000241 | Vada | pythondev_help_Vada_2017-10-02T05:21:13.000241 | 1,506,921,673.000241 | 95,266 |
pythondev | help | It is most lkely an ftp issue not a code issue | 2017-10-02T05:21:22.000328 | Vada | pythondev_help_Vada_2017-10-02T05:21:22.000328 | 1,506,921,682.000328 | 95,267 |
pythondev | help | passive mode being a mode of ftp | 2017-10-02T05:21:42.000244 | Vada | pythondev_help_Vada_2017-10-02T05:21:42.000244 | 1,506,921,702.000244 | 95,268 |
pythondev | help | <http://slacksite.com/other/ftp.html> | 2017-10-02T05:21:52.000190 | Vada | pythondev_help_Vada_2017-10-02T05:21:52.000190 | 1,506,921,712.00019 | 95,269 |
pythondev | help | no one should have to use FTP in 2017 | 2017-10-02T05:23:03.000201 | Suellen | pythondev_help_Suellen_2017-10-02T05:23:03.000201 | 1,506,921,783.000201 | 95,270 |
pythondev | help | in 2005+ really... | 2017-10-02T05:23:06.000466 | Suellen | pythondev_help_Suellen_2017-10-02T05:23:06.000466 | 1,506,921,786.000466 | 95,271 |
pythondev | help | I mean that to | 2017-10-02T05:28:31.000405 | Vada | pythondev_help_Vada_2017-10-02T05:28:31.000405 | 1,506,922,111.000405 | 95,272 |
pythondev | help | I recently had to setup an FTP box, it hurt | 2017-10-02T05:28:53.000411 | Vada | pythondev_help_Vada_2017-10-02T05:28:53.000411 | 1,506,922,133.000411 | 95,273 |
pythondev | help | well.. it's job, I have to use it. | 2017-10-02T05:32:53.000045 | Kelli | pythondev_help_Kelli_2017-10-02T05:32:53.000045 | 1,506,922,373.000045 | 95,274 |
pythondev | help | surely there's a better way to stitch lists together by pre-pending than this?
```
l = [list(range(x, x+100)) for x in range(100**2,-1,-100)]
# this works but is inefficient
nl = []
for i in l:
nl = i + nl
#faster but has to iterate over every item in i
from collections import deque
dl = deque()
for i in l:
dl.extendleft(reversed(i))
``` | 2017-10-02T07:43:49.000241 | Winnie | pythondev_help_Winnie_2017-10-02T07:43:49.000241 | 1,506,930,229.000241 | 95,275 |
pythondev | help | `list.extend(other_list)` | 2017-10-02T07:48:12.000037 | Carri | pythondev_help_Carri_2017-10-02T07:48:12.000037 | 1,506,930,492.000037 | 95,276 |
pythondev | help | that doesn't do what I want it to do | 2017-10-02T07:48:29.000169 | Winnie | pythondev_help_Winnie_2017-10-02T07:48:29.000169 | 1,506,930,509.000169 | 95,277 |
pythondev | help | what exactly are you trying to do ? | 2017-10-02T07:49:00.000055 | Carri | pythondev_help_Carri_2017-10-02T07:49:00.000055 | 1,506,930,540.000055 | 95,278 |
pythondev | help | flattening inner lists in reverse ? | 2017-10-02T07:49:20.000067 | Carri | pythondev_help_Carri_2017-10-02T07:49:20.000067 | 1,506,930,560.000067 | 95,279 |
pythondev | help | l is `[[9, 10, 11], [6, 7, 8], [3, 4, 5], [0, 1, 2]]`
I want `[11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]` | 2017-10-02T07:50:16.000008 | Winnie | pythondev_help_Winnie_2017-10-02T07:50:16.000008 | 1,506,930,616.000008 | 95,280 |
pythondev | help | ```
>>> l = [[9, 10, 11], [6, 7, 8], [3, 4, 5], [0, 1, 2]]
>>> [i for subl in l for i in reversed(subl)]
[11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
``` | 2017-10-02T07:54:16.000078 | Collette | pythondev_help_Collette_2017-10-02T07:54:16.000078 | 1,506,930,856.000078 | 95,281 |
pythondev | help | ```
def chain(iterables):
for it in iterables[::-1]:
for element in it[::-1]:
yield element
``` | 2017-10-02T07:55:18.000105 | Carri | pythondev_help_Carri_2017-10-02T07:55:18.000105 | 1,506,930,918.000105 | 95,282 |
pythondev | help | that's a O(N^2) solution, which is about as best as you'll get | 2017-10-02T07:56:18.000443 | Meg | pythondev_help_Meg_2017-10-02T07:56:18.000443 | 1,506,930,978.000443 | 95,283 |
pythondev | help | the deque method will work fast
what I'm asking is, doesn't python have any way of "stitching" lists together, to avoid iterating over every inner list? | 2017-10-02T07:56:29.000164 | Winnie | pythondev_help_Winnie_2017-10-02T07:56:29.000164 | 1,506,930,989.000164 | 95,284 |
pythondev | help | Nope, and even if it did, it woluld still take the same amount of time | 2017-10-02T07:57:14.000005 | Patty | pythondev_help_Patty_2017-10-02T07:57:14.000005 | 1,506,931,034.000005 | 95,285 |
pythondev | help | Also +1 to `[::-1]`, it’s faster than `reversed()` | 2017-10-02T07:57:42.000165 | Patty | pythondev_help_Patty_2017-10-02T07:57:42.000165 | 1,506,931,062.000165 | 95,286 |
pythondev | help | howso? | 2017-10-02T07:57:42.000228 | Winnie | pythondev_help_Winnie_2017-10-02T07:57:42.000228 | 1,506,931,062.000228 | 95,287 |
pythondev | help | wait really? | 2017-10-02T07:58:10.000102 | Winnie | pythondev_help_Winnie_2017-10-02T07:58:10.000102 | 1,506,931,090.000102 | 95,288 |
pythondev | help | <@Winnie>, what you're missing is how lists work in memory | 2017-10-02T07:58:21.000031 | Meg | pythondev_help_Meg_2017-10-02T07:58:21.000031 | 1,506,931,101.000031 | 95,289 |
pythondev | help | Because how else can you flatted internal lists without iterating them? | 2017-10-02T07:58:22.000366 | Patty | pythondev_help_Patty_2017-10-02T07:58:22.000366 | 1,506,931,102.000366 | 95,290 |
pythondev | help | Yep | 2017-10-02T07:58:29.000049 | Patty | pythondev_help_Patty_2017-10-02T07:58:29.000049 | 1,506,931,109.000049 | 95,291 |
pythondev | help | ```
$ p -m timeit "ol = [1, 2, 3]; nl = list(reversed(ol))"
100000 loops, best of 3: 2.34 usec per loop
$ p -m timeit "ol = [1, 2, 3]; nl = list(ol); nl.reverse();"
1000000 loops, best of 3: 0.686 usec per loop
$ p -m timeit "ol = [1, 2, 3]; nl = ol[::-1];"
1000000 loops, best of 3: 0.569 usec per loop
$ p -m timeit "ol = [1, 2, 3]; nl = [i for i in reversed(ol)];"
1000000 loops, best of 3: 1.48 usec per loop``` | 2017-10-02T07:58:41.000039 | Patty | pythondev_help_Patty_2017-10-02T07:58:41.000039 | 1,506,931,121.000039 | 95,292 |
pythondev | help | `[::-1]` is just traversing in 1-step increments in reverse, whereas `reversed()` actually reverses the list | 2017-10-02T07:58:46.000081 | Carri | pythondev_help_Carri_2017-10-02T07:58:46.000081 | 1,506,931,126.000081 | 95,293 |
pythondev | help | <@Carri> you're mixing `reversed()` with `.reverse()` method | 2017-10-02T07:59:36.000082 | Collette | pythondev_help_Collette_2017-10-02T07:59:36.000082 | 1,506,931,176.000082 | 95,294 |
pythondev | help | ```
python3.6 -m timeit -s 'l = [list(range(x, x+100)) for x in range(100**2,-1,-100)]' '[i for subl in l for i in reversed(subl)]'
1000 loops, best of 3: 302 usec per loop
➜ amqproto git:(master) ✗
➜ amqproto git:(master) ✗ python3.6 -m timeit -s 'l = [list(range(x, x+100)) for x in range(100**2,-1,-100)]; from collections import deque' '
quote> dl = deque()
for i in l:
dl.extendleft(reversed(i))
quote> '
10000 loops, best of 3: 135 usec per loop
``` | 2017-10-02T08:00:07.000151 | Collette | pythondev_help_Collette_2017-10-02T08:00:07.000151 | 1,506,931,207.000151 | 95,295 |
pythondev | help | `[[9, 10, 11], [6, 7, 8], [3, 4, 5], [0, 1, 2]]`
okay imagine if all the inner lists were linked lists
then all I would have to do is connect 8 to 9, 5 to 6, and so forth | 2017-10-02T08:00:20.000067 | Winnie | pythondev_help_Winnie_2017-10-02T08:00:20.000067 | 1,506,931,220.000067 | 95,296 |
pythondev | help | `reversed()` does reverse a list, just yields a new object. `.reverse()` reverses in-place | 2017-10-02T08:00:28.000258 | Carri | pythondev_help_Carri_2017-10-02T08:00:28.000258 | 1,506,931,228.000258 | 95,297 |
pythondev | help | ~150 usecs simply don't worth to complicate the solution, imo | 2017-10-02T08:00:37.000367 | Collette | pythondev_help_Collette_2017-10-02T08:00:37.000367 | 1,506,931,237.000367 | 95,298 |
pythondev | help | <@Carri> ```
>>> reversed([1,2,3])
<list_reverseiterator object at 0x108f45780>
``` | 2017-10-02T08:01:06.000051 | Collette | pythondev_help_Collette_2017-10-02T08:01:06.000051 | 1,506,931,266.000051 | 95,299 |
pythondev | help | just swap `reversed(list)` with `list[::-1]` | 2017-10-02T08:01:20.000008 | Patty | pythondev_help_Patty_2017-10-02T08:01:20.000008 | 1,506,931,280.000008 | 95,300 |
pythondev | help | yep, ```
$ python3.6 -m timeit -s 'l = [list(range(x, x+100)) for x in range(100**2,-1,-100)]' '[i for subl in l for i in subl[::-11]]'
10000 loops, best of 3: 62.7 usec per loop
``` | 2017-10-02T08:01:50.000194 | Collette | pythondev_help_Collette_2017-10-02T08:01:50.000194 | 1,506,931,310.000194 | 95,301 |
pythondev | help | in new Python it returns an iterator, lots of legacy Python out there <@Collette> | 2017-10-02T08:01:53.000354 | Carri | pythondev_help_Carri_2017-10-02T08:01:53.000354 | 1,506,931,313.000354 | 95,302 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.