« first day (2461 days earlier)      last day (2476 days later) » 
00:00 - 16:0016:00 - 23:00

12:37 AM
recbg
 
12:59 AM
hello
 
How are you today, @NoahCristino?
 
1:27 AM
@Code-Apprentice Good
I fixed my issue I was going to ask about
I didn't know how to get multiple regex matches
re.findall isn't well documented
there aren't any examples
but I got it working
 
1:50 AM
good to hear
@NoahCristino What about docs.python.org/3.5/library/re.html#re.findall did you find unclear?
You might also want to look at docs.python.org/3.5/library/re.html#re.finditer depending on what exactly you are doing.
 
 
4 hours later…
5:52 AM
Hello folks.. I am trying to import openpyxl or xlsxwriter ro xlwt etc but for all the stuff it says no module named .. I tried in python 2.7, 3, 3.6.1 etc.. can anyone help on it?
 
6:15 AM
cbg
@Vimo Did you install these? If yes, did you install these for the correct python environment?
 
6:40 AM
@AshishNitinPatil Ahh nope.. these are already installed directories in my official environment..But I am unable to find the xlsx related modules
 
You can check the version of the installation that you have and compare it with the one that is supposed to have the modules you expect.
 
user1118051
7:24 AM
morning guys
 
user1118051
i have a pandas question. appreciate some help
 
user1118051
is this correct? categoricalDF.apply(lambda x: skp.OneHotEncoder().fit_transform(x.values.reshape(-1, 1)), axis=0)
 
user1118051
I'm getting funny results
 
user1118051
FullBath          (0, 2)\t1.0\n  (1, 2)\t1.0\n  (2, 2)\t1.0\n ...
OverallQual       (0, 6)\t1.0\n  (1, 5)\t1.0\n  (2, 6)\t1.0\n ...
HalfBath          (0, 1)\t1.0\n  (1, 0)\t1.0\n  (2, 1)\t1.0\n ...
BedroomAbvGr      (0, 3)\t1.0\n  (1, 3)\t1.0\n  (2, 3)\t1.0\n ...
PoolArea          (0, 0)\t1.0\n  (1, 0)\t1.0\n  (2, 0)\t1.0\n ...
3SsnPorch         (0, 0)\t1.0\n  (1, 0)\t1.0\n  (2, 0)\t1.0\n ...
GarageCars        (0, 2)\t1.0\n  (1, 2)\t1.0\n  (2, 2)\t1.0\n ...
MSSubClass        (0, 5)\t1.0\n  (1, 0)\t1.0\n  (2, 5)\t1.0\n ...
 
7:44 AM
Well it does something with something.
Who is to say there are objective rights and wrongs in the world?
 
user1118051
actually i realised that if i added a [0] at the end and did toarray() it would look correct.
 
user1118051
can someone correct me if im mistaken?
 
user1118051
this was my output after apply toarray()
 
user1118051
array([[ 0.,  0.,  1.,  0.],
       [ 0.,  0.,  1.,  0.],
       [ 0.,  0.,  1.,  0.],
       ...,
       [ 0.,  0.,  1.,  0.],
       [ 0.,  1.,  0.,  0.],
       [ 0.,  1.,  0.,  0.]])
 
user1118051
for OneHotEncoding()
 
7:54 AM
cbg
 
@mingsterism you seriously can't be serious with that amount of information
 
user1118051
@AndrasDeak what did you mean?
 
you give us a convoluted oneliner (containing sklearn calls as well) acting on a dataframe that probably contains some categoricals, and a result, and you ask us whether it's correct
I don't yamming believe that no one has ever told you to provide anything that remotely resembles an MCVE
 
user1118051
sry im new to sklearn. what would be the better way?
 
user1118051
whats MCVE?
 
7:58 AM
seriously
also read How to Ask while you're at it
 
user1118051
alright. thanks. will look at that
 
Ah well. The problem is that this regex isn't working
I just Ctrl + Enter... nvm
In [1]: from post_office import validators

In [2]: validators.SpanishEmailValidator.user_regex.match("muñoz")
Out[2]: <_sre.SRE_Match at 0x7fe5e97b8ca8>

In [3]: validators.validate_email_with_name("muñoz@mydomain.com")
---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
<ipython-input-3-dbc43edb3e5f> in <module>()
----> 1 validators.validate_email_with_name("muñoz@mydomain.com")

/home/.virtualenvs/bd_colaboradores/local/lib/python2.7/site-packages/post_office/validators.pyc in validate_ema
 
try shift+enter
 
@Rawing That worked
 
8:04 AM
oh poo I wrote ctrl+enter, didn't I?
 
`user_regex` is
_lazy_re_compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-ZñÑáÁéÉíÍóÓúÚ]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-ZñÑáÁéÉíÍóÓúÚ]+)*\Z" # dot-atom
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)', # quoted-string
re.IGNORECASE)
 
sorry about that
 
@AndrasDeak np
 
perhaps the problem is python 2 vs unicode in string?
vague guess, I'm not familiar with this domain
I also have to leave now
 
To summarize the regex, is just the EmailValidator.user_regex from django.core.validators, only with this added chars: ñÑáÁéÉíÍóÓúÚ
@AndrasDeak I don't think so
 
user8167727
8:08 AM
Hi;
 
user8167727
Can Any One solve my problem here?
 
just found this in django source code... if '<' and '>' in value: (django-post_office is part of django, right?)
 
@Rawing Nope, an app
@Rawing But the error is inside the EmailValidator.__call__ method
 
@mini Please read room rules sopython.com/chatroom.
 
@Rawing I also printed the regex and the string, and they look well both
 
8:12 AM
You don't have to ping all the time.
It literally sends a notification per ping, so might get annoying.
 
Ok ok
 
okay, but this is definitely from django. though it's not quite as bad. if not value or '@' not in value:
 
user8167727
How can i see the data that the user inputted on tkinter, here is the code



from tkinter import *

def callback():
print("hi")

top = Tk()
L1 = Label(top, text="User Name")
L1.grid(row=0, column=0)
E1 = Entry(top, bd = 5)
E1.grid(row=0, column=1)

L1 = Label(top, text="Password")
L1.grid(row=1, column=0)
E1 = Entry(top, bd = 5,show='*')
E1.grid(row=1, column=1)

MyButton1 = Button(top, text="Submit", width=10, command=callback)
MyButton1.grid(row=3, column=1)

top.mainloop()
 
by the way, I've never used django, so don't expect much help from me. just using this chance to check it out.
 
user8167727
Maybe I should ask my question on stackoverflow, right?
 
8:14 AM
np. I pass the entire email with the domain to the function: in both cases the regex and the string to match are the same, but for unexpected reasons it just don't match it the second way. Will keep looking, this has to be something very tricky (as always)
 
user8167727
Stackoverflow don't give response whenever I contact them. What should I do?
 
@mini print(E1.get())?
 
user8167727
@ Rawing _tkinter.TclError: invalid command name ".!entry2"
 
how did you manage that? It works for me
 
user8167727
I don't know how to manage it. I just put the code at last.
 
8:20 AM
you have a long way to go, my friend
of course it won't work after the mainloop
put it where your print("hi") is
 
user8167727
Oh let me try it.
 
that's where you need the value, not after the window is closed
 
user8167727
Its only showing the last value (password)
 
user8167727
Becuase E1 was restored again with password
 
Because you named both of your entries E1.
 
user8167727
8:22 AM
Oh
 
user8167727
Don't know how to give a million thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnkkkkkkkkkks
 
Hi guys, Im completly new to python and I'm trying to draw a circle into a pygame application. First there is no problem mixing plugin is there ? And moreover what is a good module for circle and geometry ? (I found Geometry already but I'm not sure it is exactly what I'm looking for since it does not look like handling render)
 
why not just use pygame to draw the circle?
 
user8167727
@Rawing how can I change the name of windows pop-up( currently tk)
 
I actually don't know that. I'd have to google it, just like you :p
 
8:44 AM
@Rawing becuase I need a bit more than simply the circle, I need to use collision between circle and anything else and I need the circle to be transparent
 
user8167727
:P
 
cbg
 
user8167727
@Rawing I fixed it myself using command top.title('my title')
 
10:06 AM
@AndrasDeak As always, was an unicode issue... had to pass the regex as ur"...".
 
cbg
Did you check out my Trello. I mean it's not the best thing in the world but it will help be to explain to you what I am trying to do
 
10:25 AM
cbg
 
11:16 AM
@mini Here's a way - "Execute this in your console : for i in range(10**6): print('Thanks')"
 
@AshishNitinPatil you mean print('thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnkkkkkkkkkk‌​') !
 
You dropped the "s" at the end :-p
 
Jesus christ. "My encryption/decryption works fine, but if I call encrypt(some_text) it gives me the wrong output" That's not what "works fine" means, godyamit
 
From an outside perspective, that is way too funny :D
 
11:32 AM
@AshishNitinPatil yeah because they wanted a million thaa..nn..nks
which I am sillily interpreting as a million units of "thaaannkk" ;-)
 
11:48 AM
@Code-Apprentice I used that, but there was no example, so I didn't know what it returned. I expected it to return a .captures() object, or something not just an array
I'm making a python interpreter from scratch
in python for my language I'm making
 
@RompePC well well well ;)
 
12:05 PM
Cabbage
 
My regex matches fine
but
when I sub it
it doesn't replace
 
Any idea on how to know which user is logged in via Flask-User package?
 
nvm fixed
 
user6845426
12:25 PM
cbg
 
cbg
 
user6845426
Hows it going
 
Close to melting point, weather-wise. But fine, thanks. How about you?
 
user6845426
Crank up the air con? I'm working with Excel and VBA, need I say more
 
yeah right (re: AC) :P
 
12:43 PM
cbg
 
cbg
 
1:08 PM
cbg
 
cbg
 
@NoahCristino The doc clearly states it returns a list of strings.
> Return all non-overlapping matches of pattern in string, as a list of strings.
Interview today.
 
cbg
 
@Code-Apprentice good luck!
 
1:30 PM
@MooingRawr \o
 
how goes it Andy?
 
@MooingRawr just launched the new website with 8 languages
copy wrote and PManaged a team spread across 7 countries
except than that, I'm alive and somehow kicking
how about you?
 
Is it possible to somehow use the old os.urandom (python 2) function in python 3?
 
slice objects are so easy to use... for index in reversed(range(*slice_obj.indices(len(self)))): del self[index]
 
@Code-Apprentice Whoops xD
 
1:36 PM
@Rawing are you sure that's the simplest solution?
 
@SebastianNielsen Why would you ever want urandom to return a string?
@AndrasDeak nope, I'm open to suggestions
 
@AndyK got dropped into a project that I have no idea what's what, and I have to replace the dude for a week whos on vacation. Other than that, it's swell :D
 
hmm, you need the index to delete from the original list?
 
I want it to return something in this manner: Ú÷áÐX§Ôi
 
Actually, how about filtering the original? Is there a reason you're not doing that?
 
1:38 PM
@SebastianNielsen there is the urandom in Python3
 
@Rawing Sebastian has a loooong history of asking vague and unclear things, and refusing to read or learn or understand or try or just be generally considerate towards the time of others
 
python 3 os.urandom returns this: ea82BStgFtk=
(after it have been converted to string)
It should look like this: Ú÷áÐX§Ôi
 
he's also asked for help with problems of questionable ethical background
 
@SebastianNielsen you need to be clearer on what you need. We don't live in your head ...
 
1:39 PM
@AndrasDeak You mean like self.list = [v for i,v in enumerate(self.list) if i not in range(*slice_obj.indices(len(self)))]?
 
I made that very clear.
I quote: "Is it possible to somehow use the old os.urandom (python 2) function in python 3?"
 
@SebastianNielsen 'course you did
 
I have searched the web for answers without luck.
 
@AndyK really I thought Solipsism was a thing.
 
@SebastianNielsen answer is yes
 
1:40 PM
@Rawing I'm thinking avoiding slice_obj_indices should be possible
 
Well how?
 
@Rawing can you put together a simple example of what you're trying to do?
 
the real question is, why is it a problem that urandom returns a bytes?
 
He (Andy) just showed you how, urandom worked but not how you want it because you don't describe in details on how you want it done...
 
1:41 PM
python 3 os.urandom returns this: ea82BStgFtk=
(after it have been converted to string)
But I would like it to return a string that looks more like this: Ú÷áÐX§Ôi (what python 2 does)
 
@NoahCristino It is easy to miss those details when you skim documentation =p
 
16 hours ago, by Sebastian Nielsen
I need your help quickly, is it possible to write print with parentheses in python 2.7.9?
16 hours ago, by Sebastian Nielsen
This is very strange, I am running python 3.5 and when I type the following:
import os
x = os.urandom(8)
print(type(x)) # <class 'bytes'>
print(x) # b'\x85\x8dTi\\\xa3\xa6\xf9'

But another dude is running the exact same script, with python 2.7.9
And gets this as output:

<type 'str'>
Ú÷áÐX§Ôi
I assume that's why ^
 
@Code-Apprentice It was really late and my brain hurt lol
 
No worries.
I've made similar mistakes before.
 
1:42 PM
I gave up trying to make a compiler
since that is really hard
now I'm just making an interpreter
 
So how is it done?
 
It definitely takes a lot of work.
 
Am I still unclear?
 
Understanding automata theory really helps.
 
@MooingRawr ah well... Sorry to hear that
@MooingRawr we all live in our own island, do we? :)))
 
1:44 PM
@AndrasDeak Basically I have a List data structure that emits an event whenever something is inserted or deleted, so if someone deletes a slice del my_list[:] I internally delete the items one by one so that an event is emitted every time
 
ooooh your sorted monster
yeah, I think your original will do ;)
 
so the code is basically like this:
def __delitem__(self, index):
    if isinstance(index, slice):
        for index in reversed(range(*index.indices(len(self)))):
            del self[index]
    else:
        item= self.list.pop(index)
        self.item_removed_event.emit(item, index)
 
@AndyK :d I just imagine everyone is out to get me and everyone isn't real so in reality I'm out to get myself and I have to prove to myself I am better than myself to improve myself for others... wait that doesn't make sense....
 
@Code-Apprentice How do you know if your language passes the Turing test?
It can't think without humans
 
@NoahCristino Do you mean to tell if it is Turing Complete?
 
1:46 PM
Yea
 
You have to find a transformation that converts your language into a Turing machine.
 
yeah, it probably isn't, with all the infinite memory thingy ;)
 
@Code-Apprentice Fun
 
What do you mean, Andras?
Modern computers are equivalent to a Turing machine despite the lack of infinite memory.
 
the formal definition of a Turing machine involves an infinite strip of memory or something
 
1:49 PM
yes it does
 
as far as I know we're not there yet
 
Most modern programming languages are still Turing complete without using infinite memory.
 
@Rawing yeah, I can't think of a way to skip turning your slice into a range of indices...
 
@MooingRawr #lmao
 
cbg
 
1:50 PM
\o
 
@SebastianNielsen The solution there is not to make urandom return a string, but to write your code in a way that it can work with bytes. The odds of a random byte sequence representing a valid string are abysmally low. My question still stands: Why is it problem that urandom returns a bytes?
 
@Rawing use a numpy array instead of a slice, there slicing returns a view rather than a copy :D
but deleting from the array is inefficient
 
It is not a problem that it returns bytes, but rather than when I convert it to a string, it doesn't look like this sort of randomness, if that make sense: Ú÷áÐX§Ôi
That python 2 urandom provide
 
why are you converting it to a string?
 
keyiv = mdf(password + salt).digest()
The salt has to be a string
 
1:56 PM
@AndrasDeak That's good advice. I'm sure numpy is an acceptable dependency for my GUI library. Kappa
@SebastianNielsen No, I'm pretty sure password has to be a bytes. Though I'm not sure what mdf is.
 
Hi anyone experienced with elasticsearch stack here ?
 
@Rawing again I'm not sure if other aspects might ruin it, but worth a try :)
let me know if it works out
 
Hmm, actually I might need numpy anyway for some image manipulation
 
someone want to give me constructive criticism on this answer? I don't normally venture into these types of SO questions but I felt the existing answers were lacking
 
Cro
2:02 PM
how to unscramble and truncate a numpy array?
 
@Cro when you say scramble, do you mean shuffle?
 
@enderland You have a little half-truth in there: "integers implicitly have this functionality" That's only true up to 256 or so IIRC. Otherwise a good answer though.
 
@Rawing yeah I thought about adding that too, I'll do that
 
Wait so it's impossible to make anything turing complete: "Note that there's no known way to actually build a true Turing complete system. This is because there's no known way to genuinely simulate the limitlessness of the Turing machine's tape within physical space."
You can prove it's not but you can't prove it is
 
recbg
 
2:10 PM
@AndrasDeak I'm just gonna stick with the ugly code I have right now I think. Numpy seems like overkill. Not to mention, I haven't really worked with numpy before, so I might end up with code that's even uglier ;D
 
Hehe:) In the mean time I realized that removing items from a numpy list would probably lead to the reallocation of the rest of the array...
 
Hello! Any good books/cources to start with Python?
 
@davidism the pluralsight stuff I've been going through is pretty high quality
 
@Rawing Thanks!
 
DSM
2:24 PM
Morning cabbage for all.
 
@DSM \o
 
ciao
 
2:40 PM
cbg DSM
 
2:54 PM
cbg
 
o/ @idjaw
 
o/
 
rb folks
 
Stacking 5 layers of container structures hurts my brain. ListWidget operates on an Iterator of a FilterView which filters the underlying List which internally uses a list. I don't want to know how many bugs I have in here.
 
3:09 PM
cbg \o idjaw
@AndyK \o rbrb
Oh boy, my first time doing a survey for my yearly benefit enrollment at work...
 
guys, do you know by any chance why would someone do thing like that
: https://github.com/django/django/blob/master/django/core/paginator.py#L57 (call self._get_page with self as a last argument?
 
@AshishNitinPatil thanks
or should I say "melon"
 
@marxin github.com/django/django/blob/master/django/core/… Because Page needs Paginator instance?
 
@MosesKoledoye I think his question is why is self the last argument instead of the usually first
 
user8167727
@Rawing I build it just for you:

import random
import time
ran = random.SystemRandom()
texts = ['thanks','thankyou','thank']
for i in range(1,1000000):
text = random.choice(texts)
print(text)
time.sleep(0.09)
 
3:18 PM
for me its more about the fact, that self._get_page function has self anyway
so passing it in params is not needed
 
@MooingRawr self being the first is a thing with instance methods. This OTOH has to do with the other class' __init__. self itself has no intrinsic meaning except that it's a reference to the current instance, here.
 
@mini That only produces 999999 "thank you"s. I'm disappointed.
 
user8167727
Its ok.
 
user8167727
You can change the value; change it to 99999999999999999999999999999999
 
user8167727
What???????
 
user8167727
3:20 PM
Its working normal for me.
 
oh, the randomness works fine. It just doesn't produce a million.
 
user8167727
Updating the code.
 
it's as if you didn't feel any gratitude at all, y'know what I mean? :p
 
@MosesKoledoye hmm interesting is there a term for this that I can look up in more detail?
 
@mini - @Rawing's point is that you have an off-by-one error
 
user8167727
3:23 PM
When I put happy emoji in code; it kills the Shell
 
@MooingRawr hmmm, term for what part?
 
Good time of day to everyone :)
 
       return self._get_page(self.object_list[bottom:top], number)

    def _get_page(self, object_list, number):
        return Page(object_list, number, self)
it should look this way for me
 
user8167727
@Rawing now it will produce unknown value

import random
import time
ran = random.SystemRandom()
texts = ['thanks','thankyou','thank']
while True:
text = random.choice(texts)
print(text)
time.sleep(0.04)
 
@mini - please review sopython.com/wiki/…
 
3:24 PM
@mini Good thinking. I can appreciate your display of gratitude now, thanks.
 
user8167727
Ok
 
@marxin Note the doc on _get_page: "This hook can be used by subclasses to use an alternative to the standard :cls:Page object."
 
yeah but then one would need to override _get_page anyway?
and still has access to self
 
That method should be able to take arbitrary args and kwargs
 
I dunno, I cant see the reason :|
 
3:28 PM
It doesn't matter if it has access to self. The point of that function is to work with arbitrary arguments. It doesn't know or care that you're passing self as one of the parameters.
 
user8167727
Still not working for me
 
You can use the Paginator class with your own custom implementation of a Page class.
 
yeah so then you can override _get_page function with any arguments you like
class MyFunkyPaginator(Paginator):
   def _get_page(self, this, is, my, list, *args, **kwargs):
        return MyCustomPage(this, is, my, self, list, *args)
I just cant see why passing self as third parameter would help in anything
 
jjj
cabbageee
 
user8167727
@Rawing you can use tab space when the loops start; this will automatically do it thing.
 
3:33 PM
yeah, I figured out the missing indentation.
 
user8167727
Well I didn't get the page you send me; there was a lot of garbage
 
jjj
hey, a small style-related question: say you have a function which takes either a big file and reads it line by line or a small list. How would you implement the switch? With try, finally?
 
Why not just for line in whatever_the_input_is:?
 
user8167727
@Rawing you earn 27 reputation per day ;😲😲😲😲😲😲😲😲
 
DSM
Iteration protocol for the win!
 
user8167727
3:37 PM
37 today 😲😲😲😲😲😲😲😲😲
 
user8167727
205 per week 😲😲😲😲😲😲😲😲
 
Please stop.
 
jjj
@Rawing uhm and how to be sure that the file is closed then?
 
@jjj when you call the method, put it in a with block?
 
I don't think it's your job to close the file. But if you want to do that, then I guess try: whatever.close() except AttributeError: pass will do.
 
jjj
3:42 PM
Oh, ok. Thanks. It seems that there is some well known modular approach I've completely missed ;)
 
a,b,c,d what is a way to have a dictionary with a.b as key and c,d as value
 
user8167727
@jjj now you need to use my script to give him thanks ....
 
@Rawing it is ;)
 
@mini not necessary, yours is still running :p
 
This is one of those days...
 
user8167727
3:43 PM
Thanks
 
jjj
Ups. I hope its already on pypi?
 
@pythonRcpp that's not hard but sounds like an XY problem
 
@pythonRcpp So the input is [a,b,c,d] and the output should be {(a, b): (c, d)}?
 
jjj
I hate installing from source
 
user8167727
@jjj me too
 
jjj
3:44 PM
;)
 
user8167727
;) ;)
 
jjj
also can it be used to thank @LangeHaare too?
 
@mini Where can I see how much rep I earn on average?
 
user8167727
 
a true hero doesn't expect thanks ;-)
 
user8167727
3:46 PM
It was written there
 
user8167727
They are redirecting to main stackoverflow not chat.stackoverflow
 
user8167727
May I send you a pic???
 
I can't find it :/
please do
 
user8167727
Check It out ibb.co/e0jNFF
 
@Rawing yes
 
user8167727
3:49 PM
It increased in this short time right now
 
user8167727
Believe me now?
 
jjj
@LangeHaare true, but I was also curious how portable thanks.py is :)
 
Oh, that's where it is. That's practically invisible with the dark theme I use.
 
user8167727
@Rawing sending you another one
 
user8167727
Wait for 1 min
 
user8167727
3:55 PM
Check it out ibb.co/hXLONv
 
user8167727
@Rawing It is your id: 1222951
 
user8167727
@Rawing ??
 
Thanks, that's neat info. Not sure why that's on chat.SO though
 
user8167727
Because it is while True loop
 
user8167727
I earn 3 reputation per day 😭😭😭😭
 
00:00 - 16:0016:00 - 23:00

« first day (2461 days earlier)      last day (2476 days later) »