- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I see what you did there
Admin
Are you my coworker?
Admin
Yes. The appropriate colors are black and blue, with red for more terminal cases...
Admin
random.shuffle(list(list_)) then. The original point that sorted(list_, key=lambda z:random.random()) is awful still stands.
Admin
[quote user="QJo"][quote user="TheCPUWizard"] It makes you want to chew your own leg off to get away.[/quote]
Reminds me of something my dad used to say "If you break your leg don't come running to me!"
Admin
Admin
Sure... so we can redefine our function as
but whether it's necessary to return a different list vs. shuffle in place is a question of the intended use of the function.
Admin
But please don't use copy.deepcopy. list(_list) or _list[:] is what you want there.
Admin
I know it's a bit late to comment, but hey, the implementation isn't that bad (provided there wasn't an obvious library function available which could already do the job).
I dunno, maybe I was the source of a lot of WTF early on in my life as a coder for this, but I sometimes felt compelled to implement similar things myself, cause I didn't like "Magic" and wanted to understand how something was done. It wasn't a mistrust of libraries thing, but for a newbie, it sometimes feels good to have "done it yourself", even if it is something trivial.
To those who said better supervision was needed for a junior. I agree, but sometimes senior management see a well run, efficient team with 2 or 3 senior devs and a large number of graduates, then start thinking "hey, these kids do most of the work, why do we need these overpaid seniors, it's all just computer shit anyway" then they retrench any technical staff paid over $150KPA and you've got no technical leadership left.
If he were on my team, during the code review I'd have refactored the calling code to use the requisite library functions, explained why having more code to maintain is bad, then pointed the well-intentioned kid in the direction of the library source code (or ILSpy if you're on .NET), to satisfy his curiosity as to how the thing is implemented.
Admin
I work for a company that actually produces things to contract, on time and on budget. We don't have daily standup meetings. Coincidence?
Admin
and then curse your CS lecturer for not letting you use it :/
Admin
This developer was eventually promoted to Project Manager. This is the part that is missing in the story.