Earlier quoted context omitted.
Yesterday, I was disgusted to see framers putting up a house that clearly plagiarized the entire internal structure of my own. Same joint interfaces, same structural idioms when dealing with things like staircases, windows, and rafters, same fasteners, same adhesives, even the building materials! Aside from the most general aspects of the layout, it was exactly the same right down to the inch! People have no professi…
That analogy only works if you designed/architected your own house.
GitHub Copilot available for JetBrains and Neovim
141–150 of 446 posts
Re: GitHub Copilot available for JetBrains and Neovim
#142Is it irrational that this makes me a little anxious about job security over the longterm? Idk why but this was my initial reaction when learning about this.
Given the scenario where copilot and its likes becomes used in a widespread manner. Can it be argued that this might improve productivity but stifle innovation?
Im pretty early in my career but the rate things are capable of changing soon doesn’t sit too well with me.
Re: GitHub Copilot available for JetBrains and Neovim
#143Earlier quoted context omitted.
Bit of a dodgy way to form query parameters though. Other than for a quick script.
How so?
api_path = base_url + urllib.parse.urlencode({
'action': action,
'format': letThisBeVariable,
...
'gscoord': str(latitude.value) + '|' + str(longitude.value)
})
see: https://docs.python.org/3/library/urllib.parse.html#urllib.p...Mantra: when inserting data into a context (like an url) escape the data for that context.
Re: GitHub Copilot available for JetBrains and Neovim
#144Earlier quoted context omitted.
Bit of a dodgy way to form query parameters though. Other than for a quick script.
How so?
Use something like URLBuilder, or URIParams, or whatever your platform supports. Don't use string concatenation ever, if at all possible, and if not possible (wtf?), then at least escape strings.
Re: GitHub Copilot available for JetBrains and Neovim
#145Earlier quoted context omitted.
Bit of a dodgy way to form query parameters though. Other than for a quick script.
How so?
Re: GitHub Copilot available for JetBrains and Neovim
#146I signed up for the copilot technical preview right after it was announced a few months ago, but I haven't gotten an invite yet while all my friends who signed up later did (I feel a bit left out). Is there any way to get an invite sooner? What am I doing wrong?
I said I use VSCode all the time, which I suspect is the reason I got access. (I never use VSCode.)
Re: GitHub Copilot available for JetBrains and Neovim
#147Earlier quoted context omitted.
Bit of a dodgy way to form query parameters though. Other than for a quick script.
How so?
https://docs.python-requests.org/en/latest/user/quickstart/#...
Re: GitHub Copilot available for JetBrains and Neovim
#148Re: GitHub Copilot available for JetBrains and Neovim
#149Earlier quoted context omitted.
Bit of a dodgy way to form query parameters though. Other than for a quick script.
How so?
One correlated but ancillary benefit, is that there are fewer variables to simulate the state for in your brain, while you're reading the code. You don't have to wonder if a variable is going to change on you, in-between when it is initialized and when it is used.
It's safer still to use a library (e.g. urllib3) that does encoding for you (allowing you to omit magic strings like `"%7C"` from the logic of this function alltogther).
Like GP said, very handy for one-off scripts or areas of your codebase where quality is "less important". I may be pedantic, but I wouldn't give this a pass on code review.
Re: GitHub Copilot available for JetBrains and Neovim
#150Copilot is crazy. The other day, I was writing a Python function that would call a Wikipedia API. I pulled from the internet an example of a GET request, and pasted it as a comment in my code. # sample call: https://en.wikipedia.org/w/api.php?action=query&format=json&list=geosearch&gscoord=37.7891838%7C-122.4033522&gsradius=10000&gslimit=100 Then I defined a variable, base_url = "https://en.wikipedia.org/w/api.php?"…
Bit of a dodgy way to form query parameters though. Other than for a quick script.
So I would build the query like so:
from urllib.parse import urlencode
urlencode({
"action": "query",
"format": "json",
...
"gscoord": f"{str(latitude.value)}|{str(longitude.value)}",
})
I think this is orders of magnitude clearer code. But that's a parameter that's subjective that CoPilot can't adjust for (although it can be better).