zlacker

[parent] [thread] 4 comments
1. thamer+(OP)[view] [source] 2021-10-27 23:00:27
For what it's worth, Copilot can do it.

I typed the following prompt:

    def search_wikipedia(lat, lon):
        """
        use "requests" to do a geosearch on Wikipedia and pretty-print the resulting JSON
        """
And it completed it with:

    r = requests.get('https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=10000&gscoord={0}|{1}&gslimit=20&format=json'.format(lat, lon))
    pprint.pprint(r.json())
replies(3): >>odonne+m >>esjeon+S9 >>grenoi+RS
2. odonne+m[view] [source] 2021-10-27 23:03:07
>>thamer+(OP)
That doesn't exactly do what the guy above you was talking about, though.
3. esjeon+S9[view] [source] 2021-10-28 00:01:54
>>thamer+(OP)
It's like a junior dev who doesn't quit unnecessary code golfing. Somehow the AI is more comfortable with string-based URL manipulation, which is a straight anti-pattern.
replies(1): >>disgru+vk1
4. grenoi+RS[view] [source] 2021-10-28 07:49:27
>>thamer+(OP)
That's what the rest of the thread is complaining about, it's still slapping the strings in there with basic formatting. No different than the top level approach.
◧◩
5. disgru+vk1[view] [source] [discussion] 2021-10-28 12:22:40
>>esjeon+S9
Presumably because that's what it's seen in the training data. Remember, it doesn't care about what the code does, it's just doing a search for similar looking code.
[go to top]