|
click is a module by the flask guy that provides a nice interface to optparse http://click.pocoo.org/4/
|
# ? Aug 1, 2015 22:25 |
|
|
# ? May 9, 2024 04:44 |
|
salisbury shake posted:click is a module by the flask guy that provides a nice interface to optparse Interesting. It'd be interesting to see an argument parsing library that used function parameter annotations.
|
# ? Aug 1, 2015 22:47 |
|
pip install ipdb Then wherever you want a break point;- import ipdb; ipdb.set_trace() I prefer ipdb, as it uses iPython which has nice color coding and tab completion and stuff, assuming your using a platform that supports readline
|
# ? Aug 2, 2015 16:22 |
|
Is there a way to get Pycharm to show and push to all git remotes? Currently, it only displays Origin.
|
# ? Aug 2, 2015 19:12 |
|
Dominoes posted:Is there a way to get Pycharm to show and push to all git remotes? Currently, it only displays Origin. Not even git lets you do this with one command without some setup first What you can do instead is create an "all" remote with several URLs attached to it: git remote add all host_origin:path/myrepo.git git remote set-url --add all host1:path1/myrepo.git git remote set-url --add all host2:path2/myrepo.git And then you can use "git push all --all" to push to all of them at once I haven't used Pycharm's git interface, but if Pycharm is only showing Origin, then you probably haven't added any remotes yet.
|
# ? Aug 2, 2015 19:42 |
|
Thanks. With normal git, while I can't push to all at once, I can push to any individually. When I run 'git remote', it correctly shows both remotes, but Pycharm only sees one.
|
# ? Aug 2, 2015 19:59 |
|
I much prefer docopt over click (and I've used both, extensively).
|
# ? Aug 2, 2015 20:43 |
|
I'm making some charts with matplotlib, and on one sort of chart, over time, everything is right but the x-axis labels are ugly times like '13:43:00.0000000' and I can't understand the documentation well enough to know what to even do to format this better I mean, it's almost correct, but it could be so much better. How do I do this? I'm using plot_date instead of plain old plot, if that makes a difference.
|
# ? Aug 3, 2015 03:00 |
|
Ghost of Reagan Past posted:I'm making some charts with matplotlib, and on one sort of chart, over time, everything is right but the x-axis labels are ugly times like '13:43:00.0000000' and I can't understand the documentation well enough to know what to even do to format this better I mean, it's almost correct, but it could be so much better. How do I do this? Try using the formatting argument (I think it's "fmt")
|
# ? Aug 3, 2015 04:27 |
|
QuarkJets posted:Try using the formatting argument (I think it's "fmt")
|
# ? Aug 3, 2015 04:32 |
|
.
|
# ? Aug 3, 2015 06:02 |
|
Ghost of Reagan Past posted:I'm making some charts with matplotlib, and on one sort of chart, over time, everything is right but the x-axis labels are ugly times like '13:43:00.0000000' and I can't understand the documentation well enough to know what to even do to format this better I mean, it's almost correct, but it could be so much better. How do I do this? How about plotting with pandas?
|
# ? Aug 3, 2015 06:36 |
|
If you don't have many labels, just pass them in explicitly and be done with it.
|
# ? Aug 3, 2015 07:19 |
|
vikingstrike posted:If you don't have many labels, just pass them in explicitly and be done with it.
|
# ? Aug 3, 2015 15:48 |
|
Recently started learning Python and numpy/Scipy and ran in to the usual floating point issues. A quick and dirty example for illustration purposes:code:
|
# ? Aug 3, 2015 20:05 |
|
embarrasing tank posted:numpy/scipy does not to my knowledge support the Decimal type, but precision is very important to me. Am I missing a really dumb solution to this? No, numpy is for doing math with normal sorts of datatypes, and if you have precision problems with your floats it doesn't have any intrinsic way to fix that problem. If you need essentially arbitrary precision and can't do fuzzy comparisons you could try a different library like SymPy or mpmath. Alternatively if you just need MORE precision you might be able to force a numpy.float128 dtype.
|
# ? Aug 3, 2015 20:20 |
|
OnceIWasAnOstrich posted:No, numpy is for doing math with normal sorts of datatypes, and if you have precision problems with your floats it doesn't have any intrinsic way to fix that problem. If you need essentially arbitrary precision and can't do fuzzy comparisons you could try a different library like SymPy or mpmath. Alternatively if you just need MORE precision you might be able to force a numpy.float128 dtype. Thank you for this info!
|
# ? Aug 3, 2015 20:25 |
|
Can someone explain why this code is running the way it is? As far as I am aware the any statements should be returning TRUE every time.code:
|
# ? Aug 3, 2015 20:45 |
|
For starters, your predicate says "1 is equal to <whatever>", the numeral '1', and I think you meant lower-case "L". You might want to look into using a better font
|
# ? Aug 3, 2015 20:53 |
|
BigRedDot posted:Welp. https://news.ycombinator.com/item?id=9936295 Something to read grib files (like pygrib) would be great.
|
# ? Aug 3, 2015 21:12 |
|
Spaseman posted:Can someone explain why this code is running the way it is? As far as I am aware the any statements should be returning TRUE every time. Minor Pythonic points: the way to write those comparisons is if 'Dogs' in testclass001.mylist; you can just put the pass right under class Class002(object):, you don't need to declare the constructor if it doesn't do anything; and it's fine to define the instance attribute mylist of Class001 without listing it among the parameters of the constructor since you aren't doing anything with the value of the argument.
|
# ? Aug 3, 2015 21:33 |
|
SurgicalOntologist posted:I much prefer docopt over click (and I've used both, extensively). This owns
|
# ? Aug 3, 2015 22:36 |
|
embarrasing tank posted:Recently started learning Python and numpy/Scipy and ran in to the usual floating point issues. A quick and dirty example for illustration purposes: just curious, but why do you want precision more than IEEE-754 provides, when doing math with exponentials? what's your use case?
|
# ? Aug 4, 2015 03:18 |
|
Thanks for the help everyone. I can't believe the problem was something so dumb. The reason I asked about that code is that I am trying to recreate the code I'm using in my actual project to fix a different problem I am having. No matter what method I try, I can never get the following code to work correctly: code:
I have no formal programming experience so please tell me if something doesn't make sense.
|
# ? Aug 4, 2015 06:12 |
|
Spaseman posted:Thanks for the help everyone. I can't believe the problem was something so dumb. I think your comparison needs to be: Python code:
Python code:
|
# ? Aug 4, 2015 08:11 |
|
Stringent posted:I think your comparison needs to be: That is EXACTLY what I needed, thank you so much. I've been fighting that problem for days and now I can finally move on.
|
# ? Aug 4, 2015 08:33 |
|
pmchem posted:just curious, but why do you want precision more than IEEE-754 provides, when doing math with exponentials? what's your use case? Honestly it was disingenuous to use the term precision, I'm not sure why I did. What I was really after was consistency. OnceIWasAnOstrich's answer put me on the right track and I have ended up starting to use Theano.
|
# ? Aug 4, 2015 13:28 |
|
Spaseman posted:That is EXACTLY what I needed, thank you so much. I've been fighting that problem for days and now I can finally move on. Do you understand why though? When you create a new object it's a unique instance, so you can't just check new_sword == old_sword because they refer to two different, individual objects, even though they're instances of the same class It's important because it comes up a lot, and you might have your own equality checking code so you can do simple comparisons (like keyring_1 comparing the list of doors it opens to the list that keyring_2 opens)
|
# ? Aug 4, 2015 16:23 |
|
embarrasing tank posted:Honestly it was disingenuous to use the term precision, I'm not sure why I did. What I was really after was consistency. OnceIWasAnOstrich's answer put me on the right track and I have ended up starting to use Theano. Theano should not help with this, it's basically a more complicated way to use numpy. What is the input you're giving to expit that it returns different values on different runs?
|
# ? Aug 4, 2015 21:05 |
|
PyQt question. I'm having a hard time understanding how the model/view concept works. Right now, I'm trying to set up a table, but when I call QTableView.setModel(Model), I get "RuntimeError: super-class __init__() of type Model was never called". However, I'm dead certain that __init__ is called. What have I done wrong? Here's the skeleton of the code:code:
|
# ? Aug 5, 2015 02:47 |
|
Nippashish posted:Theano should not help with this, it's basically a more complicated way to use numpy. What is the input you're giving to expit that it returns different values on different runs? I'm deliberately not going in to detail as I don't want to clog up the short questions thread with a long question and my idiocy, but the short version is you are right, I misinterpreted the Theano documentation on first reading. However Sympy's symbolic versions of variables seem to give me what I want when I evaluate them. By that I mean if I have two expressions that are exactly the same, just slightly rearranged (and not in a way that would effect output) then I should get the same output.
|
# ? Aug 5, 2015 08:16 |
|
So I am trying to modify some existing tools we have to query a web database. We use a proxy, so the setup is very much like it is in the python docs, specifically:code:
Everything Im finding seems to imply I can just read() off the data object and merrily take it (line by line if I have to), but that only results in blanks. If I try to read out lines after the csv.reader() takes it, I also get nothing. Right now the only way I know of to get what I want would be to write to a tempfile and then read it back in. There's gotta be a better way, and I'm most certainly missing something obvious. Thanks in advance y'all.
|
# ? Aug 6, 2015 23:50 |
|
How do you get IPython to display HTML? In an IPython console in spyder, I'm using %%cython -a to display the generated code for a cython function, but on a new version of WinPython, all I get is Out[12]: <IPython.core.display.HTML object>. On an old install of Anaconda, doing the same displays the annotated cython output in the console. EDIT: Well, it seems like the only way to do this is to use an old version of IPython. Lame, it was nice being able to do everything without leaving spyder. Communist Pie fucked around with this message at 05:30 on Aug 9, 2015 |
# ? Aug 7, 2015 17:12 |
|
JetsGuy posted:So I am trying to modify some existing tools we have to query a web database. We use a proxy, so the setup is very much like it is in the python docs, specifically: I don't know what the hell happened but when I loaded my machine this morning, it was working the way I figured it would. That is, I could do just a straight "for line in data" to get what was being queried. Guess it was just one of those things.
|
# ? Aug 7, 2015 18:03 |
|
I'm writing a Web Services server using flask, with a back end of sqlite3. I want to output data in a JSON format directly from the database, including the column headings like so:JavaScript code:
Python code:
|
# ? Aug 8, 2015 17:43 |
|
Begall posted:The first method I've come up with is to do something like this, but it seems messy enough that I feel like I must be missing a trick. If you have separate iterables containing keys and values, a trick you can use for creating dictionaries is: Python code:
Python code:
Python code:
Python code:
Begall posted:In addition, I would need to add further code/another variable if I wanted the key fields not to be direct copy of the DB field names, which would be preferrable. Xeno54 fucked around with this message at 18:45 on Aug 8, 2015 |
# ? Aug 8, 2015 18:40 |
|
Can someone explain how to make the line "BaconTest001.Pit001" in the "AreaOne" class run? I'm working on deepening my understanding of classes and their interctions but nothing I do can make this particular line run. I know the code is a mess but that was the point.code:
|
# ? Aug 9, 2015 06:08 |
|
Spaseman posted:Can someone explain how to make the line "BaconTest001.Pit001" in the "AreaOne" class run? I think you are not understanding the difference between a class and an instance of a class. Nothing about classes makes any sense at all if you don't understand this distinction.
|
# ? Aug 9, 2015 07:15 |
|
Nippashish posted:I think you are not understanding the difference between a class and an instance of a class. Nothing about classes makes any sense at all if you don't understand this distinction. A class is the constructor or blueprint that is used to create instances that can be edited but the constructor itself is not actually changed in any way, correct?
|
# ? Aug 9, 2015 07:43 |
|
|
# ? May 9, 2024 04:44 |
|
Well, BaconTest001 doesn't exist "globally". It's owned by the Events object, so the Area object can't access it. You either need to make the Area class have its own BaconTest instance, or pass it into Area.
|
# ? Aug 9, 2015 07:59 |