Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Jan 1, 2020 15:09
Are dict items rehashed & reinserted when a dict is resized (automatically)?
Aug 16, 2019 20:38
@AndrasDeak @PaulMcG you guys are right. Just tested this. Also I figured out what was going on. The class in question inherits a base class that implements __call__, which then invokes call.
Aug 16, 2019 20:30
Can __call__ (docs.python.org/3/reference/datamodel.html#object.__call__) be replaced with call? I am reading some code this is the behavior I suspect.
Aug 12, 2019 06:56
@Skyler thanks for pointing me to it!
@Arne I see, thanks!
Aug 12, 2019 05:57
@Skyler also it's my first time seeing "salad word"...I have seen "word salad" but it means something compeltely different...
Aug 12, 2019 05:55
@Skyler and cbg?
Aug 12, 2019 05:41
@wim looks like pynapple is a simple package that checks to see if python is above version 3.6 - and to do that, I just need to import pynapple, right?
Aug 12, 2019 05:39
@Skyler that's not meant for me, right? let me know if it is.
Aug 12, 2019 05:32
@wim thanks!
Aug 11, 2019 23:22
I found pypi.org/project/hello-world-py, but it seems to be broken...
Aug 11, 2019 23:21
What's a small python package I can install for testing purposes (like pip, venv, etc.)?
Jan 11, 2019 20:20
huh. good to know
Jan 11, 2019 20:15
ha
Jan 11, 2019 20:15
Thanks though
Jan 11, 2019 20:14
True...though finite time is always the enemy here...
Jan 11, 2019 20:12
new to Python of course...just trying get someone else's code working...
Jan 11, 2019 20:11
Oh I see - so MyClass(bluh) is the syntax for instantiation...
Jan 11, 2019 20:10
That's what codecs.getreader("utf-8") returns...
Jan 11, 2019 20:10
encodings.utf_8.StreamReader is a function?
Jan 11, 2019 20:10
Basic question: can someone explain to me what this syntax means? codecs.getreader("utf-8")(sys.stdin) Is this codecs.getreader returning a function and I'm then calling it with argument sys.stdin?
Dec 17, 2017 20:25
Going on a tangent - it just occurred to me the Linux syscalls are all documented in C. So that means, whichever language (Python, Java, Perl) I use, to use functionality that involve syscalls (like print to stdout), it eventually have to integrate with C code in Linux. Am I understanding that right?
Dec 17, 2017 20:19
Interesting. So if I see module.function(), the code for the function() doesn't necessarily exist in the code for module. It might even not be available, as it's been compiled to bytecode.
Dec 17, 2017 20:15
I see.
Dec 17, 2017 20:14
So the name, at least, must be defined in a python module, right?
Dec 17, 2017 20:13
I mean, os.fork() is a python function
Dec 17, 2017 20:12
@vaultah Ah okay. Thanks. Although, there is one thing I haven't figured out. The function docs.python.org/3/library/os.html#os.fork doesn't seem to be defined in os.py. There is no def fork..., like there is for some of the other functions like def getenv. Why is that?
Dec 17, 2017 19:46
I wasn't sure how it got called in cpython
Dec 17, 2017 19:46
Right, I know fork() is a syscall
Dec 17, 2017 19:45
Okay, but how is that C function "brought into" os.py?
Dec 17, 2017 19:43
@vaultah I see. I was interested in the fork() function actually, which is called in os.py. I presume fork() came from sysmodule.c, but couldn't find it there...
Dec 17, 2017 19:33
@vaultah - how does sys map to sysmodule.c?
Dec 17, 2017 19:27
Hello, I was looking at github.com/python/cpython/blob/…, but I could not find sys.py in the same repo. Where is sys coming from?
 

Java

Dedicated to the discussion of the Java programming language a...
Feb 21, 2019 01:04
Seems like it refers to console output.
Feb 21, 2019 01:04
Does anyone know what sout stands for?