« first day (3133 days earlier)      last day (1824 days later) » 

12:00 PM
yes sir, you have done that @AndrasDeak in the past!
 
just don't come complaining when you face any consequences
 
@DeveshKumarSingh You're not the first person to question my name, btw. It's a pretty poor representation of me considering I don't like spicy food :) But, I'm really reluctant to change it because I should be identifiable throughout my time on SO.
 
I apologize if you took offence on that question @roganjosh
 
I didn't take offence at all, I tried to turn it round to make my point. People remember names
 
aah okay I think I got both of your points, I should cut down/stop on answering blatant dupes and low quality questions just to gain reps is the mantra here.
But yes, now I also got my answer to my earlier question as welll
thanks guys @roganjosh and @AndrasDeak :)
 
12:06 PM
don't mention it
 
How long can you edit text for in chat?
 
2 minutes
 
Okay cheers
george@hungrybugger.co.uk
 
Hello
 
12:09 PM
cabbage
 
I have an list with objects like this:
 
Hello
 
requestPositions.append({
                constant.ID_KEY: idInRowI,
                constant.POSITIONNUMBER_KEY: positionNumberInRowI,
                constant.ARTICLENR_KEY: articleNrInRowI,
                constant.SUPPLIER_KEY: "",
                constant.WANTEDQUANTITY_KEY: wantedQuantityInRowI,
                constant.ORDERQUANTITY_KEY: orderQuantityInRowI,
                constant.DELIVERYWEEK_KEY: 0,
                constant.DELIVERYQUANTITY_KEY: 0,
                constant.ISDELIVERED_KEY: False,
Then I want to filter for example that constant.ID_KEY === 1
How can I do it?
        list(filter(lambda x: x, requestPosition))
I mean, just to access the properties of the object
 
It's not an array, it's a list, and it just contains dictionaries
 
user3064538
in python we name variables lower_case_with_underscores not camelCase
 
12:11 PM
oh thanks, did not know it
 
user3064538
and do it with a comprehension
 
@QuicoLlinaresLlorens See the answers here
 
@Boris you can't create a list of dicts with a dict comprehension
 
user3064538
yea
 
user3064538
the other kind of dict comprehension
 
12:12 PM
The one that isn't a dict comprehension? :P What do you mean?
 
user3064538
yea, exactly
 
user3064538
lol
 
user3064538
@roganjosh can't wait to get 2000 karma, I will excorsise all camelCase from SO python
 
eh, I hope you're joking
 
user3064538
12:14 PM
why
 
@Boris I call it "respects" to my non-programmer friends. Good luck with that, though :P
 
Because just because you don't go through a review queue when editing doesn't mean you can edit anything. Trivial style edits like that have a risk of introducing bugs and conflicting with author's intent. Just because you think snake case is better isn't enough to do that. Same way that you can't edit out anti-patterns from answers. If you don't like it, downvote it.
 
also I think people coming from languages like Java where they use camelCase slowly transition to snake_case, so if they are using camelCase ,you can always comment below linking to PEP-8 :)
 
is possible to pass to a map function an argument which is not iterated?
I mean, all the arguments you put after the function are going to be iterated. Is there any way to pass all the argument, and no iterating it?
 
the second argument needs to be iterable
that's what you mean, right?
 
12:24 PM
I think they want a curried function
a minreprex would help a lot
 
haha, min-reprex, you forgot the hyphen :)
 
I have a list, named listToMap. And I want to map it
And then in the function that I give to map, I would like to have another argument, but not map it
 
@AndrasDeak never heard about this before
@QuicoLlinaresLlorens yeah, we are going to need an MCVE
unless someone here can divine what exactly that means
 
[minreprex] please. Oh poop, that doesn't work either.
 
could you provide an example, when you say you want to map it, what does it mean?
 
12:27 PM
@Arne my guess: map(two_arg_function(., fixed_arg), iterable)
i.e. currying i.e. functools.partial or a dedicated function
 
@AndrasDeak That's also my guess
 
Yes @AndrasDeak that is
 
looks in horror at the mini-reprex usage in r6 I refuse. I'm going to die with my honour. MCVE or death! waves small, hastily scribbled napkin-flag
 
I want a fix argument
 
map(lambda x: two_arg_func(x, 'fixed value'), iterable)
 
12:29 PM
if the fixed argument is first then you can use functools.partial, otherwise you have to wrap your function
ha
also if it's a keyword argument you can still use partial
 
@OldTinfoil yeah, I have no clue why MCVE of all things needed an overhaul
maybe they did a sentiment analysis of the phrase MCVE and it turned out to be in the deep dark red corners, so reassigning its name is like a band aid
 
hehe, yeah
pantalloons as a bonnet alienism
wiki is down?
That's a first for me!
 
same
 
Not loading from UK
 
12:35 PM
so this is how it ends
 
Likewise, second from the UK
This is what you guys get for abandoning MCVE
 
oh, loaded, phew nevermind
 
sudo service apache restart
 
isitdownrightnow.com/wikipedia.org.html:
Down For: ~2 minutes

Wikipedia.org is DOWN for everyone.
It is not just you. The server is not responding...
 
Still not loading from UK. Thanks, Brexit
 
12:37 PM
Too right! We don't want any of this foreign knowledge muck in our country.
 
@Arne yeah, actually I had already seen that by the time the Europe Leavers responded
 
cbg
Wikipedia is up for me?
 
what a sad day
on top of everything i got my "inquisitive" badge for a php question
truly, the end times have come =(
 
map(lambda x: filterAndInsertPosition(x, requestPositions), collectionsToAppend)

def filterAndInsertPosition(collection, requestPositions):
        print("HELLO")
        print(f"{collection[{constant.ID_KEY}]}")
        print(*list(filter(lambda x: x[f"{constant.ID_KEY}"] == collection[f"{constant.ID_KEY}"], requestPositions)), sep = "\n")
So this is not printing Hello
 
then collectionsToAppend is probably empty
the function definition should be above your map call of course
 
12:43 PM
no, it has 155
 
It would print on a function call, regardless
 
or raise an error
Do you have it inside a try-except: pass block?
 
user3064538
don't use map, use a list comprehension
 
or just a loop, looking at that function
 
@QuicoLlinaresLlorens you need to consume the map object
 
12:46 PM
Strip it back. I have a hard time understanding what that code does; why are we seeing the end result - does the error occur in simpler implementations?
 
maps in python3 are lazy
as others have said, you probably should just write a loop
 
user3064538
to convert an int to a string use str(your_int) instead of an f-string
 
what does that mean exactly, lazy ?
 
@Arne ah, right
 
in terms of map, never could get my head around it
 
12:49 PM
@DeveshKumarSingh lazy-evaluation
 
it's like a generator
 
user3064538
Guido almost removed it because they're exactly the same as list comprehensions and those are more readable/more pythonic
 
and is that laziness hidden from the user, or is it apparent! Oh it means that only calculate the next value when needed, unlike iterators who calculate things beforehand
 
Twice in 1 day I've fallen foul of chat deciding that a reply URL should explode into a big box :(
 
@DeveshKumarSingh "unlike iterators who calculate things beforehand"?
 
user3064538
12:52 PM
@QuicoLlinaresLlorens here's what your code should be
 
user3064538
for collection in collections_to_append:
    print("hello")
    print(collection[{constant.ID_KEY}])
    for x in request_positions:
        if x[str(constant.ID_KEY)] == collection[str(constant.ID_KEY)]:
            print(x)
 
recbg
 
maybe I misspoke, what could be an example of an eager evaluation in Python!
 
user3064538
alternatively, wrap your map() in a list() like so
 
user3064538
list(map(lambda x: filterAndInsertPosition(x, requestPositions), collectionsToAppend))
 
12:53 PM
@DeveshKumarSingh range(10) in Python 2
 
@DeveshKumarSingh python 2's map
 
okay, that's what the wiki page too describes as an example in python, lead me look that up
 
18
Q: Do Python for loops work by reference?

JamesWhen using a for loop in Python to iterate over items in a list, will changing item (below) change the corresponding item in items? for item in items: item += 1 Will each item in items be incremented or remain the same as before the loop? [Note: I would be interested in Python 2.7 and 3.x]

Is this correct? I just tried to edit a for in item and it edits also the list
 
user3064538
@QuicoLlinaresLlorens if you edit a list, those are references and will change
 
user3064538
that question is just about values
 
12:55 PM
for idx, collection in enumerate(collectionsToAppend):
                # filterAndInsertPosition(collection, requestPositions)
                if (len(collectionsToAppend) - 1 == idx):
                        collection.popitem()
When I do this, the list should be changed then?
 
@QuicoLlinaresLlorens Please read this to understand how mutation and references work in python.
 
@DeveshKumarSingh curious, could you link the page please?
 
@QuicoLlinaresLlorens Please give a min-reprex
 
their confusion is that mutating the value will...mutate the value
 
user3064538
@QuicoLlinaresLlorens yes
 
12:57 PM
wait, that's a real url ?
did reprex get approved? what's going on
 
It's an announcement by Shog, about introducing it. Hence the uproar.
 
No, I searched it and used it for comdic (and in this case, practical) effect. You've destroyed the comedic side by making me explain :P
 
user3064538
I'm sure the people that don't mind outnumber the uproar 10 to 1, but if you don't care, you don't care enough to upvote
 
wait, but why did stackoverflow.com/help/reprex work? did it always use to exist*?
 
@ParitoshSingh did you read what I just said?
Announcement. Dated today.
 
1:00 PM
i did. announcement, post implementation announcement?
to me, announcement doesn't imply its already implemented
 
^ fair point
 
OK, I guess I wasn't clear enough. Just reading any of that meta post would have made that clear. And "hence uproar" would make little sense if there was a way to not introduce it.
 
That wasn't the point he was making, though?
 
Hmm?
 
i just thought the whole thing was a proposal when i read it couple hours earlier or whatnot when it was linked. and i was so sure it wouldn't be implemented after all that.
 
He asked if it got approved, I tried answering that it was never something to be approved, it was only announced as a fact.
 
i am a bit shocked it was implemented first and announced later. The uproar makes that much more sense, but i was in favour of the uproar even before to be honest :P
 
it's a reality, and they announced it! Why will they ask what SO users think!
 
eh, there's no way this lasts.
 
*looks at new contributor indicator and new site design*
 
1:04 PM
feels a chill down their spine ... uh... no way.. right?
 
@AndrasDeak coinciding with the fact that it's now a valid route. I think that was the point; even if you're going to do something irregardless of what anyone thinks it doesn't normally coincide with the feature going live
 
irregardless :P
 
yeah, but no all good. i can see how Andras read into it, and i know how i read into it. it happens. ^^
 
ugh, I edited once, do you want more pings, Andras? :P
 
came at it with different expectations.
 
1:05 PM
irregardless ? what is that? it's the same as regardless ?
 
yeah, I know, I just didn't succeed in conveying the past participle nature
 
with an extra ir!
 
@DeveshKumarSingh it's a common mistake, a combination of "regardless of thing" and "irrespective of thing"
 
so a double negative does not make a positive here, ir and less
 
@roganjosh my pings are muted
 
1:07 PM
Wait, am I being pulled on a typo or on language?
 
huh?
 
I actually never heard of that word before, so I was trying to guess it's meaning @roganjosh
 
> Although well attested, this word is widely regarded as nonstandard and incorrect. Its use is discouraged by many speakers, who consider it inappropriate in virtually any formal setting.[1][4]
 
Found that irregardless is used a lot in Northern England FWIW.
 
20 more years and we'll have another "inflammable" on our hands!
 
1:09 PM
<researching my own language>
 
i'd argue it's probably been accepted colloquially though, to the point that often people dont bat an eyelid over it here.
small sample size i suppose, but still
 
Yeah, there expectations have lowered. Its no longer deemed incorrect by many.
 
*their
 
looks at the trap. the trap has been well set
and the trap is sprung :P
 
@roganjosh one more :P
 
1:10 PM
hahaha, caught it!
 
<feels better for the drive-by grammar correction>
 
you missed the other one :D
 
Apr 25 '15 at 12:17, by Ffisegydd
@Games he is extremely clever. He plays the part of a buffoon sometimes. He's kind of a fan favourite, irregardless of his politics.
Apr 25 '15 at 12:17, by Antti Haapala
irregardless? :D
 
i was wondering who'd bite, and how long it would take before it was too much to bear.
 
Apr 25 '15 at 12:18, by Antti Haapala
not without lack of undue regard
 
1:12 PM
so, with due regard? :P
 
Just stop :P
 
@ParitoshSingh irregardless = regardful, it checks out
 
we don't need no double negatives.
 
Pink floyd eh?
 
uh oh, now you've gone and done it.
 
1:14 PM
--1 is -1, but just doubly so
 
In [3]: --1
Out[3]: 1
python disagrees
 
I'm not gonna lie, I feel a bit ashamed for using the word. I don;t know where I picked it up from
It doesn't make sense :/
 
@DeveshKumarSingh sticks parsley into ear canal... lalalalalalalala
 
Don't feel bad. Language is what the speakers make of it, and you have the right to claim that you're British so English is what you speak by definition ;)
 
But if any Americans want to pile on, they need to explain "off of" first
 
1:16 PM
ah, parsley? i usually go for cotton :D
 
Don't be. Carry on using it irregardless
 
yes irregardless of what others says, use irregardless :)
 
Why this gives error?
for collection in collectionsToAppend:
        for requestPosition in requestPositions:
                if collection[constant.ID_KEY] == requestPosition[constant.ID_KEY]:
                        del requestPosition[constant.ID_KEY]
                        collection[constant.POSITIONS_KEY].append(requestPosition)
 
disregard what they think :)
 
@QuicoLlinaresLlorens please see the pinned message
 
1:17 PM
It is because the del line, but I do not get the why
 
I will be using the word irregardless irregardlessly for the very meaning "regardful"
 
Football folk, I'm putting my son in a 2 day football camp with one of the coaches at the local highschool this summer. Is it a little too on the nose to get him a full Newcastle kit, knowing full well the coach is a die hard Manchester man?
(What my son thinks is not important, he's got to learn right from wrong at some point.)
 
Manchester man here. Couldn't give a yam about football but we do have 2 teams btw
 
It really depends on the coach. Some of my family are football coaches for kids, and couldn't really give a damn as long as your boy has a good attitude
And they're Utd fans ;)
 
chuckled at "right from wrong"
let your son choose :P
 
1:23 PM
Wycombe Wanderers it is!
 
or basketball
 
and resist the urge to break down and cry if he chooses wrong
 
@ParitoshSingh smashing cars is the usual way. No tears, at least from supporters
 
i uhm.. dont know if i can condone that. :P
irregardlessly i might add
 
Oh **** off :P
I don't know how I could actually redeem myself here
 
1:26 PM
you're the only one stuck on it still ;)
 
No redemption is required
 
yup
 
People in my office use it on a daily basis
 
See, you're just as bad as Tinfoil's colleagues. No biggie ;D
 
Wow, this room is active while I'm aspleep
 
Mind you - I regularly have arguments that weight/mass are not the same things, and about the nature of charged current flow
 
We carry on our chat irregardless
 
That's the ticket!
 
@OldTinfoil weight/mass, ugh
 
1:28 PM
Yey, scorn for someone else!
 
I remember that it was confusing as a kid when my parents told me they were different, and then I learned physics
and then I let go of the issue because laypeople have no idea which is which
 
Yep - but my colleagues all went to University for technical subjects. There's no excuse
 
Ask the grocer how your weight and mass change when you're on the Moon, and...get a frown I guess
 
@AndrasDeak Oh, that's not what's going on. He can play more or less whatever he wants aside from American Deathball.
 
@AndrasDeak it's not fair that common vernacular phrases weight in terms of kilograms instead of newtons
I'd wouldn't judge the grocer (-:
 
1:42 PM
yup
 
I don't feel very impacted by the change in mcve versus reprex. My opinion is I prefer mcve. But that's probably just familiarity. Either way, I'll adjust.
 
The problem is that you don't know how conflicted you are over the term. You didn't see it, I didn't see it, but there was a real conflict.
 
@ParitoshSingh My brother lost his allowance for a month for supporting Utd over Newcastle in the '99 FA final. Serious business ;)
I prefer MCVE because it's shorter and familiar.
 
I prefer MCVE because it has the M for Minimal nice and prominent in its title
 
user3064538
but in min-reprex it has a whole 2 more letters and a hyphen
 
1:55 PM
huh, seems I forgot that 'minimal' is part of the package, my brain shortened it the reprex already
 
the hypen is a bit awkward, and now all I can think of is regex
 
It will make people feel stupid. MCVE is clearly an acronym and can be googled if anyone cared. min-reprex is not only longer, but it sounds technical, and people will wonder why they don't know about it.
 
MCVE please :'(
 
I do agree that being confused by MCVE and MVCE is quite annoying. But why do we even have the V? I find that "completeness" should encompass that it's verifiable. If I can't verify your problem, then it's not quite complete
or what is the V in there for? Now I'm not even sure :p
 
might have been 'valid'
who knows, the page is gone =(
 
2:02 PM
But I'll go back to my original point, which was xkcd. How could that ever be a thing if the ordering of letters was so hard to remember?
 
no, verifiable was right
 
well it's fine, there's always some barrier to change. I'll get used to it, just like the annoying .to_numpy() instead of .values. Why wasn't it just .to_np()...
 
Wait, .values is being deprecated?
I've never used to_numpy(); as_matrix() was deprecated, but I don't understand your comparison
 
cbg
 
2:07 PM
Morning all o/
 
yes, with 0.24 there was a push to avoid .values because of some inconsistent handling of cases. There's now a big red warning on the DataFrame.values page
 
@ALollz IMO the "complete" just means it is enough to reproduce the problem, whereas "verifiable" means it does so in an obvious way
say if it reproduces the problem randomly, it is still complete
but not really verifyable
 
Coldspeed has a good post on moving to .to_numpy()
 
@ALollz I don't even know what to say to that
 
Coldspeed is dead, long live cs95!
 
2:11 PM
Hey all, is there a way to initialise multiple variables with the same value, but different memory locations, in one line?

a=b=c = 0 doesn't work because they all reference the same memory location
 
that is not how variables work
0 has a memory location
a, b and c do not
do you mean separate values?
as in a, b, c = 0, 0, 0?
(notwithstanding that 0 is pulled from a pool of integers that are always the same object)
 
@MisterMiyagi well i want to initalise a load of variables to zero in one line, but then give them separate values later on
 
a = b = c = 0 is fine then
 
@MisterMiyagi thats good to know about the memory locaton thing thanks
 
integers are immutable, changing them does not change other references
 
2:13 PM
They will reference the same objects becausee of integer cache, anyway
 
ok where as with multiple items, like lists this can become a problem
*mutable
 
one = 1
uno = one
one += 1
print(uno)
 
haha ah i see
 
if you have mutable values, you must copy them to avoid side-effects
 
yes this was what i was concerned with
but understand now, thanks
 
2:16 PM
@MisterMiyagi the point is you can't change them. Sorry if nit-pick
 
I wanted to avoid going on a tangent as with the singleton roundup :D
 
I think this is an important distinction to prevent the "mutable presto-chango"
 
That feeling when var++ doesn't work in Python but does in every other language you've done XD
 
@biggi_ but +=1 does work.
... most of the time...
and...
 
Haha I agree! I'm just so used in my for loops doing loopvar++
 
2:21 PM
foo = ('a tuple with list', [1])
foo[1] += [2]
 
@biggi_ you never increment in a python for loop...
 
I know this....after experimenting and learning haha
Again, I'm working on my first "big boy" python project....more than just dabbling in it
 
you only increment in a while loop :)
 
@AndrasDeak "integers are immutable, changing the integer value of a name does not change the value of other names"
like this?
doesn't sound quite as catchy as "mutable presto-chango"
 
So if I have this: for value in data[170:181]: How can I get the index that the loop is on? Is there a way or should I increment a variable in the loop to catch the index?
 
2:25 PM
enumerate
 
@MisterMiyagi No. "Integers are immutable so there's no way for changes made to a to affect b"
@biggi_ as Miyagi said, enumerate. With a starting index.
 
I find that whenever I say "there is no way", someone discovers ctypes
for index, value in enumerate(data[170:181]):
 
Whoever mutates immutables must bear all responsibility
 
Typically I can find a way to get it done....might not be the most elegant solution but it works
Like instead of enumerate I'd set index = 170 and then do index += 1 in the loop ;)
 
Do you plan to learn python or just get it done?
 
2:31 PM
I'm learning, I was just saying typically I can get stuff done, might just not be the best way. Learning the best way takes a lot of time...time I'm willing to put in however. Old boss of mine told me to take pride in my work and not half a** things.
 
Then I do suggest picking up good patterns
 
I'm working on it. I've got that loop-> for value in data[170:181] where i'm trying to store the index (will be 170-180) and the output of an equation into another list(array) type thing.
Lemme hash it out a bit and I'll post what I did later
So you can tell me "Yes, good" or "No, bad"
 
Sure
Just list, not array, probably :P
 
So in Python, what is the difference between a list and an array?
Add dictionary to that as well
 
Lists are lists, dicts are dicts, arrays are array.array or bytearray or numpy.array (third-party lib)
 
2:37 PM
a list is a mutable sequence of arbitrary objects
e.g. ['a', 2, 3.0]
 
dicts are very different though
 
an array is a sequence typed to a low-level machine/C type, such as signed long long
 
e.g. array.array('B', [1, 2, 3, 4, 255])
arrays are rarely used unless you interact with C/compiled code
 
Gotcha, and a list can be string, int, float, etc?
 
2:39 PM
dicts map from an arbitrary key to an arbitrary value
like a phonebook for example
e.g. {'Jane': 124124251, 'John': 8165124, 42: 'The Answer'}
 
@MisterMiyagi or numpy
A much more common occurence
 
@AndrasDeak the numpy array is something different than the array array, though
 
See this is why I love programming <3
 
Indeed, but it's an array and it's what makes misnomers confusing
 
true
 
2:42 PM
If only array.arrays were arrays we could know that everyone calling stuff arrays had lists
 
I usually separate the two by whether the guy asking has an air of low-level programming around them
otherwise, it is always numpy
 
@biggi_ the bottom line is that programmers (and STEM people in general) like to call a spade a spade
 
This is true. I've found most of the engineers here are very black and white
 
@MisterMiyagi no, otherwise it's numpy or just a list....
 
Leave the grey area to the sales guys :)
 
2:44 PM
@AndrasDeak really? I only found the "array means list" guys coming from lower-level languages
 
I suspect at least 50% of SO questions with "array" in the text have lists
JS people do that too.
 
good point
so an array is a list, an array or an array
 
And w3schools used to conflate the two, ugh
 
or a tuple
damn...
 
@MisterMiyagi yeah...
 
2:47 PM
come to think of it, it could also be a struct, if we are dealing with C-ish programmers
 
yes, that's probably my biggest pet-peeve with questions. I have the following list: {1,2,4,5,7}...
 
Or the pandas equivalent "I have a dataframe ['thing', 'foo', 'bar']"
 
2:59 PM
Is there a way to use endswith with a wild card?
 

« first day (3133 days earlier)      last day (1824 days later) »