« first day (2917 days earlier)      last day (2014 days later) » 

2:49 AM
cbg
 
 
1 hour later…
wim
3:57 AM
Yet another defaultdict(list) dupe here .. is there canon or no?
 
midnight cabbages
 
@vash_the_stampede I don't know if I'll go this year or not.
 
wim
4:13 AM
@Aran-Fey another one for the collection Re-render string as a raw string [duplicate]
 
cbg
@wim I dont know that default dict output isnt exaclty what op asked for
you can make that with strings as values
 
@wim: Yo.
 
4:30 AM
recbg
@davidism is there a sphinx source for the book or would it be convertable - if then, then rtd I'd say
 
wim
@user2357112 yo
 
wim
5:00 AM
something to say?
 
I was going to talk about the raw string question, but it looks like that's been cleared up.
 
 
4 hours later…
Fantastic that it got answered :/
 
jpp
@roganjosh, Yeh, I make a point if I answer these to make the question at least slightly useful.
But it shouldn't be incumbent on the rest of us [not answering] to do that for the questioner / answerer.
 
Well, the name is not unfamiliar to us both. The least they could do would be to fix the question
 
jpp
There's even a request for OP to accept the answer. Presumably to make sure it can never be deleted.
Thereby making an awful Q&A, or making other people do the work for them (OP / answerer).
 
The last few days on SO have been a bit soul crushing tbh
My main project has stalled waiting on input from some guy at work so I've been even more active than usual on the front line
 
8:57 AM
Cabbage
 
jpp
cbg
@PM2Ring, Thanks for posting that note about images in questions. Sadly, there's already a "tested to work" answer, so let's see if OP cares to respond.
 
I definitely shouldn't have played with this toy sopython.com/wiki/Rep%3AAnswer_ratio . I shall have to try harder :/
 
9:12 AM
@roganjosh I'm close to the bottom of that list, but that's because I foolishly persist in answering questions by low-rep newbies who can't vote.
@jpp I don't expect them to fix the question, they rarely do. But maybe they'll do a better job on their next question.
 
I came out with 20.364286 so it's not dire but it puts me at the bottom
 
jpp
@roganjosh, I don't take those measures too seriously. Some people are towards the bottom because they have specialities
For example, I find @Divakar's solutions are excellent but highly specialized.
 
Divakar is another level
 
jpp
Yep, for pure added value / worth / talent, he should be near the top. But not appreciated because NumPy is relatively specialized versus regular Python / Pandas.
 
If I land on one of his answers, it's a bit of a quandary. On the one hand, I know my problem is solved, on the other I have to work out what the yam it's doing so I can adapt it
 
9:18 AM
I really need to study more Numpy. I can do some stuff with it, and I even have Numpy bronze, but there are still huge gaps in my knowledge.
 
jpp
If I look careful, normally I find he reuses the same kinds of tools, e.g. np.bincount, np.einsum. But I haven't mastered these yet and there's next to no good material to learn.
 
he does have some favourite tools for sure but I'm in the same boat as you, it's tough to make the link to how they fix the problem until he demonstrates it
 
I don't normally see Pandas questions any more (unless they're linked here in a cv-pls request). I added it to my ignored tags a few weeks ago, along with a few tags related to machine learning. The Python tag page is a lot quieter now. :)
 
I have little-to-no hope gaining ground on the pandas tag.
 
Hi Want to run some command with subprocess with live update, I tried few solutions available on StackOverflow but did not work out for me
here is my approach:
http://pasted.co/75d318e9
 
9:24 AM
What doesn't work with your current approach?
 
can any one help me how to run the command with subprocess with live progress
I am not getting live update of command
as we see while running the command on terminal it self
 
What is "the command"?
 
any command
like ping or wget to download something
 
I think for stdout_line in pObj.stdout should work
Oh, but you have to remove the pObj.communicate(...). Do pObj.stdin.write(kwargs['input']); pObj.stdin.close() instead
 
ok let me try
@Aran-Fey I am getting below error with your suggestion

<class 'TypeError'>, a bytes-like object is required, not 'str'
on pObj.stdin.write(kwargs['input'])
 
9:46 AM
Huh. If the input is a string, your code should throw a similar error...
The input has to be bytes
 
9:57 AM
changing pObj.communicate(kwargs['input']) line with your pObj.stdin.write(kwargs['input']); pObj.stdin.close()
make the functionality of function incorrect and it is not be able to execute commands properly
 
10:09 AM
@PM2Ring there's also the case where the choice of most upvoted and accepted answer is just wonky. It's just been accepted and I don't get how it's the best of the 3 approaches - "trash all your vectorization potential"
 
jpp
@roganjosh, At least that answer has a disclaimer: This also necessarily means that under the hood you'll have a numpy array of pointers, so don't expect the performance you get when using a primitive datatype.
And if there are any serious developers / performance concern, I'd assume you wouldn't be working with strings anyway.
 
Mmm, fair point. It still doesn't strike me as the best approach of the bunch
 
jpp
Yeh I personally UV'd Williem's
 
More like a blanket except that just handles everything
 
@roganjosh Yeah. There's not much point using a Numpy array instead of a list if you're going to stuff it full of Python objects. But many people seem to think that Numpy will magically make the code faster, even if you do dumb stuff that prevents Numpy from using native machine types.
 
10:16 AM
Sometimes that extends to simply import numpy and leaving it at that :P I've seen that more than once
 
cbg
 
jpp
@PM2Ring, The worst thing that has happened to me (more than once) is when someone asks how you can vectorise a function with NumPy. You do it, it works and improves performance. And then "but my actual function is different, is there a general, universal way to vectorise my function"
And then come across the poorly named np.vectorize [aka np.loopy], think it's magic, and then wonder why it isn't.
 
tbf, I think vectorize was a horrible name for that functionality
 
@jpp When you try to make something foolproof, never underestimate the ingenuity of fools. :)
 
10:21 AM
I don't know what they should have used instead, but it's bound to cause confusion when everyone else talks about "vectorizing" the approach
 
jpp
The docs even mention map with tuple, I wouldn't even mind np.map.
the only "smart" thing it does, really, is enable broadcasting with arrays of different shapes.
and perhaps some caching to try and improve performance
 
vectorize does make you think it magically promotes a plain Python function to Numpy speed. Instead, it slows Numpy down to plain Python speed.
 
I can live with that wart though considering how good the rest of numpy is
pandas, though. You have no idea what on Earth it's actually doing
What should be the fate of this question? stackoverflow.com/questions/52757802/… do we just close or flag for migration or something?
 
jpp
10:40 AM
@roganjosh, I just VTC with a custom reason.
 
Followed suit
 
@roganjosh Let the OP migrate it manually, since it will need work to make it acceptable on Code Review.
 
I've just gone with jpp's custom close
 
Ditto.
 
Author deleted
 
11:26 AM
I'm trying to learn OOP design patterns. Since I work on my own and tutorials only basically spell them out, I was thinking of rewriting a library from the ground up so I could compare my thought process to what was actually implemented. Does this seem like a good idea? I'm trying to think of a small library - requests is hailed as a great example of being pythonic but it requires domain knowledge (I don't actually know how the whole HTTP get/post thing works underneath). Any suggestions?
Totally aware that libraries only exist to meet needs of a particular domain, but it's more just for open suggestions so I can assess the scale of the task and see whether I might be able to reason out an approach independently from the library
 
Take a particular library you know best (or better than any other)
doesn't have to be too big. Also, if you reject / discard that, rinse repeat without this particular library (sorted list of libraries you know best)
 
Probably the only reasonable answer the my question, I was hoping on an off-chance that something sprung to someone's mind :)
 
I don't usually look at libraries' source code (except when it's garbage and needs to be monkeypatched), so it's hard to recommend one that's well-designed
 
I have 40K lines of code now in my Flask app and just become painfully aware that it's solely down to blueprints that's keeping the design afloat. A lot has come from project bloat where the requirements weren't even discussed at the start, but hindsight on other aspects of the design is painful
stackoverflow.com/questions/52757097/… unclear. There's been various iterations of guessing what the OP wants, some deleted, and no feedback from OP
 
12:00 PM
stackoverflow.com/questions/52759225/… typo and it fixed the OP's issue
How... how did someone decide to upvote that typo?
 
12:19 PM
afternoon cbg
 
cbg
 
jpp
12:44 PM
@roganjosh, remember that question with image as code. Looks like OP's solution is to delete his account.
Which likely means he/she will do the same thing again next time. nothing learnt :(
 
Maybe they learned that we're not doormats and they won't be returning
 
jpp
@Kevin, Actually we are doormats. They got their answer. The question was never fixed. OP happy. Answerer happy for a few minutes while he had his +15. Everyone else, time wasted.
 
I see. I guess I'll just have to be meaner to the next couple of newbies in order to compensate.
 
jpp
I got review banned until 2020 for failing to spot plagiarism. I'm pretty sure I've passed the last 5-10 audits. But once you've had a ban, that counts for nothing with the "fail & double the sentence" rule.
Maybe it's a blessing in disguise. My previous 2 audit failures were also incorrect, had to get them overturned / undelete posts.
 
@Kevin I updated my Bezier track program. You can now slide the white points around.
@jpp Grrr. I guess it's hard to stop that, although I think the mods have IP tracking tools that can help them with detecting sock puppets, but I guess it's not perfect, when many IPs these are dynamic.
 
1:04 PM
I got a candidate's resume. he is PCAP. TBH, I hadn't heard of that till I saw that.
PCAP - Certified Associate in Python Programming
In case, nobody else has heard about it, either.
 
Nice. If I replace return min(max(0.001, w), 0.999) with return w, then the points are draggable anywhere along the line, not just the line segment. Earlier this month I predicted that this would create aesthetically pleasing loops, but now that I actually try it, all I get are sharp kinks.
So much for that. Your visualizer has saved me the effort of going down that blind alley. I award you 42 quatloos and a commemorative plaque.
The plaque is blank, feel free to engrave whatever you like on it
 
@Kevin I shall treasure it always.
If you clamp w to min(max(0, w), 1) and put a white dot on a black control dot you get a zero division error in the flatness test used in bezier_points.
 
I was wondering why you were using 0.001 and 0.999. That explains it.
 
any chance that extending the white dot beyond the polygons produces loopy smooth curves?
 
As in, moving the dot so it's not collinear with the line segment any more? I would expect the curve to have an abrupt corner at the white dot, in that case
 
1:13 PM
no, I mean so that it's located on the line defining the polygon but not on the polygon's edges
or perhaps I'm confused about the role of white and black dots
 
That's more or less what I tried eight messages up.
 
oops, I missed that, sorry
carry on quatlooing
 
Now, if you want to say "well maybe you can make loops that way and you just didn't try out enough test cases", that's a reasonable position. I only made like three shapes and then gave up.
 
but didn't you plan to separate the white dots into two dots along each side?
 
I could just use a simple loop with bezier to plot the curves, but bezier_points is a bit faster because it's adaptive and does less arithmetic. You can push the initial tol up to 0.05, but the curves start looking polygonal if you make it too big.
 
1:15 PM
I understood that your original design had a restriction that control points coincided at the midpoints of edges, but this needn't be the case in general
did I misunderstand?
 
@AndrasDeak I think I did, but on second thought that's no good, since then the curve wouldn't be continuous
If a line segment has two white points, then there would be an empty gap between them
 
I see
so...separating the black dots into two each? :D
 
@AndrasDeak In my program, a track is composed of overlapping cubic Bezier curves. A single curve has a white dot at each end and two black control dots between them.
 
The number of black points between white points corresponds to the dimension of the bezier curve. My program has one black point between white points, so it makes quadratic curves. PM's has two points, so it makes cubic curves. You could theoretically extend this however far you want.
Whether higher-dimension curves are cooler looking, is an open question.
 
I see. Are they actually called "higher-dimension"? I'd expect "higher-order" to be more to the point
 
1:22 PM
They're probably not actually called higher-dimension.
 
\o cbg
 
Wikipedia uses "degree".
 
yeah, that makes sense, thanks
degree as in polynomial
 
The article also mentions higher dimensions, but they actually mean a generalization of the concept into more spatial dimensions in that case. i.e. Bezier surfaces
 
that's what I'd have expected, which is why I asked
 
1:25 PM
Of course, you can easily do higher-dimension Bezier curves if you want, since the parametric equations for x & y are identical.
 
Hooray for vector math that generalizes to vectors of any size
 
every math generalizes to higher dimensions, we're just often too stupid to see how
^[citation needed]
 
I made the grass blades in this ray-traced sundial image using quadratic splines:
 
Bézier said than done
 
I originally developed that scene on the Amiga. I had to use tricks to "recycle" the random grass blades, since everything had to fit into 8MB of RAM.
 
1:41 PM
Interesting. Wikipedia says it's tricky to calculate the intersection of a ray and a bezier surface.
> One problem with Bézier patches is that calculating their intersections with lines is difficult, making them awkward for pure ray tracing or other direct geometric techniques which do not use subdivision or successive approximation techniques. They are also difficult to combine directly with perspective projection algorithms.
 
@Kevin I don't know how POV-Ray does it. I guess it could subdivide the surface into linear patches. POV-Ray originally only used with quadric surfaces (3D versions of conics). The various kinds of meshes were a later addition, and render a fair bit slower.
 
Maybe the POV-Ray devs are just really smart and so things that would be considered difficult by Wikipedia editors are like a morning Sudoku to them
 
If anyone's interested, I finished version 1.0 of my duplicate manager userscript. Some features still need a bit of polishing, but it's completely functional. Bug reports, feature requests, and any other kind of feedback are appreciated.
8
 
On the main site, I've just corrected a user for using the term "a json" when they mean "an object composed of nested dicts, lists, strings, and numbers", for what feels like the millionth time. I'm beginning to feel like this is not the hill I want to die on.
Maybe everyone understands already that there's no json type, but it's a pain in the butt to say "an object composed of nested dicts, lists, strings, and numbers", so they don't say it.
 
@Aran-Fey neat!
 
1:52 PM
I know! :D Thanks!
 
But I think there's a sizeable population that doesn't understand it, because they're looking at their object as a mysterious opaque thing that requires magic incantations to open
 
After a bit of experience that might be of interest to SOCVR
 
A user asking "How do I get a value out of my three dimensional json object?" might look at the json module docs and give up after not finding anything. A user asking "How do I get a value out of my list of lists of lists?" might discover that it's as easy as x[0][0][0] before they even compose a post on SO
 
2:09 PM
If I'm subclassing dict, is there anyway to hijack the {} literal? Or create a new literal that gets parsed into my subclass?
 
Not without black magic
 
The conclusion we came to last time was "probably not"
 
So what I'm hearing is that there's a chance... but probably not worth the effort
 
All things are possible if you edit CPython and build from source
You could call it pi-thon.
 
^ yes... yes I could
That makes sense in a round-about way
 
2:15 PM
@Kevin Pet peeve: People saying “JSON object” when they actually meant to say “some data that happens to be deserialized from or serializable into JSON”.
 
IIRC, literals are evaluated at compile time, so a dict object has been built from the dict literal before your subclass has a chance to do anything to it.
 
@poke fwiw I always say it that way
 
:<
 
(-:
 
morning cbg
 
2:16 PM
cbg
 
@PM2Ring i know this is super broad, i been working on all my standard lib however its called all the python doc page, what should be next priority for me ? numpy? I know i gotta learn jsons
 
I have some difficulties understanding the question and a really hard time understanding the answer here. They truly must be psychic.
 
I find json more day-to-day useful than numpy, but I'm a luddite so I don't use third party libraries all that much
 
btw, I can't remember the depth to which we took the infinite depth defaultdict(dict) but I'm getting good use out of:
class Fict(dict):
    def __getitem__(self, item):
        return super().setdefault(item, type(self)())
 
@Kevin Same. Except that I’m not a luddite, I just don’t use many libraries *shrug*
 
2:22 PM
If your problems are more web, you use json more. If your problems are numerical, you use numpy more.
 
Luddites, minimalists, and ordinary people that don't apply an ideological label to themselves and who have a tendency to only use the tools that are necessary for the task and nothing further, unite!
 
@jpp I can't see deleted questions, but it was the Pandas one that was answered by someone who should have edited the question into shape?
 
@vash_the_stampede JSON is a very popular way to store data, and we get lots of JSON questions on SO. The json module docs aren't that big, so it's pretty easy to learn. Some of the material in those docs is a bit obscure, so feel free to skip over stuff that doesn't make sense. ;)
 
@vash_the_stampede you already pretty much know JSON without knowing that you know it :P
 
What shall we call people that "don't apply an ideological label to themselves and who have a tendency to only use the tools that are necessary for the task and nothing further"
Let's ask them?
 
2:27 PM
Mentally debating whether the entirety of JSON can be condensed into a single chat comment.
 
@roganjosh Oh i have noticed and i been able to mimic some json processes as far as load dump and utilitzing it like a dictionary, where do csv's fall into play with json or along those lines
lol rogan that small ?
 
Pretty much
 
json.org takes about a page and a half to entirely describe the format. Doesn't quite fit in a single chat message, unless you cheat and embed a screenshot.
But even then, the oneboxer will smallify it to an unreadable degree
 
cbg
what's the good word
 
Wikipedia briefly lists the 6 basic data types that JSON uses. A JSON Object is like a Python dictionary, except that it only permits strings as keys, and it does not prohibit duplicated keys.
 
2:30 PM
JSON has double quotes, not single quotes. If it has single quotes, it's been parsed into a python structure. This consists of nested lists and dictionaries. Keys must be strings,so they'll be converted as such if you change to JSON. load and dump are for dealing with files, loads and dumps are for dealing with strings, the 's' indicating such.
 
^^ it took me a really long time to realize that the "s" helped in reminding me which one was for the string
 
I've missed something, surely
 
Maybe you could fit the box on the right hand side in a multiline message if you replaced some of the newlines with pipes... Let's see
 
that motivated me now to learn it
 
"learn it"? That concluded the lesson :P
 
2:33 PM
json := element
value := object | array | string | number | "true" | "false" | "null"
object := '{' ws '}' | '{' members '}'
members := member | member ',' members
member := ws string ws ':' element
array := '[' ws ']' | '[' elements ']'
elements := element | element ',' elements
element := ws value ws
string := '"' characters '"'
characters := "" | character characters
character := '0020' . '10ffff' - '"' - '\' | '\' escape |
escape := '"' | '\' | '/' | 'b' | 'n' | 'r' | 't' | 'u' hex hex hex hex
 
haha my chat wasnt updated whhen i sent that , that wa sa response to 'pretty much'
after your snippet im a certified json manager
 
A big one to watch out for now is JSON Lines
A few years ago I didn't see the point of it, but now it's really prevalent and powerful
If someone asks a JSON question and it's throwing an error on the second line at position 0, it's a good bet that it's JSON Lines
 
that and im interested in PHP SQL etc some of that stuff seems cool
 
Friends don't let friends use PHP. I must admit that I tried PHP when I was younger, but I didn't inhale.
 
I found PHP interesting solely in the context of the body of weight against it
@vash_the_stampede you should, almost certainly, play with SQLite3 for some grounding in it. Don't follow the tags though, they're depressing
 
jpp
2:39 PM
@roganjosh, Yep, that was the one. They just deleted their account !
 
@roganjosh got it last question when someone uses arr = array([[5,3,4,5,6,4,2,4,5,8],
             [4,5,8,5,2,3,6,4,1,7],
             [8,3,5,8,5,2,5,9,9,4]]) is that numpy or does python have arrays like that
formatting op
;)
 
Python has an array module and type, but it's rarely used compared to numpy's array type.
 
Python does have arrays, but I'm yet to see them being used
 
Poke assures us that PHP isn't quite as bad as it used to be. But still, it's hard to clean up a language that just grew organically from humble beginnings, without a clear overall design structure.
 
Yeah, in Python array != list => stackoverflow.com/questions/176011/…
 
2:42 PM
@roganjosh I've used array.array a few times, and I quite like bytearray.
 
Based on your interest level, it wouldn't hurt to understand the underlying architecture of what makes python data structures
 
@idjaw I had no idea they were around that long
@PM2Ring to sidestep a dependency on numpy?
 
@roganjosh Yes, I used array.array to avoid needing Numpy.
 
I'm not surprised that arrays are old as heck. They're conceptually simpler than lists, so it doesn't take too much work to make a module for them.
 
Jul 27 at 12:09, by PM 2Ring
I recently upgraded some of my prime number generating programs to use bytearray for boolean arrays. They use much less space than lists, and are faster as well. That's why they're my new best friend.
 
2:46 PM
@idjaw ty and all ty
 
np
 
I'd be interested to see when exactly arrays were introduced to the language. ctrl-f for "array" on docs.python.org/3/whatsnew/index.html reveals zero results, so... Before 2.0?
 
My old Python 2.5 docs have notes on some of the array module functions saying "Deprecated since release 1.5.1"
 
@vash_the_stampede that repr belongs to a numpy array
 
raw.githubusercontent.com/python/cpython/master/Misc/HISTORY includes the changelog for Release 0.9.9 (29 Jul 1993), which mentions a New optional module 'array'
 
2:58 PM
Here's a silly circle drawing program I put together a couple of hours ago. It's based on the old formula for generating Pythagorean triads: a=u²-v², b=2uv, c=u²+v². Also note that for complex z=u+iv, z² =a+ib, so if (u,v) is a point on the unit circle with angle θ from the +ve X axis, then (a,b) is also on the unit circle with angle 2θ.
import tkinter as tk
def circle_gen(ox, oy, radius):
    u, v = 1, 2
    while True:
        u2, v2 = u * u, v * v
        r = u2 + v2
        u, v = (u2 - v2) / r, 2 * u * v / r
        yield int(ox + radius * u), int(oy + radius * v)
def draw(gen):
    photo.put('#000', next(gen))
    root.after(1, draw, gen)
width, height, radius = 320, 256, 100
root = tk.Tk()
photo = tk.PhotoImage(width=width, height=height)
tk.Label(root, image=photo).pack()
draw(circle_gen(width / 2, height / 2, radius))
root.mainloop()
 
recbg
 
cbg
 
@Aran-Fey I was right ;)
 
4 stars! :O
 
it's also been linked to the matlab room
 
3:03 PM
cbg
 
all the user-moderators welcome this, I'm sure of it
 
I have made a language using python blackthunder01001.github.io/Numbairy
 
Nice work :-)
 
Thanks
 
The next step is to make it Turing complete, which typically entails some kind of looping structure
 
3:08 PM
this has been asked twice today?
nm, jpp has duped it
 
@BlackThunder As for concrete feedback, "seperated" and "seperation" should be "separated" and "separation". And it's conventional to upload the source code of your project to Github, not just the executable :-)
 
Ok. I will.
I will clean the code to make it easy to understand and upload it.
 
especially since 1. executables are system-dependent, and 2. version control sort of breaks on binary files
 
I wonder if there are any popular languages that aren't open source. It's not inconceivable.
 
MATLAB
isn't java proprietary?
 
3:16 PM
The many variations upon SQL, perhaps
 
@PM2Ring what level of mathematics have you studied in your learning career, you also seem to be talking about some different formulas
 
@AndrasDeak Maybe? At the very least I'd expect Oracle to hide that sort of information ten links deep on their site
 
@AndrasDeak Yes, by Oracle but there is an Open JDK
they bought it from Sun
 
I see, thanks :)
 
@vash_the_stampede I have no formal education after high school, but I was always good at mathematics at school. I've taught myself a few things since then, though.
 
3:20 PM
"Here, run this opaque executable which produces opaque executables that you should also run" would be suspicious if it wasn't coming from a billion dollar company. Actually it's still kind of suspicious.
 
the closed-sourceness of MATLAB came up the other day, when we tried to guess how the parser does its thing
it felt really unnatural that one can't just look up the implementation :/
 
@PM2Ring are there any certain math genres you seen be more usefull than others when it comes to coding
 
python has spoiled me
 
Ignorance is bliss. Looking up things in the CPython source is like hiking uphill in the snow, both ways.
 
but sooner or later the hill will end and you're face to face with the yeti
 
3:23 PM
Dismembered by the yeti of Understanding, when you could have stayed home under the cozy blanket of Stupidity
 
@vash_the_stampede It depends on what you want to do. Eg, if you want to do low level graphics stuff you need to know basic geometry, and it helps to know some trigonometry. And matrices. But apart from that, you don't need a lot of maths to be a good coder. Unless you're specifically coding mathematical stuff, or solving coding challenges based on maths puzzles.
 
some basic linear algebra might appear with 3d graphics
 
@PM2Ring What? I'm curious how you started out :)
 
@roganjosh I had the opportunity to learn some programming during my high school years in the early 1970s, and I've been an amateur coder ever since. :)
 
Today it's easier to access resources online and teach yourself coding, but I thought you were degree-trained in Physics if I'm honest
 
3:31 PM
he's been 2ring the domain of programming on his own
 
Thanks. :) Learning resources for programming weren't easy to come by in my early days.
 
stackoverflow.com/a/52727874/10255652 no lie I know its no major task, but I was proud of this solution, flame on haha just have no one else to share with taht can relate
 
@vash_the_stampede I'll have a close look in a few minutes, but there's no need to parse that data by hand. You can use the csv module.
 
duplicate hunt update: gunr posted a SEDE query that collects popular dupe targets in a tag
 
@PM2Ring if you know how to use csv
:)
lst = [('a', 1), ('b', 2), ('a', 3), ('b', 1)]
{'a': 4, 'b': 3}
question i konw how to solve this
with defaultdict, grouby etc
is there anyway you can manipulate counter to solve this directly without manipulating the list
like can counter can update a =1 with a=3 and get a=4 is there a way to associat i[0] = i[1] and use counter ?
 
3:39 PM
or maybe not
 
damn you just gave me blue balls
 
then again there's usually only one or two straightforward way to do something in python
 
but that was generally what i was saying what you posted some type of concept like that
 
Well there's {k:sum(t[1] for t in v) for k,v in itertools.groupby(sorted(lst), key=operator.itemgetter(0))} but it's hardly straightforward
 
I'd probably use a defaultdict
 
3:42 PM
And also it's needlessly O(n log n)
We've come to this conclusion before: that Counter is good at exactly one thing, and trying to make it do anything more than that is typically more of a headache than it's worth
 
yup
 
I know those two methods
 
so use them
 
i actually used the method kevin posted
 
@vash_the_stampede It's a pretty simple module, and well worth learning. Mind you, it's also good to know how to parse stuff manually. But the CSV module is good at handling the unpleasant corner cases. And even when you do read the data with the CSV module you often have to do additional processing to get the data into the structures you want.
 
3:44 PM
"I already know how to drive a nail with a hammer and with a nail gun. Now I want to learn how to drive a nail with a rubber duck"
 
i was just curious since counter can update if it has a=1 then a=3 i was wondering if we could associate them in the list and use counter directly on them , just exploring possibilities curious
@AndrasDeak hah but it could end up being a better solution, you never know til you try
@PM2Ring learning queue = json , csv
 
This reminds me of a time when we went to the forest with some friends in elementary school, and when we were doing some DIY and we couldn't drive the screws with a screwdriver anymore, we resorted to using a hammer. Nice sparks. And we all have both eyes each.
 
...DIY in the forest?
 
Here's a simple example that's kind of related to that question you answered:
from csv import DictReader
data='''a b c
1 2 3
4 "5 6" 7
7 8 9
'''.splitlines()
for row in DictReader(data, delimiter=' '):
    print(row)
# output
OrderedDict([('a', '1'), ('b', '2'), ('c', '3')])
OrderedDict([('a', '4'), ('b', '5 6'), ('c', '7')])
OrderedDict([('a', '7'), ('b', '8'), ('c', '9')])
 
@Withnail well, there was a large clearing with a...kind find the name. The elevated construction made of wood from which hunters and less-lethal people can stalk wildlife. So we climbed up and decided to add some features :D
 
3:50 PM
a hide, I guess?
 
A hunting blind (US), hide or machan is a cover device for hunters or gamekeepers, designed to reduce the chance of detection. There are different types of blinds for different situations, such as deer blinds and duck blinds. Some are exceedingly simple, while others are complex. The legality of various kinds of blinds may vary according to season, state and location. == Types of blinds == Blinds may be stable or mobile. An early blind used by hunters was a cocking-cloth, a piece of canvas stretched on a frame like a kite that would permit hunters to approach pheasants and to shoot them through...
 
@PM2Ring ty will review
 
"elevated hunting platform" would probably be well-understood though
 
we have a specific word for it, something along the lines of "high peek"
 
jpp
3:58 PM
@vash_the_stampede, Regarding your answer here, I appreciate your energy in explaining your code line by line. But I think much more valuable is explaining the general / idea or concepts. If it's helpful (and I should do this more often), you can use bullet-points for 2-3 main ideas.
 

« first day (2917 days earlier)      last day (2014 days later) »