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 | I had intended to be “verbose” when explaining my problem :slightly_smiling_face: | 2017-10-23T15:06:09.000071 | Derek | pythondev_help_Derek_2017-10-23T15:06:09.000071 | 1,508,771,169.000071 | 97,903 |
pythondev | help | :smile: | 2017-10-23T15:07:01.000478 | Meg | pythondev_help_Meg_2017-10-23T15:07:01.000478 | 1,508,771,221.000478 | 97,904 |
pythondev | help | How do people feel about functional testing in addition to unit testing? Think it is overkill or not needed until certain points in a project? | 2017-10-23T15:25:35.000062 | Vita | pythondev_help_Vita_2017-10-23T15:25:35.000062 | 1,508,772,335.000062 | 97,905 |
pythondev | help | It's not overkill | 2017-10-23T15:45:29.000379 | Ronni | pythondev_help_Ronni_2017-10-23T15:45:29.000379 | 1,508,773,529.000379 | 97,906 |
pythondev | help | there was a pycon panel about this with heavyweights and they will all in support, for slightly different reasons | 2017-10-23T15:50:41.000706 | Seema | pythondev_help_Seema_2017-10-23T15:50:41.000706 | 1,508,773,841.000706 | 97,907 |
pythondev | help | it was more about linting and humans than about functional testing though, very nuanced | 2017-10-23T15:52:27.000603 | Seema | pythondev_help_Seema_2017-10-23T15:52:27.000603 | 1,508,773,947.000603 | 97,908 |
pythondev | help | I prefer _writing_ unit tests b/c they're faster and easier to write, but just like a child prefers cookies to roasted broccoli (mmm delicious!) it doesn't mean it's sufficient | 2017-10-23T16:04:25.000114 | Ronni | pythondev_help_Ronni_2017-10-23T16:04:25.000114 | 1,508,774,665.000114 | 97,909 |
pythondev | help | can anyone suggest popular IoC (inversion of control) package to use? PyPI provides too much to choose from <https://pypi.python.org/pypi?%3Aaction=search&term=dependency+injection&submit=search> | 2017-10-23T16:14:12.000103 | Kellye | pythondev_help_Kellye_2017-10-23T16:14:12.000103 | 1,508,775,252.000103 | 97,910 |
pythondev | help | Is there any real reason to using an ORM (like sqlalchamy) besides not having to write queries yourself? I personally have my own module for storing/executing/returning queries and at times it runs faster than the ORM, obviously because a human is better at constructing complex queries than a computer is (for now). So besides the obvious, are there other reasons you guys find yourselves using one? | 2017-10-23T16:23:48.000378 | Lory | pythondev_help_Lory_2017-10-23T16:23:48.000378 | 1,508,775,828.000378 | 97,911 |
pythondev | help | how maintainable is your own module :slightly_smiling_face: | 2017-10-23T16:24:23.000459 | Meg | pythondev_help_Meg_2017-10-23T16:24:23.000459 | 1,508,775,863.000459 | 97,912 |
pythondev | help | scalable? works with schema changes without tinkering? | 2017-10-23T16:24:38.000075 | Meg | pythondev_help_Meg_2017-10-23T16:24:38.000075 | 1,508,775,878.000075 | 97,913 |
pythondev | help | I mean, sure there are reasons to use raw sql over an ORM | 2017-10-23T16:24:58.000350 | Meg | pythondev_help_Meg_2017-10-23T16:24:58.000350 | 1,508,775,898.00035 | 97,914 |
pythondev | help | but those should be limited to areas where the optimization is needed | 2017-10-23T16:25:13.000568 | Meg | pythondev_help_Meg_2017-10-23T16:25:13.000568 | 1,508,775,913.000568 | 97,915 |
pythondev | help | not as a first reaction | 2017-10-23T16:25:27.000263 | Meg | pythondev_help_Meg_2017-10-23T16:25:27.000263 | 1,508,775,927.000263 | 97,916 |
pythondev | help | <@Lory> I generally try to avoid ORMs since I think they are often the wrong approach to the general problem of database abstraction, so you're not alone, but I'm sure you'll get _plenty_ of arguments for why you should use one | 2017-10-23T16:25:42.000244 | Issac | pythondev_help_Issac_2017-10-23T16:25:42.000244 | 1,508,775,942.000244 | 97,917 |
pythondev | help | <@Issac> how maintainable is that, though? | 2017-10-23T16:26:11.000386 | Meg | pythondev_help_Meg_2017-10-23T16:26:11.000386 | 1,508,775,971.000386 | 97,918 |
pythondev | help | for just myself and a few friends that use it, it's fairly easy. Just deifne your boiler plate queries and then call them through a few defined methods that give me all results or one result or whatever and have them preformatted to how I like my data structured | 2017-10-23T16:26:51.000429 | Lory | pythondev_help_Lory_2017-10-23T16:26:51.000429 | 1,508,776,011.000429 | 97,919 |
pythondev | help | schema changes require manual intervention lol | 2017-10-23T16:26:59.000047 | Lory | pythondev_help_Lory_2017-10-23T16:26:59.000047 | 1,508,776,019.000047 | 97,920 |
pythondev | help | <@Meg> you mean not using an ORM? I would tend to argue that the types of abstractions that ORMs introduce is increasing the complexity of the code and introduces more maintenance overhead than not using one, although like anything else in development you can do it badly and incur a lot of pain | 2017-10-23T16:28:03.000236 | Issac | pythondev_help_Issac_2017-10-23T16:28:03.000236 | 1,508,776,083.000236 | 97,921 |
pythondev | help | sorry no, my small module | 2017-10-23T16:28:25.000251 | Lory | pythondev_help_Lory_2017-10-23T16:28:25.000251 | 1,508,776,105.000251 | 97,922 |
pythondev | help | <@Meg> There's a middle ground between ORM and raw SQL (like <http://knexjs.org/> for node, not sure of a good example in python) that helps with maintainability while being a more simple abstraction | 2017-10-23T16:28:45.000342 | Antionette | pythondev_help_Antionette_2017-10-23T16:28:45.000342 | 1,508,776,125.000342 | 97,923 |
pythondev | help | django ORM works similar, I think | 2017-10-23T16:28:58.000422 | Meg | pythondev_help_Meg_2017-10-23T16:28:58.000422 | 1,508,776,138.000422 | 97,924 |
pythondev | help | as well as sqlalchemy, in which you can write raw sql and it’ll handle it for you | 2017-10-23T16:29:13.000507 | Meg | pythondev_help_Meg_2017-10-23T16:29:13.000507 | 1,508,776,153.000507 | 97,925 |
pythondev | help | My biggest gripe is that it feels awkward to use one in the code, and that's just because of a lack of familiarity with using ORM's, So I figured what does it _really_ matter if I just use my own | 2017-10-23T16:29:19.000113 | Lory | pythondev_help_Lory_2017-10-23T16:29:19.000113 | 1,508,776,159.000113 | 97,926 |
pythondev | help | and for your own projects, thats fine | 2017-10-23T16:29:31.000221 | Meg | pythondev_help_Meg_2017-10-23T16:29:31.000221 | 1,508,776,171.000221 | 97,927 |
pythondev | help | if you’re working on non-super critical performance in a team, then I would definitely make you justify the case of not using an ORM if I were interviewing you | 2017-10-23T16:30:22.000283 | Meg | pythondev_help_Meg_2017-10-23T16:30:22.000283 | 1,508,776,222.000283 | 97,928 |
pythondev | help | and it just that, I'm trying to get into free lance web application design so I'm slowly building my own modules for things I feel are bloated like ORM's, Login modules, etc... | 2017-10-23T16:31:12.000284 | Lory | pythondev_help_Lory_2017-10-23T16:31:12.000284 | 1,508,776,272.000284 | 97,929 |
pythondev | help | sqlalchemy was started because the author was tired of hibernate’s bloatedness :slightly_smiling_face: | 2017-10-23T16:31:42.000545 | Meg | pythondev_help_Meg_2017-10-23T16:31:42.000545 | 1,508,776,302.000545 | 97,930 |
pythondev | help | Like most things you just need to be aware of the trade-offs, the once that have been mentioned incl. Imagine working on a large team or needing lots of people to be able to access and modify things in the database (like will happen many many times with a fairly complex dynamic website) and trusting all developers to get the SQL correct. That's a maintainability nightmare. | 2017-10-23T16:32:07.000122 | Mallie | pythondev_help_Mallie_2017-10-23T16:32:07.000122 | 1,508,776,327.000122 | 97,931 |
pythondev | help | bingo | 2017-10-23T16:32:18.000382 | Meg | pythondev_help_Meg_2017-10-23T16:32:18.000382 | 1,508,776,338.000382 | 97,932 |
pythondev | help | that there is my primary argument against | 2017-10-23T16:32:28.000026 | Meg | pythondev_help_Meg_2017-10-23T16:32:28.000026 | 1,508,776,348.000026 | 97,933 |
pythondev | help | especially if the actual performance difference is a few percents overall in load and query time | 2017-10-23T16:32:50.000242 | Meg | pythondev_help_Meg_2017-10-23T16:32:50.000242 | 1,508,776,370.000242 | 97,934 |
pythondev | help | And you may find that you only need to do one or two db calls, which is great, and you may find that as you maintain more and more projects all that "custom" SQL boilerplate wastes time. | 2017-10-23T16:32:51.000232 | Mallie | pythondev_help_Mallie_2017-10-23T16:32:51.000232 | 1,508,776,371.000232 | 97,935 |
pythondev | help | furthermore, as a freelance web dev, <@Lory>, you have to consider the ‘when’ case, when another developer takes over your project | 2017-10-23T16:33:59.000224 | Meg | pythondev_help_Meg_2017-10-23T16:33:59.000224 | 1,508,776,439.000224 | 97,936 |
pythondev | help | how easy is it for the other person/team to get up and running with your setup? | 2017-10-23T16:34:18.000111 | Meg | pythondev_help_Meg_2017-10-23T16:34:18.000111 | 1,508,776,458.000111 | 97,937 |
pythondev | help | i think you should decide what is most important to you when working with the ORM or the core. | 2017-10-23T16:34:36.000361 | Johana | pythondev_help_Johana_2017-10-23T16:34:36.000361 | 1,508,776,476.000361 | 97,938 |
pythondev | help | ORM is business objects and Core is more schema-centric. | 2017-10-23T16:34:46.000463 | Johana | pythondev_help_Johana_2017-10-23T16:34:46.000463 | 1,508,776,486.000463 | 97,939 |
pythondev | help | if you want to be down in the weeds and know your db schema you should use core. if you want to deal with things like business objects use the ORM. | 2017-10-23T16:35:10.000396 | Johana | pythondev_help_Johana_2017-10-23T16:35:10.000396 | 1,508,776,510.000396 | 97,940 |
pythondev | help | I would agree with <@Meg> there, freelancing does come with the burden of not just doing the most technically right thing, but the most expected thing since a lot of what your client is paying for is something that can serve as a baseline for future devs to continue to modify and support the application | 2017-10-23T16:35:22.000377 | Issac | pythondev_help_Issac_2017-10-23T16:35:22.000377 | 1,508,776,522.000377 | 97,941 |
pythondev | help | it depends on the level of abstraction you want. I’ve used both quite extensively. | 2017-10-23T16:35:27.000138 | Johana | pythondev_help_Johana_2017-10-23T16:35:27.000138 | 1,508,776,527.000138 | 97,942 |
pythondev | help | i try to avoid raw sql as much as possible. | 2017-10-23T16:36:43.000244 | Johana | pythondev_help_Johana_2017-10-23T16:36:43.000244 | 1,508,776,603.000244 | 97,943 |
pythondev | help | speaking for myself, at my current place, I had to figure out what the hell the previous dev was thinking when he put together the query structure for a very important part of the API. He just had python joining strings to construct the query, and execute with raw sql, using cursors, etc.
When I moved it over to using django ORM, the actual query time went down about 50 milliseconds per query… without indexes | 2017-10-23T16:37:03.000063 | Meg | pythondev_help_Meg_2017-10-23T16:37:03.000063 | 1,508,776,623.000063 | 97,944 |
pythondev | help | much better to use a DSL like sqalchemy core. | 2017-10-23T16:37:15.000033 | Johana | pythondev_help_Johana_2017-10-23T16:37:15.000033 | 1,508,776,635.000033 | 97,945 |
pythondev | help | I think ORMs are problematic because they unnecessarily couple several parts of the system that should be decoupled (datatype definitions, constraint solving, persistence, and transport of network attached data). My personal experience is that in projects of any size they often end up causing more harm than good, and architecturally I dislike the types of applications that tend to have them central to the application | 2017-10-23T16:37:37.000374 | Issac | pythondev_help_Issac_2017-10-23T16:37:37.000374 | 1,508,776,657.000374 | 97,946 |
pythondev | help | not all ORMs are created equal tho. | 2017-10-23T16:38:08.000674 | Johana | pythondev_help_Johana_2017-10-23T16:38:08.000674 | 1,508,776,688.000674 | 97,947 |
pythondev | help | sqlalchemy’s orm is significantly better than others i’ve used. | 2017-10-23T16:38:46.000103 | Johana | pythondev_help_Johana_2017-10-23T16:38:46.000103 | 1,508,776,726.000103 | 97,948 |
pythondev | help | for one it uses the unit of work pattern so you aren’t going to commit anything until it all works. | 2017-10-23T16:39:12.000349 | Johana | pythondev_help_Johana_2017-10-23T16:39:12.000349 | 1,508,776,752.000349 | 97,949 |
pythondev | help | <@Issac> no argument there with your points about complexity and coupling. But is that really significant, though? | 2017-10-23T16:39:18.000597 | Meg | pythondev_help_Meg_2017-10-23T16:39:18.000597 | 1,508,776,758.000597 | 97,950 |
pythondev | help | and personally, in my projects, I’ve had to drop to raw sql a handful of times when performance was required | 2017-10-23T16:39:54.000377 | Meg | pythondev_help_Meg_2017-10-23T16:39:54.000377 | 1,508,776,794.000377 | 97,951 |
pythondev | help | <http://aosabook.org/en/sqlalchemy.html> | 2017-10-23T16:40:40.000239 | Johana | pythondev_help_Johana_2017-10-23T16:40:40.000239 | 1,508,776,840.000239 | 97,952 |
pythondev | help | I really don’t like writing SQL, and only do it when the profiling shows there will be a distinct difference | 2017-10-23T16:40:41.000246 | Meg | pythondev_help_Meg_2017-10-23T16:40:41.000246 | 1,508,776,841.000246 | 97,953 |
pythondev | help | and that’s after optimizing the db structure, adding indexes, and doing everything to reduce the number of queries executed | 2017-10-23T16:41:20.000217 | Meg | pythondev_help_Meg_2017-10-23T16:41:20.000217 | 1,508,776,880.000217 | 97,954 |
pythondev | help | <@Meg> obviously I think it's significant, I don't expect everyone would agree with my personal weight of the tradeoffs though. | 2017-10-23T16:41:49.000082 | Issac | pythondev_help_Issac_2017-10-23T16:41:49.000082 | 1,508,776,909.000082 | 97,955 |
pythondev | help | oh, certainly. Like I said, there’s valid arguments for and against | 2017-10-23T16:42:11.000305 | Meg | pythondev_help_Meg_2017-10-23T16:42:11.000305 | 1,508,776,931.000305 | 97,956 |
pythondev | help | though, am wondering | 2017-10-23T16:42:23.000487 | Meg | pythondev_help_Meg_2017-10-23T16:42:23.000487 | 1,508,776,943.000487 | 97,957 |
pythondev | help | I tend to think that, performance aside, anything that decouples the system and facilitates me reasoning algebraically about my application with a minimum of leaky abstractions and corner cases is a huge win to me | 2017-10-23T16:42:25.000601 | Issac | pythondev_help_Issac_2017-10-23T16:42:25.000601 | 1,508,776,945.000601 | 97,958 |
pythondev | help | but hey, I'm coming from haskell :laughing: | 2017-10-23T16:42:47.000096 | Issac | pythondev_help_Issac_2017-10-23T16:42:47.000096 | 1,508,776,967.000096 | 97,959 |
pythondev | help | well, time for me to head out, got a meetup to get to | 2017-10-23T16:43:57.000078 | Meg | pythondev_help_Meg_2017-10-23T16:43:57.000078 | 1,508,777,037.000078 | 97,960 |
pythondev | help | nice talking with you, <@Issac> :slightly_smiling_face: | 2017-10-23T16:44:07.000338 | Meg | pythondev_help_Meg_2017-10-23T16:44:07.000338 | 1,508,777,047.000338 | 97,961 |
pythondev | help | have a good meetup | 2017-10-23T16:44:25.000087 | Issac | pythondev_help_Issac_2017-10-23T16:44:25.000087 | 1,508,777,065.000087 | 97,962 |
pythondev | help | thanks! its put on by ESRI, and I know a few of the map/geo people going to be there | 2017-10-23T16:44:57.000612 | Meg | pythondev_help_Meg_2017-10-23T16:44:57.000612 | 1,508,777,097.000612 | 97,963 |
pythondev | help | Hey all, in Python 2.7, using `unittest.assertRaisesRegexp`, how come it’s giving me false regex matching failures for my own exception classes, but working fine with something like `ValueError`? | 2017-10-23T17:33:12.000331 | Micaela | pythondev_help_Micaela_2017-10-23T17:33:12.000331 | 1,508,779,992.000331 | 97,964 |
pythondev | help | in the fail message it says:
> AssertionError: “Failed to find the needed file(s) matching 00000000-000000-xxxxxxxx” does not match “Failed to find the needed file(s) matching 00000000-000000-xxxxxxxx” | 2017-10-23T17:33:48.000164 | Micaela | pythondev_help_Micaela_2017-10-23T17:33:48.000164 | 1,508,780,028.000164 | 97,965 |
pythondev | help | When… those… are… identical… ? | 2017-10-23T17:34:09.000126 | Micaela | pythondev_help_Micaela_2017-10-23T17:34:09.000126 | 1,508,780,049.000126 | 97,966 |
pythondev | help | It’s not some weird text encoding comparison that’s failing, is it? | 2017-10-23T17:34:48.000064 | Micaela | pythondev_help_Micaela_2017-10-23T17:34:48.000064 | 1,508,780,088.000064 | 97,967 |
pythondev | help | Actually nevermind, it’s something else going wrong somewhere, if I change the code to raise a ValueError instead I still get the same matching fail | 2017-10-23T17:41:22.000363 | Micaela | pythondev_help_Micaela_2017-10-23T17:41:22.000363 | 1,508,780,482.000363 | 97,968 |
pythondev | help | Can you post the code that is failing? | 2017-10-23T17:41:57.000170 | Antionette | pythondev_help_Antionette_2017-10-23T17:41:57.000170 | 1,508,780,517.00017 | 97,969 |
pythondev | help | If you have that exact string as the regex to match, you might need to escape the parens | 2017-10-23T17:42:40.000466 | Antionette | pythondev_help_Antionette_2017-10-23T17:42:40.000466 | 1,508,780,560.000466 | 97,970 |
pythondev | help | Hi guys, i’m writing a module to read/write/edit files on target fpt server, I know python has supported ftp lib. But i just curious if I look for the folder files (in the server) and try doing nasty stuff with the file like normal file, and the ftp server can detect change, update it back to the ftp user? I dont mind write the module in the same server with fpt, but are there any drawback if I go down this path? | 2017-10-24T00:19:40.000003 | Hermina | pythondev_help_Hermina_2017-10-24T00:19:40.000003 | 1,508,804,380.000003 | 97,971 |
pythondev | help | What book do you guys recommend for a new python programmer that doesn't have programming experience. | 2017-10-24T00:25:30.000102 | Bruno | pythondev_help_Bruno_2017-10-24T00:25:30.000102 | 1,508,804,730.000102 | 97,972 |
pythondev | help | Think Python 2e. | 2017-10-24T00:30:14.000057 | Rosa | pythondev_help_Rosa_2017-10-24T00:30:14.000057 | 1,508,805,014.000057 | 97,973 |
pythondev | help | A friend of mine was also new to programming and he found it really helpful. | 2017-10-24T00:30:27.000163 | Rosa | pythondev_help_Rosa_2017-10-24T00:30:27.000163 | 1,508,805,027.000163 | 97,974 |
pythondev | help | I'd have to go with <https://automatetheboringstuff.com/> , partly because the book is free to read (the physical book still costs), partly because it's accessible and partly because it doesn't presume. It lacks real apps and takes awhile to get going but it's free and if they put down the book for something better, no harm done. | 2017-10-24T00:38:32.000092 | Seema | pythondev_help_Seema_2017-10-24T00:38:32.000092 | 1,508,805,512.000092 | 97,975 |
pythondev | help | The automate book still assumes you know basic programming concepts | 2017-10-24T00:46:14.000136 | Bruno | pythondev_help_Bruno_2017-10-24T00:46:14.000136 | 1,508,805,974.000136 | 97,976 |
pythondev | help | the book does? I thought it was based off the site which has things like
```You run the interactive shell by launching IDLE, which you installed with Python in the introduction. On Windows, open the Start menu, select All Programs ▸ Python 3.3, and then select IDLE (Python GUI). On OS X, select Applications ▸ MacPython 3.3 ▸ IDLE. On Ubuntu, open a new Terminal window and enter idle3.
A window with the >>> prompt should appear; that’s the interactive shell. Enter 2 + 2 at the prompt to have Python do some simple math.
>>> 2 + 2
4
The IDLE window should now show some text like this:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 2 + 2
4``` | 2017-10-24T00:51:00.000098 | Seema | pythondev_help_Seema_2017-10-24T00:51:00.000098 | 1,508,806,260.000098 | 97,977 |
pythondev | help | <@Bruno> it doesn't the first part is all about basic concept :slightly_smiling_face: | 2017-10-24T02:44:32.000192 | Ciera | pythondev_help_Ciera_2017-10-24T02:44:32.000192 | 1,508,813,072.000192 | 97,978 |
pythondev | help | `file(s)` is a regex that matches the string `files`, but not the string `file(s)`. | 2017-10-24T04:12:00.000420 | Louis | pythondev_help_Louis_2017-10-24T04:12:00.000420 | 1,508,818,320.00042 | 97,979 |
pythondev | help | `assertRaisesRegexp` kinda sucks if you just want to match literal strings, sadly. To do that reliably, you need something like:
```
assertRaisesRegexp(exc, r'^{}$'.format(re.escape(expected_message)), …)
``` | 2017-10-24T04:14:48.000063 | Louis | pythondev_help_Louis_2017-10-24T04:14:48.000063 | 1,508,818,488.000063 | 97,980 |
pythondev | help | Sometimes, it's easier to use the context manager instead:
```
with self.assertRaises(SomeException) as cm:
do_something()
e = cm.exception
<do assertions on e>
``` | 2017-10-24T04:15:58.000072 | Louis | pythondev_help_Louis_2017-10-24T04:15:58.000072 | 1,508,818,558.000072 | 97,981 |
pythondev | help | Hey all, Is there a way for me to be able to run a cleanup script when I use `deactivate` on my python envs? I set some environment variables in my `.env` that I would like to clear away when I'm done working on something. | 2017-10-24T04:29:41.000483 | Kayce | pythondev_help_Kayce_2017-10-24T04:29:41.000483 | 1,508,819,381.000483 | 97,982 |
pythondev | help | I’m trying to write an application that will search for indentation made with 4 spaces or with tabs, and replace them with 2 spaces. In have found 2 options for doing this:
1. with fileinput, but this seems to have some limitations and I don’t know if it can do what I want it to do
2. with re regular expressions
which one would you recommend? | 2017-10-24T04:32:05.000337 | Ines | pythondev_help_Ines_2017-10-24T04:32:05.000337 | 1,508,819,525.000337 | 97,983 |
pythondev | help | <@Ines> I don't think that regex will help you since the structure of languages is more based off of context sensitive grammars. Regular expressions (finite automata) aren't powerful enough to represent the evaluate same set of strings as CSG's. (I could be wrong though, it's been years since I've done anything with computer science theory). | 2017-10-24T04:37:56.000261 | Kayce | pythondev_help_Kayce_2017-10-24T04:37:56.000261 | 1,508,819,876.000261 | 97,984 |
pythondev | help | <@Ines> Oh wait, what am I talking about. I totally missed your question (It's well past my bedtime).
- get lines from your input file
- count how many spaces there are before the first character in the line | 2017-10-24T04:44:49.000333 | Kayce | pythondev_help_Kayce_2017-10-24T04:44:49.000333 | 1,508,820,289.000333 | 97,985 |
pythondev | help | would you please re-read my question :slightly_smiling_face: I know what I have to do, I just don’t know the easiest(/best) way to do it in python :slightly_smiling_face: | 2017-10-24T04:45:53.000231 | Ines | pythondev_help_Ines_2017-10-24T04:45:53.000231 | 1,508,820,353.000231 | 97,986 |
pythondev | help | - divide that count by four, then multiply that by two.
- take the substring that's all text, prepend ((space_count / 4) * 2) | 2017-10-24T04:46:11.000290 | Kayce | pythondev_help_Kayce_2017-10-24T04:46:11.000290 | 1,508,820,371.00029 | 97,987 |
pythondev | help | I’d probably recommend simply using a regex, then you don’t have to count | 2017-10-24T04:47:36.000159 | Junita | pythondev_help_Junita_2017-10-24T04:47:36.000159 | 1,508,820,456.000159 | 97,988 |
pythondev | help | replacing four spaces or a tab with two spaces will work, regardless of how many multiples of four or tabs (or even a mix) there is | 2017-10-24T04:47:58.000249 | Junita | pythondev_help_Junita_2017-10-24T04:47:58.000249 | 1,508,820,478.000249 | 97,989 |
pythondev | help | <@Junita> thank you! I was thinking about fileinput as that will save me the trouble of opening the file, reading its content, fix the indentation, write back the content, close the file | 2017-10-24T04:52:00.000194 | Ines | pythondev_help_Ines_2017-10-24T04:52:00.000194 | 1,508,820,720.000194 | 97,990 |
pythondev | help | also note it might just be easier to do this with a tool like sed, unless you want to do use this as a learning exercise | 2017-10-24T04:52:48.000087 | Junita | pythondev_help_Junita_2017-10-24T04:52:48.000087 | 1,508,820,768.000087 | 97,991 |
pythondev | help | I think it will confuse the regex. Assume the dashes are spaces, and the underscores are the replacement. Such that `----` gets evaluated to `_`.
What happens with `--------` (eight spaces)? Does it get evaluated like `_----` then `__`? Or does something weird happen like `-_---` where the regex wont capture the other 4 spaces. | 2017-10-24T04:53:18.000154 | Kayce | pythondev_help_Kayce_2017-10-24T04:53:18.000154 | 1,508,820,798.000154 | 97,992 |
pythondev | help | but to be honest, I haven’t found how to search for patterns using line.replace… this is why I switched to re | 2017-10-24T04:53:54.000251 | Ines | pythondev_help_Ines_2017-10-24T04:53:54.000251 | 1,508,820,834.000251 | 97,993 |
pythondev | help | I say screw it and divide space count by two and the append the text. | 2017-10-24T04:54:07.000330 | Kayce | pythondev_help_Kayce_2017-10-24T04:54:07.000330 | 1,508,820,847.00033 | 97,994 |
pythondev | help | learning exercise and also I want a script that can be used independently | 2017-10-24T04:54:30.000172 | Ines | pythondev_help_Ines_2017-10-24T04:54:30.000172 | 1,508,820,870.000172 | 97,995 |
pythondev | help | Forsure! | 2017-10-24T04:54:48.000068 | Kayce | pythondev_help_Kayce_2017-10-24T04:54:48.000068 | 1,508,820,888.000068 | 97,996 |
pythondev | help | One sec, I'm whipping something up | 2017-10-24T04:54:54.000234 | Kayce | pythondev_help_Kayce_2017-10-24T04:54:54.000234 | 1,508,820,894.000234 | 97,997 |
pythondev | help | > I think it will confuse the regex. | 2017-10-24T04:55:34.000325 | Suellen | pythondev_help_Suellen_2017-10-24T04:55:34.000325 | 1,508,820,934.000325 | 97,998 |
pythondev | help | I think regexes are not easily confused %) | 2017-10-24T04:55:46.000179 | Suellen | pythondev_help_Suellen_2017-10-24T04:55:46.000179 | 1,508,820,946.000179 | 97,999 |
pythondev | help | They are a powerful tool with maths 'n stuff backing them up | 2017-10-24T04:56:03.000149 | Suellen | pythondev_help_Suellen_2017-10-24T04:56:03.000149 | 1,508,820,963.000149 | 98,000 |
pythondev | help | <@Kayce> it’s pretty easy, you make a match (such as `^(\s{4}|\t)`) and then feed it into `re.sub`, which can handle multiple replaces: <https://docs.python.org/3/library/re.html#re.sub> | 2017-10-24T04:56:19.000214 | Junita | pythondev_help_Junita_2017-10-24T04:56:19.000214 | 1,508,820,979.000214 | 98,001 |
pythondev | help | exactly this | 2017-10-24T04:58:33.000480 | Suellen | pythondev_help_Suellen_2017-10-24T04:58:33.000480 | 1,508,821,113.00048 | 98,002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.