I am unreasonably excited for python 3.6. f-strings! Asynchronous generators and comprehensions! Underscores in numeric literals! Preservation of argument order in class instantiation and **kwargs! Low-level optimizations I don't fully understand! Python is a great language that's getting better all the time. It's certainly not perfect and it's not appropriate for everything, but it's so good most of the time. I enjoy progamming in python and the python community and I hope you all do too.
|
|
# ? Dec 21, 2016 21:33 |
|
|
# ? May 9, 2024 19:12 |
|
I use .format() probably way more than I should, so I'm pretty hyped for f-strings. Can't wait to write the lovely, un-maintainable code ya'll are talking about.
|
# ? Dec 21, 2016 22:16 |
|
The great thing for me is that I'm almost always in charge of my software stack so I can switch to 3.6 on day one!
|
# ? Dec 21, 2016 22:38 |
|
Baby Babbeh posted:I use .format() probably way more than I should, so I'm pretty hyped for f-strings. Can't wait to write the lovely, un-maintainable code ya'll are talking about. Is the f-string thing just a shorthand for .format()?
|
# ? Dec 21, 2016 22:43 |
|
I'm trying to learn/use Sphinx but I swear every single tutorial I've found is completely worthless and leaves more questions than answers. For example I just want to do something simple like this:code:
Another seemingly simple but difficult thing I want to do is something like: I have a dict with some parameters. I want sphinx to document each key, and I want it to take whatever I already wrote in inline comments. code:
Boris Galerkin fucked around with this message at 00:21 on Dec 22, 2016 |
# ? Dec 21, 2016 23:40 |
|
Has anyone ever been able to pin a python script to the start menu?
|
# ? Dec 21, 2016 23:46 |
|
Are f-strings going to be back ported in some way to older versions of Python or is it 3.6 only?
|
# ? Dec 22, 2016 00:05 |
|
Boris Galerkin posted:I'm trying to learn/use Sphinx but I swear every single tutorial I've found is completely worthless and leaves more questions than answers. For example I just want to do something simple like this: Do you know any OSS project that does what you want in their documentation? I never came across this before.
|
# ? Dec 22, 2016 01:01 |
Master_Odin posted:Are f-strings going to be back ported in some way to older versions of Python or is it 3.6 only? As far as I'm aware 3.6 and above only.
|
|
# ? Dec 22, 2016 01:06 |
|
Boris Galerkin posted:I'm trying to learn/use Sphinx but I swear every single tutorial I've found is completely worthless and leaves more questions than answers. For example I just want to do something simple like this: Have you taken a look at autodata (need to scroll down to autodata). You can do the following: Python code:
|
# ? Dec 22, 2016 01:16 |
|
HardDiskD posted:Do you know any OSS project that does what you want in their documentation? I never came across this before. Yes, doxygen lets me do this. For example in fortran syntax, I can do normal comments that won't show up in the auto generated documentation with the normal '!' prefix, but I can also choose to use '!<' and doxygen will include that particular comment line. For my second example, standard fortran doesn't really have dicts so you could use something like a derived type or whatever. code:
And in the documentation it automagically documents each member "key" without me having to copy and paste it and put it all into a docstring.
|
# ? Dec 22, 2016 01:28 |
|
accipter posted:Have you taken a look at autodata (need to scroll down to autodata). You can do the following: Hmm ok, will try this again tomorrow. I did some searching and i did see some examples using the "#: etc" syntax and I tried it, but it did nothing. Does "autodata" not get enabled by default? Is being able to explicitly tell sphinx to put this comment line in the documents not a common thing for python developers?
|
# ? Dec 22, 2016 01:39 |
|
Feral Integral posted:Is the f-string thing just a shorthand for .format()? We just talked about it on the previous page.
|
# ? Dec 22, 2016 01:50 |
|
Boris Galerkin posted:Yes, doxygen lets me do this. For example in fortran syntax, I can do normal comments that won't show up in the auto generated documentation with the normal '!' prefix, but I can also choose to use '!<' and doxygen will include that particular comment line. For my second example, standard fortran doesn't really have dicts so you could use something like a derived type or whatever. I meant any projects that were generated with Sphinx
|
# ? Dec 22, 2016 02:13 |
|
Boris Galerkin posted:Hmm ok, will try this again tomorrow. I did some searching and i did see some examples using the "#: etc" syntax and I tried it, but it did nothing. Does "autodata" not get enabled by default? Is being able to explicitly tell sphinx to put this comment line in the documents not a common thing for python developers? Usage guidance is really meant to go into the docstring. Comments are there to help the understand the code, and shouldn't really be separated from the code. If you want to have the autodata fields show up, you have to request them in the .rst files, or modify the autosummary templates to include the information by default.
|
# ? Dec 22, 2016 03:18 |
|
accipter posted:Usage guidance is really meant to go into the docstring. Comments are there to help the understand the code, and shouldn't really be separated from the code. It's starting to sound like sphinx isn't the right tool for this case then. Not knocking on it, but in this case I don't want to separate usage vs what the code does because the developers are going to be the only users. I want high level information (this function solves df(x)/dx = exp(a(x)*q(x) - 1), where a(x) = ...) but I also want selected comments to appear both in the documentation with latex or latex like rendered math that show what I actually implemented/am solving since the actual equation implemented might not resemble the one in the docstring, and for it to appear in the code next to the relevant lines.
|
# ? Dec 22, 2016 06:07 |
|
Boris Galerkin posted:It's starting to sound like sphinx isn't the right tool for this case then. Not knocking on it, but in this case I don't want to separate usage vs what the code does because the developers are going to be the only users. I want high level information (this function solves df(x)/dx = exp(a(x)*q(x) - 1), where a(x) = ...) but I also want selected comments to appear both in the documentation with latex or latex like rendered math that show what I actually implemented/am solving since the actual equation implemented might not resemble the one in the docstring, and for it to appear in the code next to the relevant lines. You can definitely make Sphinx work for what you want to do, but it isn't standard practice. The biggest issue that I see with what you are trying to do is that including a # comment in the documentation seems worthless to me without the code associated with that comment. If you agree, then it would be easy to include links to highlighted source code using sphinx.ext.viewcode. This would allow a user to browse the API and readily access the source code to see implementation. If you are set on including some # comments within the generated documentation that is possible with Sphinx and how you accomplish that depends on how you are generating the documentation. If you are using autodoc and/or autosummary, you need to modify the templates to include the autodata field. This would take about 10 minutes to modify the templates.
|
# ? Dec 22, 2016 17:09 |
|
accipter posted:You can definitely make Sphinx work for what you want to do, but it isn't standard practice. Anyway, it sort of sounds like you are looking for a "literate programming" tool for Python. If that's the case you might find Pycco more suited.
|
# ? Dec 22, 2016 22:52 |
|
accipter posted:You can definitely make Sphinx work for what you want to do, but it isn't standard practice. The biggest issue that I see with what you are trying to do is that including a # comment in the documentation seems worthless to me without the code associated with that comment. If you agree, then it would be easy to include links to highlighted source code using sphinx.ext.viewcode. This would allow a user to browse the API and readily access the source code to see implementation. If you are set on including some # comments within the generated documentation that is possible with Sphinx and how you accomplish that depends on how you are generating the documentation. If you are using autodoc and/or autosummary, you need to modify the templates to include the autodata field. This would take about 10 minutes to modify the templates. I do agree and that viewcode extension looks like it might work out. I'll give it a shot thanks. BigRedDot posted:Anyway, it sort of sounds like you are looking for a "literate programming" tool for Python. If that's the case you might find Pycco more suited. That seems way too verbose without looking into the configuration. I'm going to give the viewcode extension a shot. Unrelated question, tell me if I'm doing this wrong: I have a module called message_tools.py that contains some functions for, well, messaging/output. Is it wrong to add this to my __init__.py? code:
e: I made a setup.py for this package and got it working smoothly, except that the PKG INFO file says 'PLATFORM: UNKNOWN'. I tried adding the classifier for OS :: POSIX :: Linux but that didn't change the PLATFORM string. What do I need to add to fix that? Boris Galerkin fucked around with this message at 23:15 on Dec 23, 2016 |
# ? Dec 23, 2016 23:13 |
Hey so I finally got around to watching this talk, and it was pretty good! Thanks for linking it.
|
|
# ? Dec 24, 2016 02:23 |
|
I'm going to be making a very simple local db for a small organisation, but couldn't find any SQL frontends for querying only. I thougt I could mock one up in Python relatively quickly, but what's the go to framesork for simple UIs?
|
# ? Dec 25, 2016 00:19 |
|
TKinter (based on TK) is native to Python and lets you make really simple UIs really fast. For a simple querying-only interface it'll probably work in a pinch and won't take long to write PyQt or PySide if you want it to look nicer / you want to do more complicated stuff, and especially if you want the user to actually modify fields
|
# ? Dec 25, 2016 00:37 |
|
Hey BigRedDot: I just noticed the link to the weather source code here goes to a 404 on Github.
|
# ? Dec 31, 2016 00:47 |
|
What's the word on fastest plotting in Python? I read that matplotlib with the TkAgg backend is probably the fastest way to dump plots, does anyone know for sure?
|
# ? Dec 31, 2016 06:14 |
|
Thermopyle posted:Hey BigRedDot: I just noticed the link to the weather source code here goes to a 404 on Github. Ah thanks, that got fixed on the front page of the demo site but the links in the gallery there are separate.
|
# ? Dec 31, 2016 07:47 |
|
QuarkJets posted:What's the word on fastest plotting in Python? I read that matplotlib with the TkAgg backend is probably the fastest way to dump plots, does anyone know for sure? No idea on speed, but recently I started using Plotly, for reasons like "actually reasonable to install" and its not bad.
|
# ? Jan 3, 2017 08:42 |
|
Python using the Go runtime? Why not: https://opensource.googleblog.com/2017/01/grumpy-go-running-python.html
|
# ? Jan 4, 2017 18:08 |
|
What's the point of that? Is Go concurrency really that much better than asyncio that you'd give up access to some of python's most powerful libraries to use it?
|
# ? Jan 4, 2017 18:27 |
|
I feel like "real world" scenarios is only true within Google if they're not including c extensions.
|
# ? Jan 4, 2017 18:56 |
|
Baby Babbeh posted:What's the point of that? Is Go concurrency really that much better than asyncio that you'd give up access to some of python's most powerful libraries to use it? I'd really like to see some more in-depth discussion of this. I mean, they'd have to move to Python 3+ to get asyncio, but it seems like that'd be less work than what they did, so maybe Go concurrency really is that much better? Also, there's other lightweight thread alternatives like eventlet/gevent... Of course, Google also has a real hard-on for Go, so maybe it's just the new and shiny factor?
|
# ? Jan 4, 2017 20:08 |
|
Shouldn't this work?code:
|
# ? Jan 4, 2017 20:19 |
|
Cingulate posted:Shouldn't this work? I think you have to install it in an environment. The base conda install is python 3.5 and you can't change it. (I dont do a lot with conda other than set up my environments so this post is mostly speculation)
|
# ? Jan 4, 2017 20:21 |
Not until Anaconda updates to python 3.6 by default, which will happen by the end of the month. For now, you can create a new environment for python 3.6. code:
windows code: code:
code:
|
|
# ? Jan 4, 2017 20:23 |
|
Last year Dave Beazly gave a talk about removing the GIL, and mentioned that moving to fine grained locks (which is what GrumPy does) had a big performance regression on single threaded code, making it a no-go for mainline CPython. The chart in the blog post seems to indicate that GrumPy has this same regression, but they obviously don't have to stick the same guarantees as the CPython team.
|
# ? Jan 4, 2017 20:34 |
|
Ah okay, thanks. I will just wait then. I didn't want to make a new env because I have tons of packages and I don't think there is a simple way of migrating my py3.5 packages to a py3.6 env right?
|
# ? Jan 4, 2017 20:37 |
|
Thermopyle posted:I'd really like to see some more in-depth discussion of this. I bet it's more work to take a big codebase like YouTube to 3+ than to write a compiler that'll drop-in replace 2. The fib test they cite just used threads, which would underperform an approach that spun off processes (last I checked, on Windows, for something that uses lots of memory). I'm not familiar enough with how Go handles that sort of thing to know if it's a good comparison, but I'm guessing it's weak and meant to say "Look, ma: no GIL!" They should have included comparisons to the other alternatives they explored to make a good case, but at the end of the day we're not the audience they need to justify this to.
|
# ? Jan 4, 2017 20:40 |
|
from some stuff i looked at last year, go's concurrency for cpu intensive threads was around 50x cpython's. however, go has some seriously nasty leaks that are completely beyond your ability to control, so you will almost certainly end up with memory issues that are near impossible to isolate, so if you have even the slightest reason to care about memory consumption, it seems like a terrible choice i'd aim for pypy before running python in go if i was willing to make tradeoffs on certain libs since it's apparently significantly more performant than cpython, but i don't actually need to so i've only done some light reading on it
|
# ? Jan 4, 2017 20:53 |
|
Dex posted:from some stuff i looked at last year, go's concurrency for cpu intensive threads was around 50x cpython's. however, go has some seriously nasty leaks that are completely beyond your ability to control, so you will almost certainly end up with memory issues that are near impossible to isolate, so if you have even the slightest reason to care about memory consumption, it seems like a terrible choice Oh that's interesting and now you've got me wishing for a Grumpy vs IronPython cage match since neither gets C extensions. My money's on IPY because I know I've seen CPU-heavy code run better there than CPython and it has a really good GC behind it
|
# ? Jan 4, 2017 21:07 |
|
Cingulate posted:Ah okay, thanks. I will just wait then. I always use pip to install stuff in my conda environments, so if that was the case for you, I'd do: code:
|
# ? Jan 4, 2017 22:12 |
|
|
# ? May 9, 2024 19:12 |
|
Munkeymon posted:I bet it's more work to take a big codebase like YouTube to 3+ than to write a compiler that'll drop-in replace 2. Yeah, after I thought about it some more I think you're probably right. I've literally never attempted to move a python 2 project to python 3...
|
# ? Jan 4, 2017 22:14 |