Shit said in #python


 
Ciar Main Page >> TTK's Home Page
 
More quotes: Alaric   Fuz   Sonic   Pie   Izzy   Danny   TTK   Shit Said in Python   Shit Said in Go   mst
 
 
Display quotes in order:     
 [1074] #programming_is_hard
2020-08-25 16:14:12 <JohnnyL> WHy isn't my goto working? Has it been deprecated in 3.7?
2020-08-25 16:14:26 <_habnabit> JohnnyL, python has never had goto
     #python
 
 
 [1073] #programming_is_hard
2018-05-01 19:47:24 <Geren> mandeep: ok so line 33 says you go through the for loop N times, where N is the number of elements
2018-05-01 19:47:39 <Geren> and line 35 says for each element, you go through another loop of N-1 times ?
2018-05-01 19:47:44 <Geren> isnt that N^2 ?
2018-05-01 20:03:00 <mandeep> Geren: 2^n
2018-05-01 20:07:19 <Geren> mandeep:  thank you.
2018-05-01 20:07:24 <mandeep> np
     #python
 
 
 [1071] #continuous-integration
2017-12-12 15:57:33 <Remram> there are packages out there whose setup.py is insane, and errors out on PY3, or does something different, or
          doesn't handle egg_info
2017-12-12 15:57:55 <Remram> as long as we have those, package management on Python is going to be broken
2017-12-12 16:04:00 <ttkpy> CPAN solves this by shoving all newly contributed modules through CI in various environments (windows, linux,
          freebsd, various versions of the language, etc) .. when a module fails to build, that is noted on its MetaCPAN page
2017-12-12 16:04:32 <ttkpy> and users avoid using it until module authors fix their code (which might be in the code itself or in the
          installation blargh)
2017-12-12 16:04:58 <ttkpy> might python apply a similar solution to root out these naughty setup.py?
2017-12-12 16:06:38 <ttkpy> example of a naughty module's CPANtesters CI results grid:  http://matrix.cpantesters.org/?dist=Curses+1.36
2017-12-12 16:06:58 <dw> ttkpy: i posted this very thing to python-ideas many moons ago and it was shot down by the packaging guys as "too much work"
2017-12-12 16:07:18 <nedbat> dw, ttkpy: build it
2017-12-12 16:07:26 <runciter> who pays for the CI?
2017-12-12 16:07:54 <ttkpy> runciter - the CPANtesters are volunteers who provide their own hardware
2017-12-12 16:08:06 <dw> nedbat: i feel strongly disincentivized by every packaging-related interaction i've ever had
2017-12-12 16:08:19 <runciter> as a contributor to open source projects that use existing CI service's free tier, it can be a bummer because the
          CI services response times vary from good to terrible
2017-12-12 16:08:20 <nedbat> dw: it doesn't have to be part of pypi, does it?
2017-12-12 16:08:32 <runciter> ttkpy: how do you trust the CPANtesters?
2017-12-12 16:08:33 <dw> nedbat: a good solution does, yes
2017-12-12 16:08:49 <nedbat> dw: not at first?  And why does it need to be part of pypi?
2017-12-12 16:08:52 <ttkpy> runciter - through time and familiarity, so you won't get trust immediately upon launch
2017-12-12 16:09:22 <runciter> ttkpy: a lot of open source communities in python seem to be moving away from self-hosted solutions
2017-12-12 16:10:50 * ttkpy contemplates how he'd prioritize a CPANtesters-for-pypi project
2017-12-12 16:11:11 * ttkpy glances at the 70+ other projects he's neglecting
2017-12-12 16:14:58 <dw> nedbat: because the alternatiev is scraping pypi for already-released packages to discover failures.
2017-12-12 16:15:05 <dw> nedbat: it needs to happen as part of release
2017-12-12 16:15:28 <nedbat> dw: at first, you'd need to do it asynchronously. too much stuff would become unavailable if you gate releases on it.
2017-12-12 16:19:51 <dw> ttkpy, nedbat: https://mail.python.org/pipermail/python-ideas/2014-April/027705.html was the thread in question, it
          never got nearly as far as discussing pypi integration before devolving into arguing about how much work it'd be
2017-12-12 16:21:53 <ttkpy> thanks, dw
2017-12-12 16:22:29 <ttkpy> the success of CPANtesters implies it's not insurmountably difficult
2017-12-12 16:22:53 <ttkpy> the python community is far more vibrant and energized, so it should be easier to pull off
2017-12-12 16:24:24 <dw> code and technology are rarely the difficult parts of any project
     #python
 
 
 [1066] #programming_is_hard
2014-04-14 16:43:59 <drag0nius_> how can i get minimum value of numpy.int16 (or any other int datatype)
2014-04-14 16:44:58 <ttkp> drag0nius_ - do the math?
2014-04-14 16:45:57 <drag0nius_> nooooo
     #python
 
 
 [1062] #programming_is_hard
2014-02-25 10:53:17 <fission6> how can i get the ISP given an IP
2014-02-25 10:53:29 <nanonyme> fission6, check whois database
2014-02-25 10:53:44 <cwillu_at_work> also, not a python question
2014-02-25 10:53:56 <fission6> how can i do this .. in python
     #python
 
 
 [1060] #programming_is_hard
2014-02-20 15:46:50 <Moonlightning> is `if foo_integer & 1:` really that Unpythonic compared to `if foo_integer % 2 == 0:`?
2014-02-20 15:48:59 <|Nyx|> Moonlightning: bitwise operations have an annotation like "If you are flipping bits, then python is prolly not the language you want to be using" in the docs.
 
[Note: as far as I can tell, half of "unpythonic" is actually "math is hard, and we hate it" in disguise.]
     #python
 
 
 [1057] #programming_is_hard
2014-02-11 18:20:30 <scizzat> ok so i'm new to python and i'm taking an intro to programming class, i dont know why but i'm just stumped at this assignment.....
2014-02-11 18:21:26 <scizzat> it's basically u have to write a program that takes a person and their pay, their pay starts at 1 penny, doubles every day, but u dictate how many days it calculates for
2014-02-11 18:22:01 <scizzat> and u have to have it show in two columns, days worked and the pay for each day, eventually adding the total over the days at the end
2014-02-11 18:22:30 <ttkp> scizzat - what part has you stumped?
2014-02-11 18:22:55 <kosh> that sounds kind of trivial
2014-02-11 18:23:12 <scizzat> i guess the having the table double each line
2014-02-11 18:23:38 <kosh> scizzat: think about the math first, not the program
[..kosh tries to help scizzat for a while..]
2014-02-11 18:37:35 <kosh> just on pencil and paper try to rewrite 1 2 4 8 16 32 64 128 as powers of 2 and look at the pattern
2014-02-11 18:37:51 <ttkp> scizzat - their pay doubles every day, right?  how do you double a value?
2014-02-11 18:38:08 <scizzat> multiply it by 2 obviously
2014-02-11 18:38:11 <ttkp> right
2014-02-11 18:38:19 <scizzat> and that's what i have in the code
2014-02-11 18:38:28 <scizzat> but it lists each day with the same number
2014-02-11 18:38:37 <scizzat> it's not taking the previous number and multiplying by 2
2014-02-11 18:39:08 <ttkp> scizzat - paste your code to paste.pound-python.org and tell us the URL it gives you.
2014-02-11 18:39:15 <ttkp> scizzat - so we can look at it.
2014-02-11 18:40:09 <scizzat> http://bpaste.net/show/vjwyIMRBYznMjszDilu7/
2014-02-11 18:42:11 <ttkp> scizzat - their pay is doubling every day, right?  So where in this loop are you doubling their pay?
2014-02-11 18:42:50 <scizzat> that's where i'm stuck at ttkp
2014-02-11 18:43:28 <ttkp> scizzat - let's say pay is stored in a variable named "pay".  How would you cause the value in "pay" to double?
2014-02-11 18:43:39 <scizzat> pay * 2
2014-02-11 18:43:45 <ttkp> close
2014-02-11 18:44:06 <scizzat> pay ** 2
2014-02-11 18:44:25 <scizzat> i know that in python the 2nd power is **
2014-02-11 18:44:27 <deltab> scizzat: how do you change the value of a variable?
2014-02-11 18:44:29 <ttkp> scizzat - you were closer the first time.  "pay * 2" is twice the pay, but how do you save that result in "pay"?
2014-02-11 18:44:41 <scizzat> reassign it?
2014-02-11 18:44:45 <ttkp> yes
2014-02-11 18:45:50 <ttkp> scizzat - do you know how to assign "pay * 2" to "pay"?
2014-02-11 18:46:06 <scizzat> well as of right now i have
2014-02-11 18:46:08 <scizzat> Amount = days_worked * 2
2014-02-11 18:46:29 <deltab> scizzat: that doesn't mention 'pay'
2014-02-11 18:46:49 <scizzat> so then i should create another line or this case variable called pay
2014-02-11 18:46:53 <ttkp> scizzat - yes
2014-02-11 18:47:34 <scizzat> ok so i changed it to day_amount
2014-02-11 18:48:00 <ttkp> scizzat - is that the amount that the person gets paid on that day?
2014-02-11 18:48:25 <scizzat> number_of_days better?
2014-02-11 18:48:51 <ttkp> scizzat - the amount that the person gets paid on a day is what is doubling, right?
2014-02-11 18:49:00 <scizzat> yes
2014-02-11 18:49:03 <scizzat> and i have to have it start at a penny
2014-02-11 18:49:06 <ttkp> right
2014-02-11 18:49:10 <scizzat> so day 1 - 0.01 etc
2014-02-11 18:50:45 <ttkp> scizzat - does "pay = pay * 2" make sense?
2014-02-11 18:51:33 <kosh> ttkp: don't give answers, we are trying to get him to think
2014-02-11 18:51:46 <kosh> ttkp: it is a very important skill to learn how to think about things like this
2014-02-11 18:52:07 <scizzat> ultimately should i not have it start with the first day minus 1
2014-02-11 18:52:09 <scizzat> and then times 2?
[...]
2014-02-11 18:59:27 <scizzat> i'm in college for IT network security, this is one of the pre-reqs
     #python
 
 
 [1055] #programming_is_hard
2014-02-04 15:20:35 <John_Conner> i mean i tried appending to a binary pickle but it dont seem to work, can it be used in a json?
2014-02-04 15:21:04 <ttkp> John_Conner - appending data to a json document doesn't work either.
2014-02-04 15:21:18 <John_Conner> Alright, I just thought appending to a file worked like appending to a list
2014-02-04 15:23:28 <ttkp> John_Conner - you can append to files, but whether the data structure you're using in that file supports appended data is another matter entirely.
2014-02-04 15:24:55 <ttkp> John_Conner - appending to a file containing csv or ini structured data generally works, but appending to a file containing xml, json, or pickled data will not.
2014-02-04 15:25:25 <John_Conner> ah ok thanks for that explanation ttkp
     #python
 
 
 [1053] #programming_is_hard
2014-02-03 20:32:15 <sixninetynine> it's pretty nasty json, honestly
2014-02-03 20:32:41 <sixninetynine> a dictionary of lists :/
     #python
 
 
 [1050] #programming_is_hard
2014-01-23 14:42:59 <prudhvi> Hi, using python how can i convert a json to a class object?
2014-01-23 14:43:11 <kevlarman> prudhvi: what?
     #python
 
 
 [1048] #programming_is_hard
2014-01-13 18:31:40 <legrandin> maybe ill try project euler out, it looks interesting
2014-01-13 18:31:47 <dash> legrandin: don't
2014-01-13 18:31:54 <dash> legrandin: it's a trap
2014-01-13 18:32:16 <dash> legrandin: seriously. it's a set of math problems disguised as programming problems.
2014-01-13 18:32:26 <ttkp> math is good for you
2014-01-13 18:32:39 <legrandin> well, does it improve computational thinking? i guess thats the point
2014-01-13 18:32:44 <dash> ttkp: has the FDA verified your claim
2014-01-13 18:32:45 <dash> legrandin: No.
2014-01-13 18:33:10 <ttkp> legrandin - computational thinking improves computational thinking.
2014-01-13 18:33:23 <ttkp> just pick something and start biting.
2014-01-13 18:33:26 <dash> It's not clear that 'computational thinking' is a single thing
2014-01-13 18:33:39 <dash> legrandin: The kinds of thinking that apply to project euler problems have very very little application to web development
     #python
 
 
 [1045] #programming_is_hard
2014-01-13 10:02:49 <ribot> i'm using fopen, fread(8) and it seems to have read only 6 characters... i wonder if it is somehow reading in utf-8, whereas it should read as ascii i think... the same code was working in another script in python 2.7, where i suppose it's not reading in utf-8
     #python
 
 
 [1042] #programming_is_hard
2014-01-09 14:45:29 <travisgriggs> how can I get something file like (e.g. readline(), read(), write()) for a socket?
2014-01-09 14:46:09 <Yhg1s> travisgriggs: sockets have a 'makefile' method, but it's usually a mistake to use it. (sockets aren't quite equivalent to files, and the subtle differences are likely to cause all kinds of issues.)
2014-01-09 14:48:08 <travisgriggs> Yhg1s: other suggestions then? i just need to implement a very simple little tcp client protocol
2014-01-09 14:49:00 <Yhg1s> travisgriggs: I suggest using the socket methods.
2014-01-09 14:49:10 <Yhg1s> travisgriggs: I also suggest using Twisted, which will make it a lot less work to do it correctly.
2014-01-09 14:49:11 <travisgriggs> iow, i guess... python docs describe the socket module as "Low level networking interface". Where is the high level one then?
2014-01-09 14:49:19 <Yhg1s> travisgriggs: Twisted is the high-level one.
2014-01-09 14:49:23 <travisgriggs> twisted scares me
2014-01-09 14:49:44 <dash> travisgriggs: and the socket api doesn't? :)
2014-01-09 14:49:44 <Yhg1s> travisgriggs: it's funny, because BSD sockets are a lot scarier.
2014-01-09 14:49:53 <dash> travisgriggs: maybe that is because you know less about socket! :)
2014-01-09 14:50:02 <Yhg1s> (they have an enormous amount of corner cases and platform-specific behaviour.)
2014-01-09 14:50:14 <ttkp> to be fair, the socket API has a much shallower learning curve than Twisted
2014-01-09 14:50:16 <travisgriggs> no, i'm pretty comfortable with sockets
2014-01-09 14:50:26 <Yhg1s> travisgriggs: do you know what EINTR means?
2014-01-09 14:50:34 <travisgriggs> yes
2014-01-09 14:50:42 <simpson> EAGAIN?
2014-01-09 14:50:46 <travisgriggs> yep
2014-01-09 14:50:50 <simpson> EAGAIN?
2014-01-09 14:50:55 <Yhg1s> simpson :)
2014-01-09 14:56:50 <travisgriggs> for illustration purposes... i google twisted, click on a couple links till i arrive at a simpleclient.py example (echo client). now i start seeing that i need to import a reactor (or maybe that's just the server) and a protocol? and now i'm thinking, why do I want to care about all of this?
2014-01-09 14:57:10 <cdunklau> travisgriggs: believe it or not it makes everything easier
2014-01-09 14:57:20 <travisgriggs> contrast that with pyserial, doing a very similar write query/read response protocol over a serial line
2014-01-09 14:57:35 <Yhg1s> travisgriggs: it's because Twisted is event-driven, so it has a reactor, and it doesn't get in your way of writing re-usable code, so t uses abstractions like 'transport' and 'protocol'.
2014-01-09 14:57:36 <cdunklau> travisgriggs: reactor is really just the mainloop
2014-01-09 14:57:40 <dash> travisgriggs: I agree that the API is poor
2014-01-09 14:57:46 <dash> travisgriggs: but it's due to limitations of python
2014-01-09 14:57:50 <dash> travisgriggs: at least partly
2014-01-09 14:57:55 <travisgriggs> opened up the pyserial docs, found how to get a stream like object on the resource and was off and running
2014-01-09 14:58:18 <simpson> travisgriggs: Yes, programming requires writing code.
2014-01-09 14:59:13 <travisgriggs> maybe what i should have said is "i'd like something a little more than the low level, and i'm not interested in the all powerful high level abstraction of everything, is there something like the middle level?"
2014-01-09 14:59:22 <Yhg1s> travisgriggs: there is not.
2014-01-09 14:59:42 <travisgriggs> you always this helpful simpson?
2014-01-09 14:59:57 <travisgriggs> thanks Yhg1s
2014-01-09 14:59:58 <simpson> travisgriggs: Actually; I am usually *less* helpful. Today, however, I feel quite Zen.
2014-01-09 15:02:14 <travisgriggs> spent 20 years chasing "frameworks" in Smalltalk, i'm less excited about them now days. not that good ones don't exist
2014-01-09 15:02:46 <Yhg1s> travisgriggs: would it help if we just said 'library that calls your code'?
     #python
 
 
 [1037] #programming_is_hard
2013-12-31 13:35:49 <Moonlightning> #python : speaking of hashes, what's up with locality-sensitive hashes?
2013-12-31 13:35:56 <Moonlightning> I've searched, but all I can find is weird math stuff.
2013-12-31 13:38:12 <ttkpy> Moonlightning - http://en.wikipedia.org/wiki/Locality-sensitive_hashing has a pretty good explanation for laypeople
2013-12-31 13:42:02 <Moonlightning> ttkpy @.@
2013-12-31 13:42:37 <Moonlightning> ttkpy: the intro paragraph is a great explanation, but the rest is what I meant when I said /weird math stuff/
     #python
 
 
 [1036] #programming_is_hard
2013-12-31 11:37:07 <JC_SoCal> i need to supply input to this function with 8 bytes
2013-12-31 11:37:10 <JC_SoCal> however i want to iterate all possible combinations of 8 bytes
2013-12-31 11:37:21 <cesarkawakami> JC_SoCal: all possible combinations of 8 bytes is a huge number.
2013-12-31 11:37:42 <JC_SoCal> so i figured i could make a generator
     #python
 
 
 [1030] #programming_is_hard
2013-12-17 17:41:16 <Pinkamena_D> is anyone aware of some library which can compare and find out if two audio samples are 'the same' within some ajustable threshold?
     #python
 
 
 [1026] #programming_is_hard
2013-11-19 09:37:43 <Razkin> Is it possible to create an script that shall name every .gif file in a folder to a*.gif, like in alphabetical-order, ab.gif, then ac.gif, then ad.gif..etc
2013-11-19 09:38:05 <Yhg1s> Razkin: yes, that's perfectly possible.
2013-11-19 09:38:15 <Razkin> Yhg1s: can you please write something for that.
2013-11-19 09:38:24 <Yhg1s> Razkin: what part is giving you trouble?
2013-11-19 09:38:33 <Razkin> Yhg1s: I don't know any language.
2013-11-19 09:38:40 <Razkin> Yhg1s: I just came here thinking that I'd get some help.
2013-11-19 09:38:48 <_unary> Razkin that's not giving a helping hand, that's doing it for you
2013-11-19 09:38:54 <Yhg1s> Razkin: I'm afraid this channel is for helping people learn Python.
2013-11-19 09:39:41 <ttkp> thank you Razkin, for making me smile for the first time today :-)
2013-11-19 09:40:05 <Razkin> ttkp, I came here to make your penis erect, not your smile.
2013-11-19 09:40:22 <ttkp> ooh, and I was just typing up a solution for you, too ;-)
2013-11-19 09:40:30 <Razkin> OH TTKP
2013-11-19 09:40:31 <Razkin> I APOLOGIZE
2013-11-19 09:41:31 *<* Razkin has been kicked off channel #python by Yhg1s (come back when you want to learn Python)
     #python
 
 
 [1016] #programming_is_hard
2013-10-21 15:39:27 <davo> how can I tell how the python script is intending to be used?
2013-10-21 15:39:49 <Yhg1s> davo: you'd have to read the code.
     #python
 
 
 [1009] #programming_is_hard
2013-10-14 12:50:06 <nosklo> nested structures suck. It's best to avoid making them in first place
     #python
 
 
 
 
    Ciar Main Page >> TTK's Home Page