« first day (1661 days earlier)      last day (3286 days later) » 

2:18 AM
 
cbg
 
 
1 hour later…
3:19 AM
Cbg
 
F4z
words = "Sweety pie"
position4 = words.rfind("typ")

why does position 4 return -1?
 
Because "typ" isn't in words?
 
F4z
ooh ok
so basically an index error
 
3:37 AM
@F4z If you use words.rindex("typ") instead, you'll get a helpful exception rather than that rather idiotic -1 :-)
 
F4z
4:09 AM
@ZeroPiraeus Thanks!
 
how is -1 one idiotic ... its pretty standard return for that type of function across most languages ... certainly pythons ancestors
 
(Most of) Those languages don't have support for negative array indexes
 
@JoranBeasley It's using a magic value to signal an exceptional circumstance.
 
meh its not all that magical ... its really not a huge leap of logic even if no one tells you and you dont read the docs
in this case F4z was probably less than a minute from same conclusion
 
You have to know that str.find() can return a value (of the expected type, even) in the case that it doesn't find something. Worse, -1 is a truthy value, so if s.find(x): ... fails confusingly. The way we deal with exceptional circumstances in Python is to raise exceptions: str.find() is an abomination that should be taken out and shot.
 
4:54 AM
>>> first_four = "alice bob carol dave"
>>> for girl in ["alice", "carol", "ellen"]:
...     for boy in ["bob", "dave", "fred"]:
...         if runners.find(boy) < runners.find(girl):
...              print(boy, "beat", girl)
...         else:
...              print(girl, "beat", boy)
...
alice beat bob
alice beat dave
fred beat alice  # !!!
bob beat carol
carol beat dave
fred beat carol  # !!!
bob beat ellen
dave beat ellen
fred beat ellen  # ???
 
Totally agreed. -1 return has no place in the language.
What's the noun form of "Pythonic"?
because it's the opposite of that.
 
Er ... Pythonicity? ;-)
 
hehe :D
 
Yeah, probably. Sounds better than "Pythonicness" anyway..
 
actually I protest, it should be Pythic and Pythicity
cf electron
cabbage anyway
 
5:04 AM
Oh, yes, I like Pythic :-)
 
cbg :)
 
cbg :-)
 
was "just" (=read yesterday) discussing with my friend
that the biggest problem of python 3 or python anyhow
is the damned development model :D
that's why nothing ever gets fixed, it is the cathedral
a person finds a bug, he'll need to post a patch to the bug tracker
well the patch won't merge anymore, "oh well fix this patch 2 years later"
"oh ok... so maybe I will have time to try it next year"
of course python devs need to use Hg despite it being damned slow
because hey, it is python!
 
There are advantages and disadvantages to being conservative.
 
I think that's more a problem of lack of bandwidth among core devs
 
5:07 AM
in this case there are none
the problem of bandwidth is that 99 % of the bandwidth will be lost in the sucky bugtracker and trying to merge the patches from there
 
I think it's unfortunate that there was so much whining about the backwards-incompatible changes in 3.x, though. The chance to get crappy decisions reversed in 4.0 is going to be slight, I think.
 
c.f. pull requests and continuous integration testing
python 3 is really slowing donw, there are lots of bugs in documentation but...
 
considering how much we're still struggling with 3 adoption, 4.0 is a pipe dream right now
 
I wouldn't talk about 4.0 at all
 
I believe there was a move to improve the workflow, specifically by shifting to github in fact.
 
5:09 AM
what they need to do is to start doing git too and proper tools, should have official 2 way merges between git and hg etc...
 
Stalled because GH is a closed ecosystem IIRC.
 
yeah exactly
who forces to use GH just use Git
you can then have that data in GH too
 
Yeah, but they wanted to use the GH issue tracker.
 
ppl can send the pull requests from gh
that'd be awesome
for example there are lots of docubugs
known for 8 years
 
I much prefer hg to git, but there's no denying GH is better than bitbucket :-(
 
5:10 AM
no one fixes them "bc it'd be so little for so much work"
have you tried hg vs git on cpython code
 
If GH started supporting hg I'd jump ship immediately.
 
the hg is so damn slow makes me cry
 
Admittedly I don't use it on very large / long-lived codebases.
 
if you think 10 files is large, you do not qualify to compare the 2
also there are some concept failures in Hg
git is designed to work for the linux model of development
where there are core committers and subsystem maintainers and people send pull requests to each other etc...
exactly the same as there'd be in Python with bdfl, subsystem maintainers (there are area experts) etc.
 
I have been bitten by having a co-worker who was clever enough to get into trouble with git and not clever enough to get out of it.
Mucking about with history etc.
 
5:14 AM
haha
another thing is, git merge's are damn clever
some ppl do these rebase shits etc...
I don't care, I just merge merge merge
 
Yeah. winces at the memory
 
Yeah, git merging is stellar. I find git a lot like C++ in spirit; it makes a lot of really hard things possible, but many "simple" things can bite you
armin's blogs usually are
 
armin's blogs are usually damn whiney
:d
 
lol
 
5:18 AM
Armin is very very clever, and often fails to realise that > 90% of people aren't.
 
FOYSDC must be the initialism of the day :d
I think it goes like: armin is very clever and thinks that bc he's right 90 % of time then he's also right the 10 % of time :D
 
FOYSDC?
 
^
 
F*** off you stinky dutch cheese :D
 
Hahaha!
 
5:20 AM
:o lol, what's the context for that one?
 
That wouldn't be S— K— would it?
 
yeah
would
I had 500 notifs in github :d
 
Lovely :-)
 
I bet he's reading this now
 
5:22 AM
he'd even spam me in some armin's repos
 
Hi. When you not use the general Python implementation and opt for IronPython or Jython
 
sure
hello you there?
@MoonOwlPrince never anymore :d
 
I personally don't mind feeding the troll, but some people here do
 
@AnttiHaapala why is it so
 
@MoonOwlPrince only if you have specific requirements for interacting with existing java or CLR codebases, I'd say
 
5:24 AM
@MoonOwlPrince the only time I did use jython
the problem was I didn't get much support from IDE, the code was impossible to debug, and so on...
I ended up rewriting it in java
found 10 bugs in the process :D
 
and you know
 
I like Python because it is very easy to write unit tests in it BUT IDE support is not too good at the moment
 
I wrote it in Jython because it'd be more productive
 
The cost
of time
 
5:27 AM
there are many truths...
one truth is that java unittests are faster than python unittests :D
 
@MoonOwlPrince What do you find lacking in IDE support? Pycharm tends to work pretty well for me.
 
pycharm works well
 
Well, I am kind of used to Visual Studio and thought I need to break out of my .NET shell
 
though, again ppl who code java say that eclipse is abysmal
 
eclipse is bloated and horrendous
 
5:29 AM
and I find eclipse much better for java than pycharm for python :D
 
then again, I haven't used it in years
 
@tzaman probably even more bloated
 
but my memories of it are all about taking forever doing the simplest things
 
the thing is what I am doing is I am writing PDE software on it
 
I think I will prototype in Python
 
5:30 AM
do the whole app in python
do not prototype in any other languages :D
I do not believe in the prototyping anymore
 
It is just for the presentation and then if there is need to port the code
 
@tzaman "Beating that in mind, you might say Eclipse is less of an IDE and more of a technology platform and open source community."
 
The clients though will have to be iOS, Android, Windows Phone and Blackberry clients
 
so I do not really have a choice either ;)
 
hehe
it's the emacs of the ide world, then?
 
5:32 AM
not really...
 
@MoonOwlPrince people still use blackberry?
 
I mean emacs, you will always have the text editor there more or less
with this you can make installable programs with your own branding etc from out of the box
 
They have a C++ developer program that has been spammed to our e-mails and they came to our university trying to convince us that BB will get back
 
with as much or as little eclipse stuff as you want
 
ah, I see
 
5:33 AM
deprecated page, but the point is that the apps that say "RCP" actually use the eclipse plugin system
and are written as eclipse plugins to run alongside other eclipse plugins
 
yeesh. Java was using 10-year-old ui paradigms 10 years ago, and they still haven't changed
all of those example apps look horrendous. no offense. :p
 
hehe they are 10 years old :d
 
There is a reason why our uni banned the installation of Java on their computers
 
@tzaman you forgot that SWT is a cross-platform toolkit that
uses the "minimal common subset"
I like that
I develop the app on linux and my customer runs it on windows
 
yeah, it's certainly convenient :)
 
5:39 AM
I do not even need to build it on windows, it is built on linux
and customer still will have an .exe
and auto updates from the net
all without any effort
 
that's a pretty strong value prop. And anyone buying scientific tools probably doesn't care about the UI so much :D
 
they're engineers, don't give a shit if the button is flat grey or brushed aluminum
 
exactly
hehe
anyway, bedtime
rbrb all!
 
Well, in terms of engineering I have to the JVM is good but the guys who work on Java the programming language have disappointed me in some choices they have made
 
In [4]: m.DBSession.query(m.Package.py3_status, func.count(m.Package.py3_status)).group_by(m.Package.py3_status).all()
Out[4]: [(-2, 359), (-1, 7889), (0, 38371), (1, 10674), (2, 116)]
 
statistics from pypi a week ago, using trove classifiers
-2 = py2 only, -1 py2 classifiers only, 0 = dunno, 1 = have py3 classifier, 2 = py3 only
so more packages explicitly support py3 than list only python 2 versions
majority of packages do not give a shit about the version classifiers
someone invite Kasra to the room, he'd answering so many q's that we need him to start doing cv pls :D
 
6:19 AM
People claim Python3 is slower than Python2 but how so?
 
Python 3.3+ is faster
 
But I think speed differences are not important
People claim C is superfast
Wait until you compare string operations in C vs PASCAL - a language slightly older than C
 
z@piedra:~ $ for v in 2.4 2.5 2.6 2.7 3.1 3.2 3.3 3.4 3.5; do echo -n "${v}: "; python${v} -m timeit '[x + y for x in range(1000) for y in range(1000)]'; done
2.4: 10 loops, best of 3: 54.4 msec per loop
2.5: 10 loops, best of 3: 51.9 msec per loop
2.6: 10 loops, best of 3: 52.1 msec per loop
2.7: 10 loops, best of 3: 47.8 msec per loop
3.1: 10 loops, best of 3: 75.6 msec per loop
3.2: 10 loops, best of 3: 72.4 msec per loop
3.3: 10 loops, best of 3: 63.7 msec per loop
3.4: 10 loops, best of 3: 63.7 msec per loop
@MoonOwlPrince ^ It depends what you measure.
 
6:34 AM
You are right
Go ahead and obtain the length of a string in C
Then try and reallocate memory
 
Caballabage
 
The idea that manual memory management is faster than garbage collection is a myth
 
Er I'm not sure that's true
 
I make reference to joelonsoftware.com/articles/fog0000000319.html. It is old but certainly still valid.
The reality is: it depends on the implementation
 
it is true
but garbage collection usually uses more memory
 
I agree that garbage collection should have a greater space complexity but time complexity is a different story altogether.
 
it is a time/memory tradeoff :D
there is even this one
 
Yep
Beautiful
 
"On the other hand, programs written for explicit memory management often incur space overheads in order to preserve properties needed for deallocation. Such overhead might include reference count fields, extra copying of structures to guarantee that an object has a single owner, fragmentation introduced by maintaining separate memory pools for different modules, or cyclic garbage leaked by reference counting."
wish python would start using this
 
Time to take a shower while I think about the application I will start working on once I am done.
 
7:02 AM
@AnttiHaapala how's Pika?
@AnttiHaapala yeah, but only if it's written in pure Python :)
 
Hey up
 
It's nice that we have such a strong UK contingent in here – when you start showing up in the room, it's a good reminder that I should have gone to bed hours ago ;-)
 
@Ffisegydd cabbage!
 
:D
 
@RobertGrant hmm buggy, today I'll look into it again more
@RobertGrant the problem is there is some bytes/str confusion
and I don't understand anything about the code so I am not too sure about where the problem comes form
I should push it to github though
@Ffisegydd this is getting very tiring already
 
user2260218
7:20 AM
Hello!
 
user2260218
Can anyone explain to me why I would want to use the simpleHTTPserver as opposed to just dragging and dropping an html file into my browser?
 
@Anthony cabbage
 
user2260218
Potato?
 
@Anthony Get around file:// protocol restrictions
 
@Anthony how do you drag and drop from a server?
 
7:22 AM
XHR might not be allowed
 
also simplehttpserver is extendable
 
user2260218
Okay wait, I don't much about any of this.
 
You're talking about running python -m SimpleHTTPServer, right?
That just creates a locally hosted server
 
even that is actually very useful
 
Yeah, it is
 
7:23 AM
how do you share files from some directory to your friend:
 
user2260218
I can see why a server is different from just opening my index.html in my browser
 
python -m SimpleHTTPServer
 
user2260218
but I don't know how it's functionally different
 
"ok download from 10.0.2.34:8080/";
 
user2260218
what's something I can do with that?
 
7:24 AM
@Anthony why do you use web
why don't you just open files on your computer?
a bit pointless question, isn't it?
and also notice the part:
 
user2260218
Yes, sorry. I'm a little unfamiliar with how all of this works. But so, I can host a server, and how do I have people download from it?
 
"The SimpleHTTPServer module can also be invoked directly using the -m switch of the interpreter with a port number argument. Similar to the previous example, this serves the files relative to the current directory."
it just requires 2 lines of code to do that also then why not
 
@Anthony one practical difference is you can get external resources (e.g. jquery from a CDN) using // as the start of the URL, rather than having to pick http:// or https://. If you just drag the html into a browser that won't work.
 
@Anthony You give them your IP address
 
@Anthony I mean: if you think there is something wrong with it, then by all means do not use it :D
 
user2260218
7:26 AM
@AnttiHaapala No that's not what I mean, I just don't understand what it does. ):
 
Public IP with the correct port forwarding if necessary. Otherwise, just your internal IP if they're on your network
 
it is a http server
software that is not different from that which answers to browsers when you navigte to chat.stackoverflow.com say
 
@Anthony also, your website may not be arranged exactly according to files on your filesystem (e.g. if you use a web framework) and you need a server to run the website's code
 
user2260218
And so, one more time, how can I get someone else to navigate to my locally hosted site? (Given that it's not tied to a URL...)
 
You are asking "why would I go to http://chat.stackoverflow.com when I could just open chat.txt on my computer"
it is tied to an url
 
user2260218
7:29 AM
@AnttiHaapala I see why what I'm saying doesn't make sense
 
it does not necessarily have a host name in the Domain Name System.
 
@Anthony you will need to put it somewhere that people can get to, but that's a networking problem, not a web server problem.
 
each computer connected to internet must have an IP address
 
user2260218
Alright. How do I figure out what my IP is?
 
Google "what's my IP"
 
7:30 AM
which doesn't work always
you can use ifconfig on linux, ipconfig on windows
commands in the command prompt
 
user2260218
It changes, right?
 
@Anthony Depends
Some people have static IPs
Some don't
 
@Anthony so you may have a dynamic IP (you do unless you're paying extra to not have one), in which case you can't rely on that
 
I use noip.com
It's pretty convenient
 
user2260218
But isn't it inconvenient, if I'm hosting something, to have to keep checking my IP to make sure it didn't change on me?
 
7:32 AM
@Anthony unless you use dyndns or something. But at this point you might as well sign up with pythonanywhere.com
 
My router handles that for me
 
or...
if you are very unlucky, you might not have a public IP at all
 
Hello, how do we name folders in which there are modules in Python ? I mean the PEP. I do not see it on internet, I found PEP for modules only. Thanks
 
Cabbage!
 
user2260218
@RobertGrant It's not that I'm actually trying to host a website, I just don't know how any of this works, and I feel bad about it.
 
7:35 AM
Read about the basics of networking
 
user2260218
Okay, maybe any was an overstatement.
 
What DNS is, how port forwarding works, what IP addresses are
 
@Anthony there is a very indepth article about it
@Anthony let me find it, it explains everything
 
user2260218
lol thanks
 
user2260218
7:38 AM
But before I read that, and I will, what I am understanding is that with that python module I can host a site, and I can have my friend go look at it.
 
user2260218
But could someone tell me, one more time, how I would find the IP to tell them to go to?
 
user2260218
ifconfig?
 
ifconfig will tell you your IP within the network
Assuming you have a WiFi router you're connected to, the internal IP will only be useful to other people also connected to that router
The easiest way I know is to literally Google "what's my IP"
 
I wish this message thread started by Anthony would be archived somewhere
 
You can create a bookmark for the room
 
7:41 AM
Bookmark the beginning message.
 

SimpleHTTPServer

20 mins ago, 20 minutes total – 77 messages, 7 users, 0 stars

Bookmarked just now by Some Guy

There you go
 
Thank you
 
Don't make a conversation - never mind :p
 
Haha, sorry!
 
I just wouldn't personally have bothered, nothing to be too sorry about :p
 
8:14 AM
Skimming over that bookmark, the whole discussion seems very unorganized.
 
user2260218
@poke Yeah, sorry, basically followed my thoughts.
 
To reply to the original question in one sentence: “[why] would [I] want to use the simpleHTTPserver as opposed to just dragging and dropping an html file into my browser” – Browsers usually handle the file:// protocol very differently compared to http:// and restrict many things (such as loading scripts, or accessing external resources).
 
@poke also the thing I said about // URLs for external resources
Anyway. I need to cast a vote in the UK. What's the happyhaps?
 
user2260218
Oh I see. So it useful for just checking the site. I also still don't know how to find my IP- I typed in ifconfig but there are so many numbers.
 
@Anthony it's so easy to type python -m SimpleHTTPServer though, that you may as well get into the habit. As soon as you write any Python, you need a server.
 
user2260218
8:21 AM
@RobertGrant Okay...
 
@Anthony Am I on your ignore list or something?
42 mins ago, by Some Guy
The easiest way I know is to literally Google "what's my IP"
52 mins ago, by Some Guy
Google "what's my IP"
 
user2260218
@SomeGuy Oh no, sorry. I kept forgetting after I looked through ifconfig.
 
user2260218
Sorry. ):
 
user2260218
When I type in that number, with the port I'm serving on, the connection just hangs.
 
Maybe the server's only configured to accept connections on localhost
 
8:26 AM
@Anthony Do you have a WiFi router?
 
user2260218
Yeah
 
user2260218
I also saw that post, and I forgot to respond, because I was confused.
 
user2260218
I'm sorry.
 
You'll probably have to look into port forwarding
 
user2260218
Agh. Alright. I suppose I'll go read that post. Why is this so confusing...
 
8:28 AM
Haha
It'll get easier
 
user2260218
Thanks everyone.
 
@AnttiHaapala struggling with Pyramid's override_asset with templates; any gotchas?
 
@RobertGrant Most of the things I write with Python doesn’t require me to host a web server… :P
 
@poke no, sure, but you presumably aren't talking about html then :)
 
Just trying to remind you that Python isn’t necessarily about writing a web app ;P
 
8:33 AM
@poke I feel as though our smileys are becoming passive-aggressive :D :D :D
 
What gives you that impression? ;P ;P ;P
;D
 
Speaking of smileys, how do you represent the smiley from WhatsApp in ASCII that's just a face with eyes?
:
?
 
😶
 
Yeah, that one
 
:-
 
8:38 AM
' '
 
Oh, that's quite good
 
••
Oh, not ASCII
 
:)
I think the :- or '' are both good options
 
is there a way to distinguish between a var that is a simple list and one that is a nested list? type(x) sees both as list. (e.g. x= ['0'] and x2 = [['0']]
 
:- looks like a typo
And ' ' doesn't look obvious enough
 
8:47 AM
@Phonon I guess you could look at the type of each element in the list, but that's probably not going to be the best answer given in here :)
 
@Phonon type(x) in map(type, x)
Haha
 
@RobertGrant ah right, but it s an idea anyway, I ll try it
^^
@vaultah neat!
 
I guess the general answer is to build your code so it can cope with a list inside the list you're processing if it encounters one, but that's not always possible I spose
 
9:18 AM
What do you guys think about db table design if you have different concepts which share common fields? One big table with nullable fields, or a central table with related specialised tables?
 
9:35 AM
JSON. CSV
 
Lol I like today's XKCD
@Ffisegydd :)
Yeah the thing is what we actually want is just a way to store XML documents, but there you go.
 
is there any online services availabe that provides script to run continuously as a background process without interruption?
 
Heroku does it, but it doesn't do it without interruption
I think it freezes your dyno if there's an hour of inactivity
Which is good enough, I'd say
 
@SomeGuy is there any way other than? i'm just thinking to create a bot, but it needs to be run continuously as a background process. That's why i'm searching.
 
For free? I don't know
You can get a cheap shared host, for cheap, maybe
 
9:49 AM
Raspberry Pi + your internet connection
 
Someone mentioned pythonanywhere.com earlier
 
but it limits us to run those process for only some interval
 
@SomeGuy I did
Not sure what their policy is on background tasks for no money, though. They might do something.
 
10:03 AM
And I guess the problem with directly storing XML is if you add a field, it's a nightmare to go and retrofit a suitable default value into your already stored XML.
 
why doesn't images aren't showing in rss feed? like if there's a gallery exists, it shows only gallery name and meta data. Not about the image link. why?
 
10:32 AM
@AnttiHaapala sorry, I just checked SO and it showed me the message from you I missed; I'm trying to override Mako with Jinja2
 
if i asked a question and 2 people gave me a good answer, what is my play in marking it answered?
 
Whichever you found more useful/betterer
 
please star ^:P
@RobertGrant that ofc...
if I get tonnikala to a decent degree of doneness, then you could basically use any syntax with the same ...
 
How do you mean? Isn't your one XML based?
If you want to compare two strings that are the same except they each use different ways of expressing an 'é', you need to add another equal sign and use ==== to differentiate them, as === will see them as equal. is my favourite thing about PHP now.
 
10:48 AM
@RobertGrant supports pluggable syntaxes
would do something like jinja2 at some point
but I am not interested, the xml/html based rocks
it is actually using html parser now by default and since my weekend coding also allows for "unclosed" void tags, that is <img> or <link> written as such
 
Sure
 
also currently tasked to make the tracebacks actually useful as in jinja2
 

« first day (1661 days earlier)      last day (3286 days later) »