« first day (2747 days earlier)      last day (2215 days later) » 
00:00 - 18:0018:00 - 00:00

12:04 AM
@OneRaynyDay You mean like you want to know how a row changed? One approach if you're lucky enough to use Postgres is via triggers that create a json dump into an audit table
 
hey guys, i have this chunk of code
(in django)
` url(r'^login/$', views.LoginFormView.as_view(), name='loginscreen'),`
if i go to 127.0.0.1:8000/login it works
however, when I include try to make a reference to this as a link via a template the link when I hover on it shows 127.0.0.1:8000/login but when i click it does nothing
<a href="{% url 'main:loginscreen' %}" id="register-form-link">Have an account? Sign in here.</a>
the final rendered output is
<a href="/login/" id="register-form-link">Have an account? Sign in here.</a>
when i click there's no error or 404 or anything at all added to the terminal
 
12:34 AM
I'm trying to inplament run length encoding I have a working encoder: dpaste.com/0TH06MA is there a way to remove the total[1:] without it including a 1 at the beginning of the result?
Also is it possible to make it more efficient? :)
 
12:50 AM
Large task involving canonicalization and clean-up:
0
Q: How to organize and assign canonicals for "Python/pandas compare IP address/CIDR"?

smciThere are tons of Python/pandas/et al. questions on comparing IP addresses/ CIDR, but surprisingly almost no canonicals. Frankly it's one hell of a mess, and needs organization, cleanup. some ask about native Python (2.x/3.x), some about pandas DataFrames (1 string or 4 integer columns), a few ...

 
Rbrb all.
@smci interesting... :D
 
1:12 AM
So I've done more testing, if I right click this link and open in a new tab it opens just right, additionally the link in my header works. I have another link inside the form that works (reset password link), the only links that dont work on click are signin to signup and signup to signin links inside this particular part of the body
and its just like django completely ignores the request
in the navbar this works:
<a class="nav-link" href="/register/">Join Now</a>
but this doesnt in the body:
<a href="/register/" id="register-form-link">Don't have an account? Join Now.</a>
 
 
2 hours later…
3:21 AM
cbg
does anyone know a practical use case for collection.deque over a regular list/array?
 
Easy pops on either end?
I believe they're also thread safe
 
O(1) on either side. Yeah granted wouldn't it be same if you know the length of an array as in np.array
I take the thread safe point though
Excuse my English :) I meant wouldn't it be the same?
 
3:41 AM
Mostly, you would never use deque if you were going to be doing any operations that required inserting to the middle of the deque
But if you need to be adding and popping from either the beginning or end of a list repeatedly, those are O(1) operations.
For example, inserting into a list at position 0 is very, very slow compared to appendLeft
 
Thanks for the response :) Hmm. I am just curious, what kind of application would you need that.
 
wim
4:23 AM
deque is very good for breadth-first-search
you consume nodes at the left and append children at the right, in a while loop
 
 
1 hour later…
5:45 AM
@Simon initialize from inString[0] looping from the second char?
You can use iter(inString) and its next() to init and loop over the rest. Just check for an empty string
You could also try something with itertools.groupby
 
6:09 AM
cbg
 
6:40 AM
cbg
 
cbg
 
7:05 AM
cbg
 
7:27 AM
Does anyone knows Matplotlib? Namely, I have build a figure of bar plot with legend. I need to put vertical line over the bars so I used plt.axvline. It works well but it overlaps the legend. So how can draw axvlines that goes "under" the legend of the plot?
 
cbg
@user2219896 the legend should always be on top. Do you have a few lines of code and the resulting image?
 
@AndrasDeak This is a part of the larger program and I have 205 lines of code.
 
try to reduce your problem to a dummy example; if the problem goes away you'll know you're breaking it yourself :)
 
@user2219896 oh, hold on!
axvline: Add a vertical line across the axes.
axvline is supposed to be on top :)
 
7:36 AM
Tying: plt.vline(indeksit[i][0], linestyle=':', linewidth = 1)
AttributeError: 'module' object has no attribute 'vline'
Trying:
 
yes, I missed the name at first. Try reading the docs before using a function with random input
if you only want the line inside your axes use vlines, but you may have to play with zorders or something in order to put it above your bar plot
 
and it will probably mess with your axes limits, so you might need to store the original limits and reset them after plotting the vlines
 
I will try to that. Thanks!
 
no problem
 
7:58 AM
cabbage
anybody still here?
 
8:15 AM
idling intently
 
lol
I think I'll post the question because it's kinda quiet in here
 
8:47 AM
anyone here a data science analyst? or similar related areas?
 
Just go ahead and ask your question =)
 
9:12 AM
I'm still a newbie because this is all self-taught so please correct me if I'm wrong. The question is about Machine-learning and I've grown tired of using someone else's algorithm to train my model and predict x and I want to learn to make my own yet I've got no clue where to start in this seemingly vast oceans of areas such as math, counting N numbers of people in a room, to sorting files faster by pattern indexing etc.
 
Writing a classifier with linear regression isn't too hard. Did you try that already?
 
Yes, I've tried that, using google machine learning tutorial on youtube, I wrote my own decision trees, and basic classifier x labels, y features.
 
Did you feel like you really understood what a decision tree is about and how it classifies?
 
yes
basically, the more features you have the better at classifying certain labels
for example size of dog and cat
sometimes it has trouble classifying it but when i add in new features like fur color, or sounds it make: bar, meow
then it easily classifies which is dog and cat
 
There is also a rule of thumb that you need more data the more features you add
 
9:21 AM
I agree, and also the right data
using size of dog/cat is one of those examples where It can easily mis-classifies one for the other.
 
But given what you tell me right now, I am not sure what you expect as an answer - you have the ability to reproduce ML algorithms, and an understanding of what you want to achieve. Why not just continue on that path?
 
I don't want to keep using other peoples algorithm, I want to make my own.
 
What stops you from making your own?
 
I think I'm not understanding certain things or missing some key points in making one or how to verify that my algo is accurate.
when you look at a Decision tree code from scratch
its different when you use it.
 
Well, just to give my two scents, linear regression and naive bayes are two you could try next. You do need some statistical knowledge do get them right and understand why they work, but not as much as with the more exotic ones.
@ZenB883 Do you mean google's implementation is different from yours?
 
9:29 AM
no, but regarding statistical knowledge, I think I should head into that direction because I think that is why I'm having such a hard time with writing my own algo. I do understand probabilities and statistics for example, a bag of 5 candies which 5 different colors and the chances of you picking 1 color you want is 1/5. That much I understand anything else beyond that, I think I currently lack.
I want to dive deeper on how they wrote and came up with a "Decision Tree" algo and the code under the hood.
 
I see. I'd say doing good in machine learning requires equal parts software writing and statistic skills, so that's something you should definitely go deeper in
understanding bayes theorem, for starters. you can spend literal ages playing with just that
and do very well for yourself
 
anybody can use a calculator in a simple math test, but I want to understand that "show your work" part and how they got to their conclusion is what I'm trying to do.
yes, I see your point, and that's what I've been doing for the past few months is trying to understand each and every different algorithms in a given problem like regression, linear algo.
But, I felt very tired and bored when having to use someone else's algorithm and because it's not mine, I don't feel satisfied and I don't see the point in trying to understand new algorithms when I can't even write my own.
 
the idea is that to become an expert, you usually want to understand what other experts are doing in the field, so that you can get new ideas and write your own algorithms
 
Naive bayes, Stochastic Gradient Descent, Adams, Rmsprop
@FlorianMargaine - I understand, that's what I've been doing thus far is learning and re-creating results through custom dataset, testing, modeling, tuning parameters and also competing in Kaggles competitions.
 
stochastic gradient descent is really hard
 
9:40 AM
But as far as I've seen, everybody ends up doing almost exactly the same thing in those competitions, which was using pre-trained models, VGG16, Inception, then people with money had the advantage of training multiple ensemble models to reduce loss and reduce overfit/underfit data using optimizers like LGBM, and averaging up models using K-fold method to average those models which evidently gives them those last % to win.
 
well, what you are describing right now is 'how to win ML competitions' and not 'how to become good at ML'
 
80% of those is always the same of using someone else's algorithm, optimizers, to achieve certain %, 10% relies on gpu powers, while the last 10% is third-party softwares to help pre-process data, clean-images, etc.
@Arne to me, that's how I get those experiences and knowledge is by competing.
 
as far as I could tell, you didn't want to become someone who can win competitions, because, as you correctly said, that part boils down to investing in hardware and finding/testing/buying the best libraries
 
but the question is I want to make my own algo and be good at ML without using other experts algo.
for someone without the gpu power and best libraries, I had to rely on my own algo and at the same time get a satisfaction that it is my own.
 
why do you focus so much on competitions and their percentages?
who cares?
 
9:44 AM
I used the competition to learn and to verify that I am on the right path.
like I said, I have trouble making my own algo because I don't know whether my algo is accurate and how to verify it, so in order for me to understand more about ML, Kaggle was a way for me to quickly understand ML.
 
Did you do this one already?
 
ahh
the scikit iris
and boston housing dataset
not the courses
but from tutorials in scikit-learn documention, youtube tutorials, and the books that I currently have, " Python Machine learning and Deep Learning by Packt did mention about Scikit-learn iris, and other datasets like boston housing.
 
It's a good course, so I'm told
it uses external libraries of course, but also goes into some theoretical stuff
 
yes, I am aware, I do have many books and watched tons of youtube tutorials on that.
pandas libraries
 
I'm afraid I still don't really understand what answer you are hoping for
 
9:52 AM
PIL for image, numpy, visualization: matplotlib, plotly, seaborn etc
creating your own algorithm
 
But you did that already.
 
is the question, I don't know where to start.
??
 
wait, we are spamming the chat here a lot. chat.stackoverflow.com/rooms/169658/ml-discussion-room
 
oh
lol ok.
 
10:08 AM
If i have a app that requires sing-in with a app [integration] and get user data + token from it. would i be better to have two tables, [users, integrations -> (id, token, ...., uid)] or just have integrations with [name, email, token, password.] ?
 
10:19 AM
mhmmmm
 
10:54 AM
@Prakhar separation is better. Tomorrow you might have a different integration.
but if it's a simple project, you can always start with a single table
(optimize, but only if necessary)
 
11:27 AM
hi
 
I want to perform the equivalent of the numpy A[R][:,R] but in pure python. As an example A = [[0, 1, 2], [1, 2, 3], [2, 3, 4]] and R = [1, 2, 2] and the output should be: [[2, 3, 3],[3, 4, 4], [3, 4, 4]]
is there a nice way to do that?
I'll on the main site
 
@AndrasDeak Thanks for pointing that out, it was so obvious as well temp = inString[0] and set count to 0. I don't understand how I missed it. Thank you very much :)
Not much good on compression though: Raw Length: 4074 Compressed Length: 7868
 
11:44 AM
you mean "set count to 1", right?
unless you don't skip the first element
@Simon RLE is only a good compression for something that has long runs...
@Arne thanks
 
12:03 PM
[[A[i][k] for k in R] for i in R]
simple in the end :)
 
in numpy you could also do A[np.ix_(R,R)]
 
@AndrasDeak yes.. I was trying to get away from numpy
for pypy purposes
 
shame :P
 
yes! numpy is just very slow with pypy
although it does work
 
@AndrasDeak Er no. I did set the count to 0: dpaste.com/200Y6VN
 
12:10 PM
@Simon as I said, that's fine if you start with the first index
 
Yeah I know it's a pretty useless encoding for text, but I want to use it for compressing images.
Just got to figure out how to get it working with bytes later.
 
is it unreasonable of me to be really annoyed that np.random.randint(0,1) is not equivalent to random.randint(0,1) ?
 
@Anush "really annoyed", yes. "annoyed", probably not
yeah I'm dumb, it's np.random.random_integers which is being deprecated in favour of randint, sorry
 
@AndrasDeak :)
 
I still don't get why I don't get a deprecation warning :/
for some reason my 3.6 install doesn't emit those, only my ipython3.6
 
 
1 hour later…
1:18 PM
\o somber-cbg
 
1:29 PM
@MooingRawr what's going on?
 
hope you got to see it before the deletion :D anyways hows life Andy
 
I'm so yamming tired
 
it's easier to stay up late than sleep and wake up early at the same time you were planning to stay up late anyway
cbg
 
cbg
 
couldn't sleep AD? something on your mind? maybe the numpy nightmares were keeping you up ?
 
1:42 PM
I was dog-tired last night to begin with, then I didn't sleep too well and had to get up not-too-late today
so nothing major, just a few long days
 
:( not even mid week
 
I hope not, I have 2 finals on friday
 
DSM
Tuesday cabbage.
 
cabbage
 
cbg DSM \o
 
1:56 PM
Interesting observation about people from Israel, so many of them have their profile picture set to pictures of their kids.
 
Look at that, all those jokes like this one have have gotten google confused about what this sculpture is about
user image
3
Machine learning at its finest
 
at least it's not racist
 
I bet we could find something if we really tried.
 
hey who knows, maybe he was a programmer before he turned to stone
 
2:21 PM
Hey if anyone here is fluent at django; Why is it that when I tried to add a url to urls.py, it's not listed:
urlpatterns = [
    path('x/', include('x.urls')),
    path('admin/', admin.site.urls),
]
It gives me the 404:

Using the URLconf defined in project.urls, Django tried these URL patterns in this order:

1. admin/
seems like a lot of black magic going on and kind of hard to debug where it's breaking
 
@OneRaynyDay What is the exact URL that you typed in the browser?
most likely you forgot the trailing slash
 
here's the urls that I have tried:

10.xx.xxx.xx:8000/x/
10.xx.xxx.xx:8000/x/index
I have a simple views.py at project/x that has a function index(request) and returns an HttpResponse
I also have a urls.py at project/x that has urlpatterns = [ path('', views.index, name='index')].
and the urlpatterns I listed above 10 minutes ago is in my project/urls.py file.
 
@OneRaynyDay the second example needs a trailing slash...assuming that you have an appropriate matcher in x.urls
The name 'index' is only used in Python code, such as with reverse(). You don't use it in a URL.
So the second URL won't match anything.
 
2:37 PM
ah I see. Well, I also tried 10.xx.xxx.xx:8000/x/, so if the first arg of path would be empty right
and in this case it would match the url ^
 
Yes, I think the first URL looks like it should match, but I haven't used separate url files like that, so I'm not 100% sure what's going on there.
I have one suggestion: Open a terminal and cd to your project directory. Then run manage.py shell and run the following:
>>> import urls
>>> reverse('index')
I think that will give you the URL that matches the pattern named 'index'.
 
ah okay gotcha, let me check
 
oh...you also need this:
from django.core.urlresolvers import reverse
 
I don't think we're using the same version :o, I'm running 2.0.4, and no django.core.urlresolvers
 
from django.urls import reverse I think
(2.0+)
 
2:44 PM
Ah, thanks :)
 
yah, I haven't looked at 2.0+ yet
 
ugh this is so frustrating. I tried reverse() on /admin, admin, index, /index, x, /x and nothing. FYI I'm pretty much following this tutorial: docs.djangoproject.com/en/2.0/intro/tutorial01 but I'm not getting the correct results
let me try the whole thing from scratch again
 
@OneRaynyDay Read the code I typed earlier
 
@Code-Apprentice you mean the import urls portion?
 
1. You must pass a string to reverse(). I assume the omission of quotes in chat is just an oversight. 2. The string is the same as the name you assigned in path().
(no slashes needed)
 
2:49 PM
ah yup, I was aware, but since index didn't work, I was just wildly trying things
(and yes I passed in strings)
 
@OneRaynyDay Try reverse('admin:index'), admin is a namespace.
 
Except it should be 'x:index'
 
ah.. okay one second. Wasn't aware of the nomenclature
 
the URL in question is in the project named x.
 
Also, if you use django_extensions and the likes, there are also handy methods to directly print all urls, just like runserver.
 
2:53 PM
well, time for me to leave for work. rbrb
 
hey guys cbg... long time ... im on my way into work right now so please mention me if you have any insights... Im trying to use tox and be responsible library creator ... but Im on windows and one of my projects needs a whl from golke ... how do you bundle different python versions of golke in that tox will use the right one in the right interpretter
different versions of gholke binary wheels (for different python versions)
 
3:04 PM
Okay. I'm stupid. I put the urls.py on the top level directory rather than the nested app directory (they have the same name and the tutorial doesn't discern this)
 
They do show the project structure graphically - docs.djangoproject.com/en/2.0/intro/tutorial01/…
 
yep, and when they said "mysite/urls.py" I mistakenly assumed it was the top-level directory mysite
but yeah I'm stupid :P
 
or the docs are slightly misleading (or both :-p )
 
I'd like to think both :P
 
cbg
 
3:17 PM
@JoranBeasley Is this a question about how to set up the correct tox environments, so that each python version pulls its dependencies corecty?
 
3:31 PM
s/corecty/correctly/ .. nice word to mess up this badly
 
cbg ppl
 
DSM
A specification is not a question..
 
@DSM yeah..it looks like he is client putting requirement specification on to developers! LOL
 
how does this guy get a gold badge
 
3:39 PM
famous question 20k+ views votecount 5
 
Basically asking any decent question ~ 5 years ago
Will get you famous question
 
also some gold badges isn't hard to get. for example, log in once a day for 100 days in a row
 
Gold but still rep is 50. Quite weird
 
Quick question about PyQt 5. I have a project on GitHub that uses it, is that okay? Then on top of that is it okay for this tool to be used in a work environment as an open source tool? Or should I just switch to PySide?
 
hi all
 
3:46 PM
cbg
 
@ZackTarr what you mean by "GitHub that uses it, is that okay?"
 
@MooingRawr I personally probably will never get that badge :P
 
I know it has some special rules on its licensing and Ive been trying to read on it. But Im not following which license rules I should be looking at give the scope of my project.
 
Also, whether or not you can use it in a work environemtn is entirely up to your workplace's policies. I believe PyQt5 is licensed under LGPL or GPL which is a no go for certain companies
Although if your company is fine keeping the tool open source, then there is no reason why you shouldn't be able to use something licensed under GPL or LGPL
 
It would be a tool for like internal use in the IT department. Ill ask and see if there are any internal rules.
 
3:51 PM
has only limitations on liability and warranty. so I guess you cold use it for work - environment
 
Oh perfect! So do I need to like include that in my program? Pretty green with the whole open source mentality.
And pretty green to development to be honest haha
 
You definitely want to keep track of the licenses for not just that library, but every license for all the libraries you are using
 
i basically think entire GitHub is open source stuff and most if not all can be used freely as needed without worrying unless someone mistakenly loaded patended and prohibited code on there
 
That's mostly true, however some licenses require releasing changes you make to the source code, which isn't always desirable
 
yeah. Gaucamole that
 
3:57 PM
@chrisz Thats what Im trying to make sure on.. I think pyqt is the only one that might give me trouble.
from distutils.sysconfig import get_python_lib
from ctypes import cdll, c_wchar_p, c_int, c_bool, pointer
import sys
from PyQt5 import QtCore, QtGui, uic,QtWidgets
import sqlite3
import time
Those are all the library Im using.
Do I need to include like a link to any license stuff inside of my project?
 
My philosophy for licensing is: for toy projects, don't worry until someone complains; for projects involving any amount of monetary revenue, follow whatever rules are necessary to keep people from suing you.
 
@ZackTarr I would check company policy. If its green to go then its good practice to add comment what Open source license does it use
 
You don't want to skimp on CYA prep for your Facebook clone and then go down in flames the day before your billion dollar stock options vest because it turns out you violated the license for your GUI library
 
If QT is out, Tkinter should probably be fine. Or better yet(?) you could use Flask and create a web GUI
 
4:03 PM
No money involved. Basically just a gui for AutoHotKey written in PyQt5 for internal use.
@WayneWerner I would love to get a flask project going but not sure if this project would be the best fit.
Then again, I dont know flask so I cant really judge what would be a good fit and not haha.
 
IP things are always complex and conflicting.Thats why many of these big giants too struggle with each other for the same
 
I probably should have hammered stackoverflow.com/questions/50005994/… when I had the chance
Not much point now that it has 4 answers
 
BTW hammered = mark as duplicate or = close?
 
= get drunk
 
4:09 PM
Both
 
@KevinMGranger laurel
 
it's when you have a gold badge in the tag of the question, so you can close as duplicate in one vote
 
@vaultah (thumbs up)
 
4:24 PM
For the record, I have unironically printed out a picture of RMS to put in my cubicle because he's an absolute unit
 
@KevinMGranger So, how many GNUs is an RMS?
 
Hey, is there some online essay I can totally plagiarize to make a case for Django over Flask for a small project?
Obviously the key point is: I have already done some work, set up the environment, half way done and django is good out of the box. I just don't want to write an essay
 
no, because it really depends on your small project. For tiny projects, Flask is much better / faster (dev time as well as perf, but no one's comparing that).
 
you'll usually find it the other way around
 
Depends what you mean by "small" and what the team is comfortable with. You're in a room full of flask fans, just so you know ;)
 
4:27 PM
Alright fine. Time to rewrite into Flask.
is there an ORM admin manager thing in flask that django has btw?
on localhost:8000/admin where you can add/remove from DB
 
@OneRaynyDay takes swig from flask under desk
 
@OneRaynyDay I searched for "flask admin" which probably gives what you want
 
Woops. Thanks :)
 
@MooingRawr I barely got that this year
 
@Code-Apprentice nice rep - 41414
 
4:31 PM
I'm a palindrome!
@MooingRawr I lied...I got it a year ago. Still, I've been an SO member for like 5 or 6 years.
 
I wish I was active in FGINW days. would have had huge rep
 
My current streak is only 120 consecutive days
 
i am 50/100 . Hope to get my first gold badge at least by logging
 
Took me five years to get the Fanatic badge. It's hard when you factor in holidays and weekends and stuff.
 
@arne yes its specifically for python-ldap
it doesnt pip install on windows
 
4:34 PM
Last thing I wanted to do on lazy Saturdays was tech support
 
I use flask for personal projects but I'm working on a large django codebase for work. (well, I don't need to touch the code myself, but anyways)
 
(well without some serious hoops to jump through)
 
@Kevin I didn't even have Internet at home when I first joined, which makes it even harder. I was relying on public WiFi to get my SO fix.
 
@arne i figured it out (RTFD :P )tox.readthedocs.io/en/latest/example/…
 
in other news, I woke up this morning and put on my glasses, but my vision was even more blurry. Didn't take long to figure out I fell asleep with my contacts in...
 
4:40 PM
you need to time it right to get the stars :-p
 
How's this work? @KevinMGranger gets three stars for the same thing
=p
 
Also because he is one of the Kevins
 
we're technically parts of the same hive-mind
 
I think I should change my handle..."Kevin-Apprentice"
 
I've always wanted my own minion
 
4:41 PM
XD
 
I didn't see yours, sorry. Someone dupe-vote my chat message
 
@Code-Apprentice that sucks.. I had terrible exp just trying out lenses.
 
I'm an apprentice, not a minion...oooohh
 
But your pic says otherwise
 
@Prateek my prescription is fine...just doesn't work when it's doubled with both my contacts and my glasses.
 
4:43 PM
mine was fine. i tried 2 different contacts .. seems i am not meant to wear them.
 
That license reminds me of The World's Pinkest Pink, a pigment "available to everyone except Anish Kapoor! (who won't share his black)"
 
Whoops, meant to edit. Not delete that @AshishNitinPatil. But I think that would be an interesting graph to look at. See who the true star is. Haha
 
Referring to the ultra-dark pigment VantaBlack, licensed exclusively for use by Anish Kapoor and nobody else
 
who the f is anish kapoor :)
 
@ZackTarr That's SO chat for you. Abandoned into oblivion. Glad that it works at least.
 
4:45 PM
As far as licenses go, wtfpl.net is a classic
 
lol
 
@ZackTarr A long time ago I wrote a script that collected all the information on every starred message in chat. Not sure where the code went.
Feb 9 '16 at 16:33, by Kevin
Ok, here is the sorted list of absolutely every starred message as of two weeks ago: http://pastebin.com/B65fr8aA
Feb 9 '16 at 16:41, by Kevin
Kevin 1518
Ffisegydd 778
tristan 677
Jon Clements 468
davidism 439
poke 306
DSM 253
Robert Grant 243
corvid 205
Martijn Pieters 187
 
Neat! Thanks Kevin
 
I suspect my ranking isn't so impressive now that everyone's figured out all my posting gimmicks
 
4:58 PM
(pronounced jimmicks)
 
@KevinMGranger Chrome thinks I have a MITM attack going on
 
KITM
 
design question, I am reading code complete 2 and there is a section about differentiating between procedure and function. Procedures being functions that only cause side effects. It recommends using a flag to indicate that the procedure was completed. Was wondering if it's a common thing to do in python
def save(path, completed=False):
    try:
        with open(path, 'w') as f:
            f.write("HI")
        completed = True
    except IOError:
        # log it
    return completed
Kinda like this I think
 
That won't affect the input variable
Bools are immutable. And that looks weird to me. What mutates should return None usually
 
I don't consider that especially common. Generally, when a function fails, you raise an exception, rather than return a value signaling failure.
 
5:21 PM
If it failed it should raise
 
There's no formal distinction between procedures and functions in Python. It's all just functions. You are, of course, free to mentally categorize your functions however you like.
 
Listen to what Kevin said about raising, but if your api truly needs true/false, just replace completed = True with return True and at the bottom put return False
 
Okay, thanks :)
 
Even in code that does return a flag, that example is very strange because completed is an argument to the function. It doesn't make sense to me that the user is able to supply their own value for completed.
Why would they ever want to call save("foo.txt", False) or save("foo.txt", True) instead of just save("foo.txt")?
 
Don't know, I just translated the example in the book
these are in c++ originally
 
5:26 PM
Possibly the example was originally intended for a language that supported pass-by-reference, or similar. Where assigning to the boolean inside the function also changes the value of whichever object was passed in. Python does not work that way, though
 
That makes sense
 
I think I have a copy of CC2 at home... What page are you on? Maybe I'll take a look at it later tonight.
 
section 7.6 p181
 
I'll get to the bottom of this mystery, in five to thirty hours
 
Lol I'll sleep soon so yea I'll keep my eyes out tmrw
FYI the origin line : report.FormatOutput(formattedReport, outputStatus)
 
5:49 PM
90% chance that the real problem in Can't use sum operator in for loop is that he's trying to do sum() on a list of strings, and can't figure out how to turn it into a list of floats first
 
@Code-Apprentice pine apples :D
 
@MooingRawr thanks...my point is it took me 5 years to get Fanatic
 
I went through my craze of wanting a gold badge, so I went to find one that I could get easily. I recall writing a sticky note on my home computer to say "login to SO"
 
00:00 - 18:0018:00 - 00:00

« first day (2747 days earlier)      last day (2215 days later) »