« first day (1609 days earlier)      last day (3564 days later) » 

02:22
cbg
don't know what he was actually asking? stackoverflow.com/questions/29023482/…
02:43
cbg
02:53
@AnttiHaapala, I tried my solution on both 2.7.3/6 and an online ide aswell all result in same error. Have updated my question http://stackoverflow.com/questions/28985724/python-ssl-error-voilation-of-protocols
Not sure how you could connect yesterday. Could anyone suggest some other way to do this task...
 
1 hour later…
04:18
Newbie question here. I have a nested for loop, and it seems like list comprehensions are a concise way to do those. But I don't need the final list. What's the advised way to do this?
For example:
for i in x:
    for j in y:
        doSomething(i, j)
versus
[doSomething(i, j) for i in x for j in y]
04:34
hi. what is the best plugin for pdf to text im using python. thanks
 
1 hour later…
05:36
@leekaiinthesky Looks like itertools.product might be the best way.
Cbg
@leekaiinthesky bingo for the general case
06:07
Ok, thanks @AnttiHaapala!
06:29
@leekaiinthesky sorry I did not parse your name correctly :D
This should log any error right?
sys.stderr = open('error.log', 'a')
sys.stderr.close()
it does not throw an error, but it also does not log the errors: /
nevermind i restarted and that fixed it.
06:48
Cbg
@Death_Dealer bad sign
Nice :d
0
Q: java.sequence processing operators?

user471011I know that the operators &&, << is processed from left to right and ?: - rigth to left. So, my question: where i can find information about this? I very need find information about this in official docs, but i cant find...

I NAA'd a UTFG answer that was just a link to google, wrote my own; the UTFG + 2 and mine -1 :D
07:06
isn't it the user whose answer got deleted who downvoted?
@DSM FRED COLON!? Damn, I was shooting for Vimes.
Bahahahaha I assigned the names by the way innocently whistles
Yeah, so I see :)
I think you and Intrepid make a great team
Yeah, at least I'm not nobby, so that's good :)
07:16
To be fair, Jon helped :p
At least I'm the same species as you
Some of these are pretty good associations though, I like it
Except I thought it was Mustrum Ridcully
Actually can't believe Terry Pratchett died. This isn't a good omen.
Possibly. Fix it if you would be so kind. And make sure the names don't actually swap >_>
Damn. changes himself back and adds all the other people back in
Add The to Librarian and Havelock to Vetinari as well, for anality's sake
What's weird is that I was reading a TP book last night
I was considering rereading the Watch series. Definitely doing it now.
Yeah they're the best ones
Along with Carpe Jugulum
07:23
We actually assigned these names ages ago, not as a reaction to his passing.
And that one about the Clacks
Oh, okay :)
Moist von Lipwig ones are good also.
You've been Colon for months
Wow, and I didn't even know.
Yeah that's a Clacks one; I haven't read any others
There's another Lipwig one where he takes over the bank. Very good.
My favourite bit in that book was where TP describes the businesspeople's inability to even understand how the clacks worked, and how the engineers would have to talk to them as though they were children
07:27
Umm, Cheery Littlebottom?
You're always so happy...
And you've got such a lit..never mind.
Fine. Some of them aren't ideal. If you want to propose corrections, feel free.
@61612 you can be Granny Weatherwax
07:29
Yeah but then who are the other witches? :P
mhhm
@Jerry nope, I had -1 there :d
the deleted answer had +2 -0 :D
what I mean is, don't you think it's that user who downvoted your answer?
ahh :D
who knows, maybe :d
lost 20 rep there
had he had +3 then would have kept the rep
@Ffisegydd tilaprimera should be cheery, because she always is
I mean I haven't read a single Discworld book and the description of the character on discworld.wikia.com is rather strange
07:34
@61612 don't overthink it. Be more like Cheery!
he's active and has been around for a while, plus the downvote occurred a little after his answer got deleted, so I would say yes
Please don't kill me :)
@61612 same for me. Though I haven't been reading much
07:52
Am I supposed to see 404 error when opening sopython.com/wiki/Is_KevinScript_real??
It redirects from /wiki/Is_KevinScript_real?/ to /wiki/Is_KevinScript_real/?/
Is a bug.
Known?
Yeah on GH Issue tracker
:(
I'll take a look at it at lunch today, looking at some other issues also.
08:36
What are some better ways to login and download some content from a website. I'm stuck at stackoverflow.com/questions/28985724/… and looking to try some different approach
08:53
Hi, i was just wondering how to do a lookup in generators. today i came up with a issue. i have list id x id's which should get excluded from the results. i have created to generator as the size of the list is big but using generator how can i lookup a x id weather is exits or not
example: k = (i for i in xrange(1000) if i%2 == 0) ; if 999 in next(k):
print "yes" else "NO"
@sush that's not how generators work
Just 999 in range(0, 1000,2)
I know its a iterators
You haven't created an iterator object called k, you've run the whole generator in the first statement and k is the list output of the generator
(Someone correct me because I'm a noob)
@sush you're a java developer?
java and python (indeterminate) developer
08:58
Or any(x == 999 for x in k)
I'd stick with only saying Java for now, I know how generators work and wouldn't mention my Python abilities to anyone yet :)
Or 999 in k
Eh
In [24]: any(x == 999 for x in k)
Out[24]: False

In [25]: any(x == 998 for x in k)
Out[25]: False
Try to reinitialize the generator
got it :)
09:02
Although I'd personally use the range-based solution, it is very efficient in Python3
and 999 in xrange(0, 1000, 2) in Python 2
@sush this will help you out with generator comprehensions: wiki.python.org/moin/Generators. They're not the same as iterator objects in Java.
@RobertGrant Thank you for the link
@61612 @61612 i have to check the value while iterating the mysql results.
Ahh, then 999 in iterable_result should work too
09:29
Cabbage!
09:40
@poke Cabbage :-)
whoaa
itemgetter and attrgetter support *args
this changed my world.
For the stream work?
so you can do
>>> operator.itemgetter(1, 2)([1,2,3,4])
(2, 3)
office cbg
@MartijnPieters cbg
Does anyone have some open source website that they wish existed, and that I could write as a way to learn Pyramid?
Probably not, who wants an open source website
Shut up Rob, let them speak
You should learn Flask and help with sopython :P
Yeah but @AnttiHaapala convinced me to hate Flask and all who sail her
;_;
Come on Bob. You know you can't trust the Finnish, they're tricksy.
10:11
Actually that's a good idea, maybe I should do that as well though. Then I'd be getting experience on a good codebase, and also learning something else from scratch
Some sort of github cloning required?
You probably wanna fork it
sopython.com/docs/index.html is the installation docs
Fork, not clone
Yeah
It's all Python 3.4 btw.
And once you're happy with it we have lots of Issues here github.com/sopython/sopython-site/issues
I'm actually doing some at the moment.
10:17
Those are nice installation instructions
Why not Python 3.5? :p
Hey you guys, does anybody of you know where I can find an example of an update view in django ( cbv and please not too basic ). I didn't find anything with Google that suited me. I learn way better by example and I am worst at reading docs :/
10:33
@61612 Because Python 3.5 isn’t stable yet?
10:48
@IbrahimApachi the Django docs are excellent; use them. They go step by step.
Hi all, I have an incorrectly marked-as-dupe, from what I can tell. Would someone mind checking and casting a re-open you agree? stackoverflow.com/questions/29029499/…
Yeah it's more complex than the duper thought, re-opened.
cheers!
@RobertGrant it is ok, you can use flask too :D actually there is nothing wrong with flask, maybe you should use it only, as it is a perfect fit for absolutely everything</reverse-psychology>
user559633
11:38
good morning you wonderful, strange people
people are being afraid to learn regex.
Spot on, as always.
12:00
List comprehensions are surprisingly easy to implement. Why doesn't every language have them?
user559633
aren't list comprehensions just for loops in a different syntax?
Yeah I actually don't love the syntax
@tristan More or less. There are some different scoping rules, I believe
for loop with an if statement, or something
>>> for i in range(10):
...     pass
...
>>> print(i)
9
>>> _ = [j for j in range(10)]
>>> j
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'j' is not defined
In 3.x, i leaks and j doesn't
12:06
for(int i = 0; i < 10; i++) if(i % 2 == 0) list.add(i); // or something
The only thing is that doesn't give you an automatic list, which is cool...in languages that do
so maybe you might then characterize it as "for loop appending an expression to a list with an optional conditional and a del at the end for the looping variable"
Yeah...I guess I'd go into that much detail if I were, you know, asked at a party or something
Oh, who am I kidding? I don't go to parties!
In any case, I can't force list comps in KS to be simple syntactic sugar for a for loop, because a list comp is an expression, and for is a statement, and the latter has more restrictions regarding where it's allowed to be in the abstract syntax tree
@Kevin you can add more loops and if statements.
you are not limited to one loop and one if.
Yeah until (or if) I ever do what you're doing, I won't understand expression vs statement to the point where I don't have to work it out each time
All I get is an expression something that returns something, but that's probably wrong part/all of the time
@Kevin why don't you make your for loops expressions? Is that possible?
12:11
List comps can have more than one if? Today I learned :-)
>>> [x for x in range(10) if x % 2 if x > 4]
[5, 7, 9]
and would already work?
@RobertGrant It's possible, but for conceptual purposes, all expressions must have a final value. if I do x = for(item in seq){do_thing();}, what should the value of x be?
(One possible answer: "True if the loop terminated normally, False if a break was encountered")
Yeah, I was wondering that :)
The first thing, I didn't even get to that point
This would also complicate the REPL somewhat, if I wanted to keep True from being printed each time the user writes a for loop.
Maybe it could return a list of results if you yield each result from inside the for loop
For yield read anything that means anything like that
Surrender?
Cropdensity?
12:17
heh.
That is one possible design.
user559633
@Kevin interesting, thanks
user559633
afk commuting
This soup is truly, truly awful.
May it remind you fondly of all the better soups you have had.
Of course that doesn't take into account normal stuff like for 1..10 call_something() or whatever
But maybe if you don't yield that it just chucks a None in the resulting list
And I'm probably overspecialising your for loop
Although you could then do if(for ......) and it'd only run the if statement body if the for loop had any iterations. You can take that to the bank.
12:25
When are we gonna see BobScript?
Interesting ideas, but they don't quite hurdle over the minus 100 points barrier
why negative step is not working after slicing?
>>> a = 'python'
>>> a[0:6:1]
'python'
>>> a[0:6:-1]
''
Sometimes I do think of turning everything into an expression... It would be a giant change.
@Chillar because you're going from 0 to 6 backwards.
As opposed to from 6 to 0 backwards
In [12]: s = 'python'

In [13]: s[6:0:-1]
Out[13]: 'nohty'
@KevinLisp
I think that's basically why I think the expression thing is a good idea - Clojure :)
One nice thing about returning the list is you get a comprehension but using your language's normal syntax
Almost. Sort of.
odds = for(i in range(10)): if i % 2: yield i
But yeah, that probably isn't worth all the fuss
12:31
@Ffisegydd but this works?
>>> a[::-1]
'nohtyp'
I think I promised poke that I would write a Lisp-like language next.
Probably I will be amazed at the elegance etc etc
But I'm quite attached to javascripty syntax at the moment, so that must wait.
It's easy, just move the first paren to before the function name and you're done :)
I definitely found when I was doing a bit of Clojure that it felt like the "correct" way to do things.
I suspect something more LISPy would have a easier implementation, because there's less distinction between constructing the ASP and evaluating it.
The disadvantage seemed to be that you only write the code to do exactly what you want it to, and if you come to it later and want to change it then you might need to rewrite the whole section of code. But that might still be quicker to do in clojure, and also might just be because I was new at it
Yeah it is the AST
Where Clojure solves hard problems is in things like STM
I'm also wondering if there's a nice way to expose the KS AST to the user, so they can modify the program using the program.
12:36
I think you should leave that for lisp as well :)
like, function_I_am_inside.append(Expression("print", Literal("Hi there")))
The principal obstacle there being, the AST is composed of Python objects, not KS objects
But how would you do that in a useful way that isn't quicker to just write print("Hi there") ?
This is partly based on my own lack of understanding of lisp macros
I can't think of any practical use for ast manipulation right now, but I bet there are good ones.
@ChillarAnand For that reason, if you specify a negative stride, but omit either the first or second index, Python defaults the missing value to whatever makes sense in the circumstances: the start index to the end of the string, and the end index to the beginning of the string. I know, it can make your head ache thinking about it, but Python knows what it's doing.
@Kevin stackoverflow.com/questions/267862/… - this is awesome, but I still don't 100% understand it. And neatly ties our whole conversation together, which is nice
Well, the top answer I mean
12:51
I know I should somehow make use of strptime, but I would like someone to show me how. -> I know the solution but would like someone to write it for me as I'm bloody lazy.
Augh, I can't remember the word for "not requiring anything from external sources". List.__repr__ can be implemented within KS itself without needing to invoke any Python-specific code, so I want to save it in intialize_advective_builtins.k
Where "adjective" is the word I forget.
Local? No. Pure? No. Pretty sure there's a perfect term for this.
native?
Mmmm, yes. That's it :-)
Fizzy Good - Registered Scienceman, Pythonista, KevinScript Consultant
Now there are two KS consultants in the world. While we're both here, let's agree to fix our prices at one million dollars a day or above.
12:55
Isn't fixing prices illegal Yeah okay sure.
Can't believe I don't make the list. How many suggestions have I made that don't get implemented for good reason? Yeah. Loads.
Have you said "I am a KevinScript Consultant"? I'm pretty sure that's how you get the title, just like every other consultant in the world.
This is true.
You're definitely qualified. Our "how shall we let the user override the behavior of dunder methods in already existing classes" conversation influenced my final decision regarding how I wanted to implement it.
(There is now an override_method(type, name, func) builtin)
Oh, cool :)
Although I'm not sure I was rooting for that, but that's okay. I generally lead by counterexample.
>>> [1, 2, [3, 4, []]];
[1, 2, [3, 4, []]]
Finally! Recursive repr is a pain the butt.
13:04
@Kevin Now insert a self-reference.
>>> x = [1,2,3];
>>> x.append(x);
>>> x;
Couldn't call function on line (11, 254)
#snip - fifty lines
Couldn't call function on line (11, 254)
Couldn't call function on line None
maximum recursion depth exceeded in cmp
:-(
i just installed pyPdf through pip. But it failed to import. I'm running 2.7 version.
Hehe
@Kevin more work to do! :-P
I can fix that, but I have to invent dictionaries first.
13:05
Hint: track object ids in a memo set.
$ sudo pip install pypdf2
Downloading/unpacking pypdf2
  Downloading PyPDF2-1.24.tar.gz (59kB): 59kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pypdf2/setup.py) egg_info for package pypdf2

Installing collected packages: pypdf2
  Running setup.py install for pypdf2

Successfully installed pypdf2
Cleaning up...
/Desktop$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> from pyPdf import PdfFileReader
I miss using python's data structures :\ they're so well designed
true
More importantly, I have to update my README so all the examples don't use the stupid print seq.at(0); print seq.at(1); that was previously necessary to inspect lists.
Kevin what kind of stuff do you like to program? I've always kinda wondered
13:14
Applications that make my life easier, math solvers or automation apps that let me cheat at video games, fractal image generation, geometric pattern GIFs, simple games or simulations (although I'm bad at them)...
Chiefly desktop programs, although I want to learn more javascript so I can share my work without the user downloading anything
Number of functions in my Python program has grown and I'm starting to split them into separate files. In every file, I'm re-importing all the modules needed to run that function, even if such a reference has been made in the main file. Is this the correct path or is there a convention to handle these sorts of issues?
Um, experimental implementations of interesting math I find on Wikipedia. Ex. My "stuff not to delete" directory contains, among other things, implementations of Church numeral encoding, polynomial curve fitting, finding the intersection of two lines, LR parsers, a truly terrible 3d rendering engine, and coroutines before I knew that coroutines were a thing
I'd probably replace my CV with all that, given the option
@RomanLuštrik Yeah, I usually import everything I need in a file, even if I think the file is being imported by something that already imported the things I need.
@Kevin The biggest issue I see is that my functions are using some constants being defined in the main file. I would not like to duplicate those for obvious reasons. :)
13:22
Hi @RobertGrant r u remember me :)
Although take care not to import things that you really don't need. For example, suppose Widget.py contains the Widget class, which has a spin method. And a.py contains a function like def do_thing(x): x.spin(). It's not necessary to import Widget in a.py, even though we expect do_thing to operate on widgets.
It's fine if main.py imports Widget and a and does a.do_thing(Widget())
@Kevin that's the main reason web applications are so cool imo
@RobertGrant Aw shucks :-)
I should learn more JS.
user559633
i should buy a boat
user559633
13:27
@thefourtheye: see, you'll do fine with sending in that CV :-P
@RomanLuštrik I don't use constants much myself, but I think it's safe to do import myMainFile from your function modules, if you want to access myMainFile.someConstant. Python has pretty good circular dependency resolution.
user559633
my favorite meme :3
@thefourtheye: thanks, fixed.
@MartijnPieters I am preparing my CV and ll be sending it, but anyone stared long enough would have spotted that ;)
13:28
@thefourtheye You'd be surprised..
I think my favorite meme is "[X intensifies]"
My favourite is "stahp"
I want to write an X intensifies generator website, which accepts an image and text, and outputs the desired wildly shaking gif.
@Kevin The constant is in the main file, and is being used by a function I'm importing into the main file. I run simulations, where a constant is actually the simulation parameter.
The most annoying thing about is that PyCharm is claiming that I'm missing a variable definition. Sigh
@Kevin you have a language to build it in. Build it, I say!
13:32
I would need, like, gaussian filters or some shiz in order to get the motion blur working right. I don't even know how to do that in a regular language.
@MartijnPieters sweet!
@RobertGrant I know! Glad a bro understands this shit, dude!
That question has some merit if the OP perceives it as a gendered term. "What, so all programmers must necessarily be dudes?" But they actually appear to be more annoyed by the informal tone than the arguably sexist implication.
(I recognize that "dude" can be gender neutral in the proper context, but that's not necessarily the first meaning that every reader will come up with)
Okay people... After a loooooooong time, I am going to leave the chat for some time.
rbrb
♫ I'm a dude, he's a dude, she's a dude, we're all dudes! ♫
(but then we're getting into the gray area regarding how careful we should be to avoid offending somebody. Clearly we should ignore crackpots that find "the" sexist, so where's the line?)
This concludes my rant.
I mean...I don't know
not sure if updating the database on observeChange callbacks is secure or scalable...
13:47
@Kevin It would seem a way would be to store my constants in yet another file, and have that imported for every other file the constants are being used in. stackoverflow.com/questions/15959534/…
Much better Good Burger skit ^
I know everybody's like "watch the Big Lebowski", but I think I'll always associate "dude" with Good Burger.
The only part of Good Burger I remember is the "I know some of these words" line, which I reference occasionally. Nobody ever notices.
I remember All That, though. The giant ear of corn. The facts segment with what's her name. Kenan speaking French in a bathtub.
Kind of an SNL lite show. B+ would watch during childhood again.

« first day (1609 days earlier)      last day (3564 days later) »