|
but you're actually using that variable! (this is the dumbest tangent)
|
# ? Apr 12, 2017 14:10 |
|
|
# ? May 16, 2024 17:51 |
|
For real though, how did you oldsters ever live with Python 2 and its leaking list comps?
|
# ? Apr 12, 2017 14:14 |
|
Cingulate posted:For real though, how did you oldsters ever live with Python 2 and its leaking list comps? You mean the leaking variable that is used on building the comps or you mean like a memory leak or something like that? How to live with the former is to just redefine the name before reusing.
|
# ? Apr 12, 2017 14:24 |
|
HardDiskD posted:You mean the leaking variable that is used on building the comps In other news, I may be literally the worst coder ITT, but I got really good teacher evaluations on my recent Python class and we'll try and apply for funding for a bigger project for teaching Python to students, and for using Python to teach science to students
|
# ? Apr 12, 2017 14:27 |
|
I'm starting to run into more advanced packages that are requiring things like Microsoft Visual C++. I've also been reading about how some things are too slow in Python so other languages are used to deal with this. Is there an article/video that explains this all well?
|
# ? Apr 12, 2017 16:36 |
|
Broad topic. Many python modules use C code to improve speed. When installing them from source, (Including pip without a wheel) you'll need a compiler; Visual C++ is used in Win. Which package are you referring to? You can usually avoid this by using Conda, or a Chris Gohlke binary. To speed up Python, you can use Cython, Numba, vectorized code, PyPy etc, on the bottlenecks. What specifically do you want to know?
|
# ? Apr 12, 2017 17:06 |
|
Dominoes posted:Broad topic. Many python modules use C code to improve speed. When installing them from source, (Including pip without a wheel) you'll need a compiler; Visual C++ is used in Win. Which package are you referring to? You can usually avoid this by using Conda, or a Chris Gohlke binary. You've given me enough vocab I had to look up that I more or less understand what I need to know now.
|
# ? Apr 12, 2017 17:33 |
|
I'm working on rewriting a jython library and the wanker who wrote this spaghetti should be drawn and quartered just for using jython
|
# ? Apr 12, 2017 17:39 |
|
I started developing with Sublime Text and then switched to PyCharm since I've been working mostly with Python. However, my new job has me focusing on Flask apps and PyCharm seems to be a bit lacking when it comes to dealing with HTML, CSS, and JS. I miss all the awesome plugins that come with Sublime Text as well. Am I missing something or should I be looking at something else to be developing Flask stuff?
|
# ? Apr 12, 2017 20:59 |
|
huhu posted:I started developing with Sublime Text and then switched to PyCharm since I've been working mostly with Python. However, my new job has me focusing on Flask apps and PyCharm seems to be a bit lacking when it comes to dealing with HTML, CSS, and JS. I miss all the awesome plugins that come with Sublime Text as well. Am I missing something or should I be looking at something else to be developing Flask stuff? I feel like I might be saying this too often at this point, but have you considered VSCode accepted Christ as your Lord and Savior https://code.visualstudio.com/docs/languages/python
|
# ? Apr 12, 2017 21:13 |
|
huhu posted:I started developing with Sublime Text and then switched to PyCharm since I've been working mostly with Python. However, my new job has me focusing on Flask apps and PyCharm seems to be a bit lacking when it comes to dealing with HTML, CSS, and JS. I miss all the awesome plugins that come with Sublime Text as well. Am I missing something or should I be looking at something else to be developing Flask stuff? If you have the cash, consider shelling out for the IntelliJ IDEA ultimate version. It includes all of the features in PyCharm (slightly behind pycharm releases), plus HTML, JavaScript, and pretty much everything else. People also seem to love VS Code, and it's free.
|
# ? Apr 12, 2017 21:20 |
|
The Fool posted:I feel like I might be saying this too often at this point, but have you considered VSCode accepted Christ as your Lord and Savior Haven't used it but this REST client extension for it might be useful too
|
# ? Apr 12, 2017 21:25 |
|
Jetbrains makes a lot of really nice stuff and I really like IntelliJ for Java and JavaScript. I found Pycharm to be frustrating to use because most small Python apps aren't organized the way Pycharm seems to try to organize them
|
# ? Apr 12, 2017 21:25 |
|
The Fool posted:I feel like I might be saying this too often at this point, but have you considered VSCode accepted Christ as your Lord and Savior This is amazing.
|
# ? Apr 12, 2017 21:33 |
I mostly use visual studio code as well. I don't do any webdev so I can't comment on its use for that.
|
|
# ? Apr 12, 2017 21:36 |
|
When I see how far it's come in a relatively short amount of time, I keep wanting to give VisualCode a spin on macOS. But then I remember how addicted I am to the integrated console and debugging stuff in PyCharm.
|
# ? Apr 12, 2017 21:38 |
|
huhu posted:I started developing with Sublime Text and then switched to PyCharm since I've been working mostly with Python. However, my new job has me focusing on Flask apps and PyCharm seems to be a bit lacking when it comes to dealing with HTML, CSS, and JS. I miss all the awesome plugins that come with Sublime Text as well. Am I missing something or should I be looking at something else to be developing Flask stuff? What? PyCharm is amazing for HTML/CSS/JS. It's basically a superset of Webstorm which is already widely liked for webdev stuff. I often use PyCharm for projects that are only HTML/CSS/JS. Maybe ask about some specific things you're missing and I bet you'll find that most of them are supported.
|
# ? Apr 12, 2017 22:20 |
|
Cingulate posted:For real though, how did you oldsters ever live with Python 2 and its leaking list comps? I'm not sure that it has ever mattered to me; I just kind of assumed that the last value of the comprehension variable would be available in the local scope and didn't realize that this was actually undesired behavior. e: I still use Python2, because I can't choose what our production systems run. A surprising number of people are in this boat QuarkJets fucked around with this message at 22:45 on Apr 12, 2017 |
# ? Apr 12, 2017 22:41 |
|
QuarkJets posted:I'm not sure that it has ever mattered to me; I just kind of assumed that the last value of the comprehension variable would be available in the local scope and didn't realize that this was actually undesired behavior. This is exactly right. It was just the way it was. It was never a problem.
|
# ? Apr 12, 2017 23:23 |
|
I'm not sure if I dislike comprehensions leaking, tbh.Python code:
Space Kablooey fucked around with this message at 14:16 on Apr 13, 2017 |
# ? Apr 13, 2017 14:13 |
|
Whoah - I always assumed they leaked, and set my vars up so it wouldn't be an issue. FYI, javascript uses a 'let' command that explicitly makes a variable nonleaky.
|
# ? Apr 13, 2017 14:22 |
|
code:
|
# ? Apr 13, 2017 14:22 |
|
Thermopyle posted:What?
|
# ? Apr 13, 2017 17:32 |
|
Right, I got that from your first post. I'm asking like what?
|
# ? Apr 13, 2017 18:17 |
|
Regex question: I have the following bit of code that returns some json. I want to change the output to be <whatever>.sub.example.com. Normally I would be able to do this in awk, but in this particular case it needs to be handled in python and I'm not as good at python as I thought. How could I replace example.com with sub.example.com for all the dictionary entries? The filterIP bit works so I was trying to do that again, but I'm having a hard time with it. code:
|
# ? Apr 14, 2017 22:04 |
|
If that's substitution is all you need to do, can you not just use the replace() string method? Do you need to use regex?
|
# ? Apr 14, 2017 23:15 |
|
I'm not actually working with strings. It's a list.code:
Methanar fucked around with this message at 23:48 on Apr 14, 2017 |
# ? Apr 14, 2017 23:45 |
|
Methanar posted:I'm not actually working with strings. It's a list. If you have a long list of strings, like code:
code:
|
# ? Apr 15, 2017 00:18 |
|
If you do need to anchor it to the right your regexp itself is fine. Just modify filterSub and filterIP to take a string instead of a list then do this:code:
code:
You could also use map or whatever else I guess, but personally in this kind of situation I almost always prefer giving a name to a comprehension like this. I think it's a lot more readable, assuming you aren't as big a fan of gratuitous profanity as I am.
|
# ? Apr 15, 2017 00:47 |
|
chutwig posted:If you have a long list of strings, like Yep, that's where I'd go too. code:
|
# ? Apr 15, 2017 00:51 |
|
The data is actually more structured like this. I gave the replace snippet a shot, but it didn't do anything.code:
code:
|
# ? Apr 15, 2017 00:59 |
|
Methanar posted:I'm not actually working with strings. It's a list. A list of strings?
|
# ? Apr 15, 2017 01:00 |
|
Methanar posted:The data is actually more structured like this. I gave the replace snippet a shot, but it didn't do anything. What you have is a dictionary where the keys are strings and the values are lists of strings, and what you want to do is do a replace in all of those lists of strings. Tables-breaking pseudocode: Python code:
QuarkJets fucked around with this message at 01:09 on Apr 15, 2017 |
# ? Apr 15, 2017 01:05 |
|
Methanar posted:The data is actually more structured like this. I gave the replace snippet a shot, but it didn't do anything. If you iterating over a dictionary you'll need to update the comprehension accordingly. If your use case really is just the simple replace, I think regex is overkill here and makes for messier code for no reason.
|
# ? Apr 15, 2017 01:06 |
|
Got it working as it's supposed to. I was being dumb. This is exactly what I was looking for. Thanks a lot. I learned a few things today. code:
|
# ? Apr 15, 2017 01:25 |
|
funny Star Wars parody posted:Jetbrains makes a lot of really nice stuff and I really like IntelliJ for Java and JavaScript. I found Pycharm to be frustrating to use because most small Python apps aren't organized the way Pycharm seems to try to organize them Personally, I write all my Java in IntelliJ but only larger Python projects in PyCharm - if it's something small I'm A-OK with not having all the fancy features.
|
# ? Apr 15, 2017 21:08 |
|
funny Star Wars parody posted:Jetbrains makes a lot of really nice stuff and I really like IntelliJ for Java and JavaScript. I found Pycharm to be frustrating to use because most small Python apps aren't organized the way Pycharm seems to try to organize them What does this mean exactly? AFAIK, PyCharm doesn't care how your projects are organized. I often go through a lot of different structures on a project. It starts out small with a few files just right next to each other, them I move stuff into packages then I move stuff into a full-blown thjngamajig with a setup.py, etc... PyCharm doesn't seem to give a crap and in fact helps with that since it does a fine job with automatic refactoring.
|
# ? Apr 15, 2017 23:03 |
|
PyCharm doesn't like to work with files unless they're in a folder that includes PyCharm meta files (.idea directory). Maybe that's it?
|
# ? Apr 15, 2017 23:07 |
|
https://github.com/python/cpython/blob/3.6/Lib/collections/__init__.pycode:
Is there a reason ever to write code this way like the init method of OrderedDict? Why wouldn't you explicitly write out "self" as the first argument?
|
# ? Apr 15, 2017 23:22 |
|
|
# ? May 16, 2024 17:51 |
Boris Galerkin posted:https://github.com/python/cpython/blob/3.6/Lib/collections/__init__.py I have no idea. This is really strange.
|
|
# ? Apr 15, 2017 23:40 |