« first day (1835 days earlier)      last day (3107 days later) » 
00:00 - 13:0013:00 - 00:00

12:02 AM
I think something -happened- when they deployed it, and this is the result. I can't imagine this being deliberate.
 
user5365803
12:23 AM
hello
 
user5365803
any one here?
 
present
 
user5365803
how to you represent equals in python?
 
==
 
user5365803
okay thanks
 
user5365803
12:24 AM
goodbye
 
If you mean checking for equality, that is.
 
Anonymous
12:53 AM
Oh God, Python 3 sucks.
 
WAT
 
Keep on trollin'. Keep on trollin'.
 
Anonymous
@MorganThrapp I'm not
 
Perhaps you could explain what you find sucky about it? And then we could tell you why you're wrong. :)
 
Anonymous
I came here looking just for a simple tip to ask about a what a good directory structure is, so I could make my app (which I have been building for 3 weeks) a little fancier.
 
Anonymous
1:03 AM
Now, after being told to update to Python 3, I can't even get out of weird Indentation and Invalid syntax errors for 45 minutes.
 
@samayo You're mixing tabs and spaces in your source file.
 
lol
 
Anonymous
@MorganThrapp I'm not that retarded.
 
I suggested a Python solution for a bash question. Do you guys agree?
0
A: Easiest way to capitalize a string within bash 3.2?

idjawA bit of a cheat, but I'll put it here unless an explicit bash 3.2 solution comes up. You can use Python and just do this: bash-3.2$ var='dog is dog' bash-3.2$ python -c "print '$var'.title()" Dog Is Dog

 
I'll agree
 
1:05 AM
sweet
 
And that's not nothing.
 
I removed the "cheat" comment...just flat saying it can be done in Python :)
 
Anonymous
I'm installing Komodo in the hopes it can detect something
 
Indentation and syntax errors have nothing to do with Python 3. Do a search-and-replace for tab characters and replace them with four spaces.
I mean, nothing to do with Python 3 vs 2.
 
post the stacktrace
 
1:10 AM
@TigerhawkT3 Didn't Python2 allow mixing tabs and spaces? Python3 doesn't.
also: cabbage.
 
Just tested on Python 2, doesn't seem to allow it.
 
Maybe I'm nuts :)
 
Anonymous
perfect, Komodo shows no errors
 
Tried:

    if 1:
    \tprint 'hi'
        print 'hey'
Also tried with one space on the "hey" line instead of 4. Still didn't work.
Python 3 is great.
 
I don't have a Python2 version on my Windows desktop
so I can't test
 
Anonymous
1:13 AM
if 1:
    someVar = cursor.execute("select  ... ")
    print someVar
 
print someVar is invalid Python3
 
Anonymous
maybe it is me, but is there something wrong with that?
 
Anonymous
@AdamSmith I am on 3
 
print stopped being a keyword and started being a built-in
 
@samayo In 3? You still have print as a statement instead of a function.
 
1:14 AM
whoops, I typoed -- meant invalid in python3
print(someVar)
for beginners, that was the biggest change from Py2 -> Py3
and probably the most sweeping backwards-incompatible change, since it invalidated all of the "Hello, World" style tutorials on the interwebz at the time
 
Dupe for you:
146
Q: Syntax error on print with Python 3

ScottWhy do I receive a syntax error when printing a string in Python 3? >>> print "hello World" File "<stdin>", line 1 print "hello World" ^ SyntaxError: invalid syntax

 
Anonymous
so basically ...
 
Anonymous
22 mins ago, by samayo
Oh God, Python 3 sucks.
 
lol ok
 
It doesn't suck.
 
1:16 AM
=/
 
Python3 is worth using even if only for yield from
 
Try printing tidily in Python 2 without sys.stdout or from __future__ import print_function.
 
The other big ones I know of is input/raw_input and range/xrange.
 
ah yes that's true
and range/xrange isn't a HUGE difference
 
In Python 3, you can do things like print(*mylist, sep='') and print(text, end='').
 
1:17 AM
but input/raw_input is
 
and didn't izip become zip?
 
Yep.
 
yeah most of the things that used to give lists give iterators now
map, sorted, etc
 
And all the map etc. became lazy evaluators instead of eager lists.
 
Anonymous
I will just downgrade to 2.7 and migrate to 3 once I get a good grip of the language, otherwise these nonsensical, radical changes are gonna drive me crazy.
 
1:18 AM
@samayo fair enough! :)
 
Anonymous
thanks @ll
 
"I need parentheses to print now" doesn't mean 3 sucks, in the slightest.
 
"I don't understand this, so it sucks!"
 
but it does if you don't have context as to why the change happened
no need to bash the guy for saying "Hey this worked before and it changed for what appears to be no reason -- that's dumb"
 
@AdamSmith I wouldn't say it means it sucks, just that it could be confusing coming from 2.
 
1:20 AM
Speaking of upgrades -- I'm still on py34
 
Since Python 3 doesn't require a space after the print but 2 does, it really only adds one extra character. For the incredible flexibility it gives you, it's more than worth it.
I'm on 3.4 too - too lazy to check if the libraries I use are available on 3.5 yet.
 
Anonymous
@MorganThrapp very confusing. Plus, the irritating thing is I had finished my app, now with 3 I will have to re-write all of it with headaches along the way :\
 
There are apps like "2to3" or "6" that do these basic conversions for you.
 
yeah there's no reason for you to upgrade to 3
but Python3 is the future of Python (and has been for nearly a decade!!!!!!!) so any future projects should use Python3
 
And print in 3 is simply a function, like many other things. I think it's actually easier to understand as a function.
 
1:23 AM
so his problem was the print function?
 
Python2 is in extended maintenance, but is not being actively developed. Its last content update was 5 years ago.
 
Anonymous
@AaronHall not just. Nothing is working, so I'm just kicking 3 out :D
 
That's like the number one thing you learn about the diff between 2 and 3.
 
Yeah, the problem was print requiring parens.
 
the second being division
 
1:24 AM
ooh I'd forgotten about division
integer division NEVER made sense to me...
 
the third is unicode literals I think
 
If you cling to 2 instead of switching to 3, you'll be missing out on a lot. For example, os.walk is 7-20x faster in 3.5 than in previous versions.
 
anyways, from __future__ import print_function, division
stick that in your code and you'll write more cross-compatible code.
Put it right after your module-level docstring, if you have one
 
it's a personal project. He doesn't have to worry about cross-compatibility
 
I don't really understand the point of from __future__, other than being able to switch to Python 3 a little bit.
 
1:26 AM
let him run his completed project :P
 
Uuugh. I have a six-digit getrefcount value and I have no idea where these references are even supposed to exist. T-T
I'm in hell.
uuuuuugh
 
1:41 AM
Time for code review?
 
@PatrickMaupin I've been trying that, but it doesn't come back with anything I can comprehend. Thousands of them are wrapper_descriptors. weakrefs. They never get cleared and they never go away.
 
Ah. What package is doing this to you?
 
pygame.
Specifically, pygame.surfarray.pixels2d.
It's a documented leak, but the thread I saw said it was patched out in 2011.
I am certain that my version of pygame is more recent than that.
 
I almost always figure these sorts of things out by staring at source code, but if that doesn't work, you'll want to use a real debugger (e.g. gdb) to record all changes to the ref count and where they were made from.
 
1:49 AM
Should len(gc.get_objects()) start at, like, ten thousand items? =_=;
I mean, if I start IDLE or something, import it, and run that code, I get 9958.
Which seems, I guess, strange and wrong.
 
I wouldn't be too perturbed by that.
 
Okay, just checking.
Even in command line, I get 3738.
I can think of places it might come from, though.
In any case, this stupid pixels2d code creates references that can't be cleared. Which is a big problem because the loop it's in causes it to haemorrhage at about 5Mb/sec. I am not sure there's an alternative.
 
$ python3
Python 3.4.0 (default, Jun 19 2015, 14:18:46)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sum(len(dir(x)) for x in sys.modules.values()))
2103
That's just the directly visible ones on startup ^^^
 
Aa, I see.
Oh, duh, right. The problem is that the refcount increases on the surface I'm viewing, but I have no access to what those objects (?) might be.
I feel like Surface.get_view() creates some temporary object or attribute within itself and puts it somewhere, then forgets about it forever, but still references it somewhere.
So it's not "garbage," but it never gets used for anything, either.
 
Sounds reasonable.
(Not reasonable behavior, but a reasonable assumption.)
 
2:01 AM
(I figured. :y)
If it was one thing, I wouldn't care except as a matter of curiousity.
But there end up being millions of them after a few minutes with a loop active.
And they're all (probably) clones of some bitmap array view, so they're pretty big.
getrefcount tells me how many references there are, but there's no way to audit any of them. gc can't find a thing.
 
Is there a separate C level list? If not, then maybe something like valgrind could help.
Anyway (on a complete tangent) I realized I was overcounting directly accessible objects, because some of the show up in multiple modules.
>>> import sys
>>> objs = set()
>>> for m in sys.modules.values():
...     objs.update(id(x) for x in vars(m).values())
...
>>> len(objs)
1326
Still, that's a lot of directly accessible objects just for firing up the bare interpreter.
 
2:42 AM
I think there's a problem with people extending Python with C and C++ but not knowing how to decrement refcounts and garbage collect.
either that or it's a bug in Python's implementation.
The flexibility of print() in PY3: for i in range(1000): print(end='.', flush=True); time.sleep(0.01)
Why is Python 3 better than Python 2? Start reading here: https://docs.python.org/3/whatsnew/index.html
 
Maybe a stupid question, but: Does a stopped thread take any resources?
Say I have one part of my program that starts 20 threads, then stops them. Then another part of my program starts 40 threads to do something else
Will the stopped 20 threads be of any detriment? Or can I effectively just assume they're "reset"
 
2:58 AM
@AaronHall There's this thread I saw where it was solved, but I don't know what its deal is. It sure isn't fixed for me. -_-
 
I think it's a bug that's easy to introduce and hard to keep out.
they need a test (or tests) that positively identify that they've crushed it.
@AmagicalFishy depends on what you mean by "stopped"
a while loop that passes isn't "stopped"
time.sleep() effectively idles the thread though.
 
the thread itself is stopped (while loop completed, queue.join() called)
it's no longer in use
i'm manually calling del on them, just because I've never used threads before and I'm treating it like an old man treats a computer
 
hmmm... do a perf test
 
but is that necessary?
 
oh you mean thread.join?
 
3:04 AM
not thread.join, but queue.join (in Queue.Queue())
should I also be calling thread.join()?
 
...the fix for this was apparently made after pygame 1.9.2pre came out. There's a package called 1.9.1, that's in the ftp, and it's a year older (by modification date), but why is the version number lower? =_=;
 
3:34 AM
Anybody here use landscape.io? I think I tried to check it out a few months ago, with no apparent success, and they just now started randomly making comments on my github repo.
"Errors" -- I don't think that word means what they think it means
 
3:45 AM
Ooh yeah that's the opposite of an error
though doing the whole arg=None, if arg is None: arg=[0] is probably a good idea anyway.
 
@AdamSmith Actually, the first one is effectively a global counter in a cheesy example file. Wouldn't want complicated class structures to get in the way of teaching simple stuff.
And the others -- well that would slow things down. Many of my users gush about how fast it is, and I don't feel compelled to take steps to fix that.
 
4:02 AM
cbg all
 
cbg, JGreenwell. But isn't it past your bedtime? (It's approaching mine...)
 
working on research project so bedtimes are negotiable
 
Ah.
Well, I'm recovering from a cold, so I think I'm not going to negotiate too hard on mine. :-)
In fact, I think I'm off to bed now. Rhubarb for all.
 
Good night and feel better Patrick
 
4:53 AM
Well, I'm out. Rhubarb, all.
 
And a rhubarb to you.
 
5:08 AM
Anyone want to take a gander at this?
 
5:33 AM
Nooooo, +1 declined flag
 
 
2 hours later…
7:16 AM
hey @vaultah! you around?
 
Yes
 
alright, let's hash this out - I'm starting to feel very stupid :P
so in IPython, urllib is not part of the namespace, though urllib and urllib.parse and a few others are in sys.modules
now, I import urllib, and automatically, urllib.parse works
 
cabbage
 
cbg @PM2Ring
 
@inspectorG4dget :gets popcorn: :) It's an interesting problem.
 
7:19 AM
Here's a little MWE:
$ ipython
Python 3.4.2 (default, Nov 25 2014, 00:17:56)
Type "copyright", "credits" or "license" for more information.

IPython 2.3.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: urllib
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
 
Is there an SE site like CR but to review the program itself rather than its code?
 
unsure, @TigerhawkT3
so @vaultah, have I missed something in what you said?
 
@TigerhawkT3 I guess it'd be ok on Programmers if you want to discuss algorithm / implementation strategy. But you will need to ask a specific question.
 
I understand that if I import urllib.parse, then there exists an object called urllib with a parse attribute, but that's not what I'm doing here
 
You need the parent module object (urllib) to be in the namespace if you want to access its submodules. In addition to that, submodules of that module must be loaded (imported).
 
7:23 AM
I was hoping more for something along the lines of actual use. My sliding tile puzzle app is looking pretty good, but outside feedback would be helpful.
 
In [2]: sys.modules['urllib.parse']
Out[2]: <module 'urllib.parse' from '/usr/local/lib/python3.6/urllib/parse.py'>

In [3]: sys.modules['urllib']
Out[3]: <module 'urllib' from '/usr/local/lib/python3.6/urllib/__init__.py'>

In [4]: sys.modules['urllib'].parse
Out[4]: <module 'urllib.parse' from '/usr/local/lib/python3.6/urllib/parse.py'>
 
I agree, but submodules of that module must be loaded (imported) seems to not be the case when I am able to call urllib.parse after having imported only urllib
ahhh! fair enough. I see what's happening there now
import urllib gives me the module object with the attribute parse, and a few others like error because they're already in sys.modules. Correct?
 
@TigerhawkT3 Possibly UX if you want advice on your interface, but I'm not very familiar with that site. But maybe you just want a couple of beta testers... :)
 
Hold on, let me check :d @inspectorG4dget
The docs vaguely say
> For example, if package spam has a submodule foo, after importing spam.foo, spam will have an attribute foo which is bound to the submodule.
 
Yeah, I was kind of thinking <strike>guinea pigs</strike> ~~crash test dummies~~ beta testers.
 
7:30 AM
@vaultah yeah, but I don't import spam.foo. Rather, I import spam and then somehow use spam.foo <- btw, this works in IPython and NOT in python itself
 
You can access attributes (submodules) of the parent module if they have already been imported somewhere else
It actually works in Python
 
Is there no strikethrough markdown?
 
---like this---
 
@TigerhawkT3: triple dashes
 
OIC
 
7:32 AM
@vaultah Incorrect:
 
@TigerhawkT3: You mentioned yesterday about creating unsolvable puzzles. I meant to respond to that, but I got side-tracked talking about Ancient Times. :) The simple way to solve that problem is to simply start the puzzle from the solved state and use a random move generator to scramble it. It's a little bit slow, but it lets you control how scrambled the starting state is, which can be helpful.
But there's a smarter way, based on parity: No legal sequence of moves can swap a single pair of (non-empty) tiles. So to create a solvable starting state simply do an even number of swaps from the solved state.
 
$ python
Python 3.4.2 (default, Nov 25 2014, 00:17:56)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.parse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'parse'
 
And now it won't let me edit... guess it only allows one.
 
@TigerhawkT3: it allows multiple edits, but there's a time limit
 
>>> 'urllib' in sys.modules
False
>>> 'urllib.request' in sys.modules
False
>>> import urllib
>>> 'urllib' in sys.modules
True
>>> 'urllib.request' in sys.modules
False
>>> import urllib.request
>>> 'urllib' in sys.modules
True
>>> 'urllib.request' in sys.modules
True
 
7:34 AM
Must be shorter than the 5min on main SO then.
 
@TigerhawkT3: See 15 puzzle
 
@inspectorG4dget something needs to import it to make it available. In that case IPython import pydoc, which imports urllib.parse
 
@PM2Ring My algorithm checks for inversions. If there is an unsolvable number of inversion, it switches the last 2.
My working theory on the unsolvable one I saw is that I had some other part of the puzzle wrong and just didn't see it because of similar-looking background pieces.
Since I added numbered labels, I have not encountered the issue anymore.
 
Ah, ok. Yeah, having an odd number of pairs of identical-looking pieces makes it tricky.
 
And then I added background rectangles to the labels so you could actually see them. >.>
 
7:37 AM
@vaultah Whoa man! all that made my brain hurty. But I finally got it. Thank you.
also, if you update your post with this information, I will accept
 
And then an hour ago I added a bit to download photos from a URL.
 
From chat.stackoverflow.com/faq#talk You have 120 seconds to edit your messages.
 
Obvious guy says: "that's two minutes"
 
0.12 kiloseconds.
 
Or a little over 3.8 microyears
 
7:41 AM
The standard unit is seconds though...
Or, if you're a Transformer, cycles.
... Are you a Transformer?
Well, do any of you cabbages want to try it? I can put it on my site; all you need is Python 3 and Pillow.
 
I've been reading a lot of Greg Egan's science fiction in recent weeks, In many of his stories the characters use a time unit called the tau. [Wiki says](https://en.wikipedia.org/wiki/Diaspora_%28novel%29#Polis_time.2C_delta.2C_and_perception) "CST defines one tau as the amount of time in which a polis citizen can experience the passage of one second of subjective time; this elastic value changes with improvements in polis hardware. At the period of the novel a polis citizen's mind can operate at a maximum speed of about eight hundred times that of a flesher's mind, so 1 tau equals approxim
 
alright guys, it's 3.45AM here. Good night all
 
Night, inspectorG4dget.
 
Night night.
 
@TigerhawkT3 That counts me out - I'm still a Python 2 Luddite. But I'm sure puzzle-meister Kevin will have a go.
 
7:53 AM
I'm still having trouble with the label backgrounds sometimes not following where they're supposed to go, which means sometimes the blank tile has a label background, or a 12 has the background of a 1 (too small).
But only sometimes.
I suspect underpants gnomes branching out their operations.
Does Tkinter sometimes give up on carrying out an operation if it's been asked to do several things in succession?
Actually, looks like it only gets messed up when I toggle them off, move tiles, then toggle them back on. /sigh
If a create_d object on a Canvas is set to HIDDEN, does it have a bbox?
And if it falls in the forest, does the GIL hear it?
 
8:15 AM
0
Q: what is a proper local remote storage mechanism in django

MiindSo I have the following procedure in my project Users register and upload a file to a django server An app on django server processes the file and yields N segments from the file that each segments is to be stored on a different storage server The storage servers are in the same domain as the ...

 
Yay, my hacky fix worked.
Before moving the bg to a new bbox, I set the label to NORMAL, then set the bg's new bbox, then put the label back to whatever state it's supposed to be.
Thanks for rubberducking for me.
 
:) You may sometimes find the .after() method handy. stackoverflow.com/a/31901206/4014959
 
I do indeed.
In my chess app, you can set the background to a gif animation.
YES IT IS A GOOD IDEA
 
8:31 AM
@TigerhawkT3 Cool!
 
hey guyes, what storage mechanism would you suggest for remote storage in django?
 
8:49 AM
@inspectorG4dget updated my answer. Let me know if I missed anything important.
 
@Miind you've linked your question already, you don't need to ask again so soon.
 
9:06 AM
Any feature suggestions for a sliding tile puzzle game?
 
Nik
@TigerhawkT3 Add an option to let the user add the image for the sliding puzzle.
 
Does it allow you to move tiles with the keyboard or do you have to use the mouse? Can it only move single tiles or can it move a row (or column) with one command? A sound effect when the tiles move would be nice, although that's a PITA to do in Tkinter, especially if you want it to be portable.
 
@Nik Currently, you can choose a specific image from a location on your local machine, or you can choose a directory and it'll grab a random choice, or you can specify an online image from a URL.
@PM2Ring Movement is with the mouse. Movement is bound to both clicking and dragging, so you can click the empty tile and then just sweep the mouse to a tile of interest to clear a path to it. It's really fast.
You can move the tiles too quickly for a sound effect to feel right, I think.
 
Nik
@TigerhawkT3 Wohoo, sounds awesome! Then, as @PM2Ring said, have more input options. Can you do voice commands, "slide [1][2]" and stuff like that. lol
 
No voice commands, no Kinect-style hand sensor, no fingerprint detection...
 
Nik
9:15 AM
@TigerhawkT3 Aww, I just wanted you to stick out from the crowd. And does the puzzle support all resolutions of images?
 
@Nik Yes, you can specify a max height and if the image's height is greater than that it'll be resized down to fit.
You can also pick how many rows or columns you want the puzzle to have, minimum 3 for each.
The most I've tried is 8. There's no additional challenge for larger grids; just takes more time.
 
Nik
@TigerhawkT3 =_= No. It's okay for super nerds, great to have those features under an advanced settings list but you do automatically detect optimal proportions and grid sizes, right? The only thing a general user would like to enter is the number of tiles.
 
What do you mean? A solver?
You enter the rows, columns, and max pixel height. The grid size isn't based on the pixel size because you might want a large image but a fast puzzle, or vice versa.
 
@TigerhawkT3 I've done it with 16 pixel x 16 pixel tiles (and maybe even smaller, on a low res screen). It's pretty tedious. :)
 
Nik
@TigerhawkT3 What I mean is, simply, suggest number of rows, columns and whetever else for a given image the user enters. People'd like that.
 
9:26 AM
@Nik Why even bother mentioning the total tile count? Rows & columns should be adequate.
 
If I just want to test features, I stick with the 3x3 or 4x4. I tested up to 8x8 (partially to see if the solvability algorithm was correct, and I think it is - I think I was just confusing similar un-numbered tiles once).
 
I guess you could have an option for wrap-around grids. I don't think I've ever seen that on a tile puzzle game; OTOH, I'm not much of a game player.
 
Basing the rows/columns on the size of the image would mean that small images are quicker. If you want, you can make a 10x10 puzzle (takes a while) with a 100x100 image, or an 800x1000 image that takes 15 seconds.
Basically, rows/columns is "how long should it take" and image size (max height) is "how big is my monitor."
I'm slightly bothered by Pillow's compression, though - it's all aliased and stuff.
 
Nik
@TigerhawkT3 Why stop at images? Do videos. VLC does it.
or how about GIFS atleast?
 
10:03 AM
 
@Nik I considered that (would be an effort but doable), but, based on the Tkinter GIF implementation I've done before, I think the performance hit would be too much to keep the snappy feel.
I also see some examples of that VLC puzzle being a jigsaw, and some of it looking like a sliding tile. Is it jigsaw by default, and sliding tile with "Black slot" checked?
 
10:43 AM
@TigerhawkT3 Do you mean Image.resize()? Which resampling filter are you using? You should probably be using BICUBIC, but if that's too slow, try BILINEAR. Disclaimer: I've never done resizing in PIL.
One trick I've sometimes used (with other image manipulation tools) is to scale the image up, apply a slight (gaussian) blur, and then scale it down to the final size. Depending on how the scaling is done you may get noticeable artifacts when using non-integer scaling factors; this may be worse when scaling up than when scaling down.
 
10:56 AM
@PM2Ring I'm using the default filter. Looks like that means "nearest." I'll try bicubic.
Wow, antialias mode is a ton better. I'll switch to that in my chess app, too. :)
 
bicubic is noticeably slower than bilinear, but it's usually worth it.
Bilinear's easy to understand: see en.wikipedia.org/wiki/Bilinear_interpolation
Bicubic's a little more complicated, but it's ultimately just a logical progression from bilinear.
I made this Mercator map (in C) using bilinear interpolation (after the Mercator transformation), however the source map (an equirectangular projection) was pre-blurred to make interpolation smoother.
 
11:22 AM
Apparently the highest quality is AA, and that's what I'm using now.
4
Q: ANTIALIAS vs BICUBIC in PIL(Python Image Library)?

xunzhangI am using PIL to resize my images, my case is to scale up the original image. I am confused about the algorithm used with `resample=ANTIALIAS'. According to the document below, ANTIALIAS seems to be the best while scaling down. I wonder In which case can BICUBIC win?(some of my test case shows...

 
count inside the class counts the number of instances, but I think the way it's coded is wrong, since you have to count them one by one not two by two ? pastie.org/10506099
I found this from Learning Python 5E
 
@TigerhawkT3 Ok. As Mark Ransom said in a comment the description in the docs is a bit too vague to tell exactly what ANTIALIAS algorithm PIL uses. And according to his answer, it's broken when upscaling. But I guess you could do an (integer) upscale with BILINEAR and then downscale with ANTIALIAS.
@direprobs Correct. That code increments the TopTest.count class attribute by 2 every time an instance is initialized.
 
His answer makes it seem like they're all bad. :P
I guess it's okay for now - this particular program only scales down, not up. I'll stick to bicubic when upscaling.
 
@PM2Ring thanks for the input on that bash question. I wasn't expecting that much input from people. Turned out to be a fun back and forth! :)
 
And it turns out my earlier test wasn't a test at all - I was seeing a high-quality image when it was below the max. Downscaling wasn't working at all because I had mis-cased the namespace. Oops.
 
11:31 AM
@PM2Ring That being said, when you create one instance, count will be = 2 and hence you created 2 instances ?!
So lets say you created 2 instances then count will be 4 !
 
But now on a real test the resizing looks nice.
 
Hey guys why exactly underscore naming convention is preferred when coding in Python?
For example "test_was_published_recently_with_old_question" this was a method name used in django testing
isn't it awful?
 
Primarily opinion-based.
 
Yes, because it's too long. @arcanesorcerer
 
Nik
@arcanesorcerer because the alternative would be camel case and that's uglier for that specific name.
 
11:39 AM
Much better: testWasPublishedRecentlyWithOldQuestion
 
@TigerhawkT3 For a nice discussion on scaling see the pamscale docs.
 
Nik
@vaultah Readability decreased by 40% or more. camelCase ise useful for smaller names with verbs and stuff like startPlay
 
@idjaw Hey, people on SO enjoy it when they get an excuse to indulge in a spot of code golf. :)
 
All I need out of scaling is for it to produce reasonable images without breaking. My uses are pretty basic.
 
Fair enough. Scaling is a messy subject. You'd expect something so basic to image processing to be cut & dried. But it isn't.
 
11:48 AM
It's only "basic" in the sense that it's important. An discussion of 2x2 matrices or video pins or whatever will lose me so fast I'll break the lightspeed barrier.
 
completely don't know why we use global here, since the below work perfectly.
>>> a = ''
>>> l = ' '
>>> if l.strip() != '':
	a = l.strip()


>>> a
''
>>> l = ' jh'
>>> if l.strip() != '':
	a = l.strip()


>>> a
'jh'
>>>
 
What is that logic even trying to do? :p
 
oh, think if is not a function.
that's why it modifies the previously declared var a
am i correct?
 
Everything's in the same scope there...
 
That's the basic "opened an interpreter" scope.
That's basically "if there's only whitespace, don't touch it. Otherwise, strip() it."
 
11:52 AM
@Nik Python's PEP008 recommends using CamelCase for class names; methods and attributes should use lowercase with words separated by underscores.
 
Also if l.strip() != '' - you don't need the comparison... just if l.strip() is fine...
And since it's either true or falsey, you can kind of cheat: a = l.strip() or a
 
I would save it to a temporary variable so you don't have to carry out the strip() twice.
Or you can get a hole in one.
 
What Jon & TigerhawkT3 said.
 
@JonClements ya, this is simple..
 
11:59 AM
but pycharm always complain that local variable a is not used any more.
 
@AvinashRaj hardly to tell whether that's something pycharm is misunderstand - don't see a reason why it should - but I have a feeling your code isn't the full context of what you're actually doing...
 
That's Pycharm's problem.
 
12:11 PM
"Glad I could be helpful, If you feel the answer helped you, I would like to request you to accept the answer (by clicking on the tick mark on the left side of the answer), it would be helpful for the community." -comment on an answer to a closed dup
 
As I said the other day, it might be worth considering blocking accepts on closed dupes questions.
But especially on dupes, to encourage people to look for good dupe targets rather than to write answers.
 
If that was implemented, would it also imply that accepts (and upvotes) would be revoked if given before closed?
 
It's just funny, is all. Maybe some jobs give raises based on SO rep or something?
 
@idjaw I don't think that'd be fair, since the OP probably doesn't understand why their question is close-worthy. And blocking votes is a bad idea.
Dupe questions are a special category - they aren't automatically bad (like other closed questions). The question might be fantastic, and the only bad thing the OP's done is they've failed to check that their question is a dupe. And that's not always easy when you're a newbie, since you may not know the right terminology.
Closed dupe questions are actually valuable, since they act as alternate portals to the dupe target. The problem is the answers that get submitted to dupes before the question is closed, since we'd really like all the answers to be gathered into one place.
We want all the answers to compete with each other for votes (and the magical green tick), we don't want all these separate pools of answers that don't get compared with each other. And we don't want future readers having to check a zillion pages to find the best answer to their question.
 
12:27 PM
Yes, agreed about it not being fair. I find that if one managed to use the right keywords, eventually they will find a form of their answer on SO and technically that means their question would be a dupe. With a strict policy in place, this would then end up actually discouraging people from even wanting to contribute, since a big part of the attraction is the gamification aspect in unlocking and receiving "awards".
And to your point, depending on how new the individual is to the technology they are requiring help on, it is always a matter of the keywords, or if there happens to be something directly related to their problem, they are not familiar enough to actually make the link with how it can be applied to their code.
it's an interesting/tough thing to solve that for now leaving it as is, is the best option.
imo
 
And a big part of the lumber industry is getting lumber, but that doesn't mean "clear-cut the planet in a week."
And a big part of being a manager is having people to manage, but that doesn't mean "hire people until the company folds under the weight of the payroll."
 
We don't want to scare people off from asking questions. It would be nice if they actually followed the recommendations in the help center, though. But I think we can afford to encourage / pressure answer-writers into looking for dupe targets before they just plow ahead into writing an answer.
 
Encourage with... banana stickers?
 
12:44 PM
Yes, but the encourage part is what is a bit tough, because when it comes to the reward part, majority of people will always go to what will give them the green check mark. Also, yes, you don't want to also stop people from asking questions on the site either. Like @PM2Ring mentioned, it would just be a great start if the guidelines for asking a question were followed better.
on that note, I must depart. Take care! rbrb for all.
 
See ya, idjaw.
 
Rbrb idjaw.
 
@TigerhawkT3 Maybe. I was thinking actual rep. Surely finding a decent dupe target is worth at least as much as a suggested edit (i.e., 2 points).
 
¯\_(ツ)_/¯
 
@PM2Ring how would that work?
(do all the people closing as dupe get +2, does it still apply to the dupe hammer - or would that be a case like suggested edits - you only get +2 until you reach...?)
 
12:49 PM
Apparently one of the problems with rewarding anything for that sort of action is that it would be abused, viz, suggested edits.
 
And if people want to get rep/badges - you'll get the robo-reviewers piling on and stuff being closed completely unnecessarily
 
Or the robo-answerers piling on and stuff being answered completely unnecessarily.
 
@JonClements The person who finds the accepted dupe target gets the points if the majority of close voters accept it. Low rep users could suggest a dupe target (as they can now), even though they don't have the ability to vote.
 
If it gets an answer while it remains open in lieu of someone finding a proper dupe - that's probably the lesser evil than having it closed inappropriately, then having to get it re-opened.
 
I don't believe my suggestion will lead to an increase in premature closing. Ideally, people will scramble to find the best dupe target, so that their target is the one that the close voters accept.
 
12:57 PM
"We can't do that because it'll be abused" is kind of a cop-out because it applies to everything.
 
00:00 - 13:0013:00 - 00:00

« first day (1835 days earlier)      last day (3107 days later) »