« first day (2924 days earlier)      last day (2023 days later) » 

12:01 AM
Of course, but I mean the summary line specifically.

> it is important that it [the summary line] **fits on one line** and is separated from the rest of the docstring by a blank

https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings
 
@MateenUlhaq I think you have your answer...
 
I suppose, but I've seen some popular projects breaking the convention.

Here's numpy's very first docstring guideline example:

def foo(var1, var2, long_var_name='hi'):
r"""A one-line summary that does not use variable names or the
function name.

Several sentences providing an extended description. Refer to
variables using back-ticks, e.g. `var`.
"""

https://github.com/numpy/numpy/blob/master/doc/example.py#L38

...they have a really strange definition of one-line.
 
12:29 AM
if I want to start a for loop at a certain row of a pandas dp how would I do that?
for r in df['col']:
 
12:45 AM
@ex080 df.iloc[irow:] or df.loc[index:] I believe
 
ok thanks
for ind, col in enumerate(df['COL']):
    if ind>start:
I ended up using this
 
done = []
done.append('y')
print(done)
['y']
this works but done doesn't actually change to ['y'] instead ['y'] is only printed in the terminal
 
Well ur printing it, what else do u expect?
 
true
 
done = []
done.append('y')
print(done)
['y']
done.append('ay')
print(done)
print(len(done))
It's appending like it is supposed to. What were you expecting?
 
12:55 AM
writing deletes the whole code and insert gave similar results
 
What are you trying to do?
 
so like actually changing done = [] to done = ['y']
 
jpp
stackoverflow.com/questions/52864759/… unclear / no mcve / dup / too broad (take your pick)
 
@johnsmith U mean like in your text editor? you want done = ['y'] after you append?
@jpp lol
I like that people still answered it
 
yeah so actually changing the original value of done in the main code
 
jpp
1:05 AM
@johnsmith, The answer is outrageously bad
 
what do you mean?
 
jpp
What's worse is it's written in a way which suggests the poster is an expert / knows it's the right solution
Well, look at the duplicate, 3rd answer.
 
oh you're talking about the post XD
 
jpp
np.vectorize isn't the way, nor is lambda, nor ternary statements
 
ok we're on the same page now
 
jpp
1:06 AM
@johnsmith, sorry tagged wrong person!
 
# Initialize done to empty list/array
done = []
# Add 'y' to end of done list
done.append('y')
# print out done
print(done)
# You get ['y']
done.append('a')
print(done)
# You get ['y','a']
done.append('y')
print(done)
# You get ['y','a','y']
So when you write your code in the text editor, you are kinda giving the python a starting point and it goes line by line running your code.
At runtime (when ur code is running) done does get modified
but u wont see it update back into your code when the program exits.
 
XP i'm actually use this for a url scrape script which takes the value of CurrentUrl = 'URL-being- scraped' and put it in done = []
 
ok then what do u want to do with it
that's easy enough
done = []
done.append('http://www.google.com')
print(done)
 
I looking for it to update back to the code
like making a directory of urls that have been scraped
 
U want to remember which ones you've done
 
1:13 AM
yeah
 
ahhh ok
and u want to remember between each time you run the script?
 
yeah
exactly
 
oh ok, what you can do is save the list/array to a file and then load the file on startup.
 
here's the script example for the code i use to check if the url had been scraped stackoverflow.com/q/52359545/8417724 i'm trying to automatically add to the 'done' urls
 
u can use pickle
 
1:18 AM
i'll read up on it thank you
 
import pickle
import os
#Check to see if pickle exists
if os.path.exists('done.pickle'):
  #Load done from pickle
  with open("done.pickle", "rb") as f:
    done = pickle.load(f)
else:
  done = []

#Add urls to done
done.append("http://www.bing.com")
print(done)

#save done back to pickle
with open("done.pickle","wb") as f:
    pickle.dump(done,f)
Here is an example that will use update the done list for every time
if u want something more specific ask a question and then someone can help you out that way
don't spend too much time on it, better to ask for help and progress quickly.
 
thank you, this is much more then i expected.
and i can't ask question XS
 
1:45 AM
i lost that ability
 
Haha dood don't worry
it'll come back
just keep trying
I've been working all day on my project
 
nice
 
2:06 AM
whoever just went in and upvoted some of my past posts
thank you
 
2:20 AM
np
you had good answers/questions
 
jpp
3:15 AM
stackoverflow.com/questions/52864759/… unclear/dup/no-mcve/too-broad 1 more vote needed!
 
 
3 hours later…
5:51 AM
@jpp yeah it's pretty unclear
 
6:25 AM
stackoverflow.com/a/52852320/3620003 intersting point - why do 3.7+ dicts still trigger that RuntimeError?
Also: cabbage
 
backwards compat I guess?
 
@MateenUlhaq Nothing stops you, but it will look bad in sphinx. If you don't care about that I'd just restrict it to the agreed upon max line size in your styleguide.
 
7:10 AM
Hello
 
cbg
 
7:30 AM
@Arne I've been seeing that everywhere and i'm pretty much a noob what does it mean?
 
The link is in the rules page of this room =)
 
XD there's a lexicon, that's great
 
recbg
 
thats not in there
 
@johnsmith re-
 
7:43 AM
ohhhhh
 
@timgeb Good question. I guess we could take a look at the source code... Pity we can't just ping rhettinger & ask him. ;)
@AnttiHaapala "pyramid does inversion of control via the service locator pattern" I know what each of those words mean, but not when they're used in that order. :)
I did take a look a the Wikipedia article on the Service Locator pattern, but I found it pretty vague. It probably makes more sense if you already know what it's talking about.
 
8:06 AM
@PM2Ring we can't? ^^
 
> Dependency injection is a specific type of IoC.[4] A service locator such as the Java Naming and Directory Interface (JNDI) is similar. In an article by Loek Bergman,[7] it is presented as an architectural principle.
@PM2Ring it is rather that the dependency injection is just one way of doing IoC
 
Does writing routes for a Flask application also count as IoC?
 
8:25 AM
@timgeb He does sometimes answer questions about Python internals, but I haven't seen him around for a while. OTOH, Tim Peters was answering newbie questions quite recently.
 
@timgeb I can answer.
first of all, the list iterator works with an index
 
:facepalm: The answerer freely admits he has no idea what a greedy algorithm is, but that didn't stop him posting an answer to this with 5 different solutions.
 
@timgeb ahha...
 
huh?
 
It sounds like Antti's diving into the source. He may be some time...
 
8:37 AM
Ah, so that was a battle cry.
@PM2Ring +1 for effort -1 for off-topic -> +0
 
so yea I think @timgeb you're onto something there, it does iterate the keys from the new array: github.com/python/cpython/blob/master/Objects/…
hence it shouldn't be as much of a problem...
... also, even the original code is bad in that naturally the iteration can produce garbage, if the number of elements didn't change between invocations
>>> d = {1:1, 2:2}
>>> i = iter(d)
>>> next(i)
1
>>> del d[2]
>>> del d[1]
>>> d[0] = 5
>>> d[3] = 2
>>> next(i)
3
>>> next(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
(python 2)
 
9:03 AM
hello world
 
I thought this would be out there somewhere, and well, it was. Been done twice in the entirety (much more if you drop the plurality though).
Feb 20 '17 at 13:50, by J Richard Snape
Hello, pythons!
Then again, his last name is Snape! :D
 
@AnttiHaapala thanks for diving in!
 
@timgeb idk what good the exception does there... I wish there were 2 kinds of iterators
one unreliable
and one that would throw on all structural modifications
the current model is good for none
 
It could be just an oversight of not removing the exception
 
I mean the exception did not make much sense in Python 2 either... except that
I guess it guaranteed that the same key couldn't be iterated over twice... about that much...
 
user6718998
9:26 AM
Hi there. I was trying to implement multiprocessing on my python script and found some useful examples. Somehow I managed to implement it in my code here: pastebin.com/zHW74JhV. But I have a question: does it compute one part of the image per process? For example: i use 4 processes, 1/4 of image will be rendered by one process. And if it does that, is it vertically or horizontally (row/column) ?
 
user6718998
what happens in case my width is 1023/4 =255, adn 255x4 = 1020, so which process will render the extra 3 pixels ? or are they lost ?
 
i don't even know what to do with this stackoverflow.com/q/52378807/8417724 does anyone have any tips for changing it for better results?
 
The question looks okay to me now. Personally, I'd just leave it be. Editing it again and again "bumps" the question, which isn't that great for something that is (hopefully) already answered.
 
okay i'll let it sit
 
9:44 AM
@Thewise there's no multiprocessing, just MPI
 
and where would the "compute one part of the image per process" happen?
 
@johnsmith What shad0w_wa1k3r said. It's not good to change questions after they have 1 or more valid answers. It's ok to improve the grammar (including spelling & capital letters) and formatting, but don't bump your queations too often, try to fix as much as you can in one go.
 
@PM2Ring True, I just know I need to get this question back up to ask questions again XD
 
@johnsmith The main problem with that question is summed up in the top comment: "What prevents you from using a loop?". Your Python tutorial / text book should teach you how to use loops. That's usually a fairly early topic in any beginner coding course. So if you don't have a clue how to do that, many people will downvote you for insufficient prior research.
 
9:58 AM
@PM2Ring I answered that question
but i guess people can't tell that
 
@johnsmith but that's a bonus for you as an answerer, but not for you as the asker :)
 
that's true
 
SO voting takes care of both aspects, so one can't affect the other by much
 
so do I just add something about looping it in the question
looping in the question*
 
no, like I said, leave that question alone now.
Are you question banned?
 
10:02 AM
alright
 
Those of us who' ve been coding for years may forget how hard it was to learn those basic things when we were first learning (and some people just seem to pick them up quickly). But if you work through your tutorials, and write lots of small programs to test everything you're learning as you learn it, it will gradually all come together. And you'll be able to ask more useful questions. ;)
 
@johnsmith If you're question banned, this should be your guidebook - meta.stackexchange.com/questions/86997/…
 
@shad0w_wa1k3r Yes, he's question-banned.
 
My question is ban?
 
(question banned == banned from asking questions)
 
10:04 AM
oh yeah......
 
Are you sure you're a native? :P
 
me?! nope :-p
 
@AndrasDeak what is it this time
 
just the confusion :D
 
@johnsmith You said before that Stack Overflow isn't letting you post new questions. That's called a question ban.
 
10:06 AM
@AndrasDeak smh
@PM2Ring gotcha
 
if you're question banned I believe they give you a link explaining the question ban
 
I would suppose so, but I wouldn't know :-p (also, if you do know, can you tell me if it's the exact same link I gave above?)
 
@AndrasDeak yeah but it's just like check your spelling and get your (-#) questions to 0
 
ah
I thought they link to the meta shad0w linked
it would make sense
 
I think that was the purpose of that meta post (to be linked to, as a FAQ post)... SMH
 
10:08 AM
this is the link i got
 
ah of course, that one is good, but I guess not comprehensive enough. They probably don't want you to worry about the mechanics of the ban as much, but just give a brief info on what you should avoid doing.
 
I'll probably ask about this on meta
 
@AndrasDeak if you do link the question here
 
user6718998
@AndrasDeak there is definetely multiprocessing happening, since the execution time is way faster than before. At least that's what I think it means. And about computing one part of image per process, how would I achieve that ?
 
@Thewise multiprocessing is a thing in python
you're using parallel execution, multiprocessing even, but it's misleading to say that when you're using MPI
 
10:16 AM
thank you for who ever just up-voted
 
0
Q: Link the question-ban meta FAQ on the question-ban help page

Andras DeakAfter a discussion with a question-banned user I realized that the comprehensive question-ban meta FAQ doesn't seem to be linked from the question-ban help page. The user told me that they are only pointed to the help page, so the existence FAQ was news to them. Could we add a link to the FAQ? O...

@Thewise you would program it such that each process does part of the work themselves, based on their rank
if you have a naked create_fractal(min_x, max_x, min_y, max_y, image, iters) call then each process will call that function in its full glory; there's no magic nor free lunch
If you want each process to only do part of the work you have to tell them to. Each process runs the same code, the only difference is that each has a different rank value. That's it.
 
user6718998
@AndrasDeak well, yes, parallel execution. So for each rank, it should call that function ?
 
for each rank it already calls the function
Imagine that instead of 4 processes you have 4 people to whom you want to distribute the work. How would you do that? You wouldn't tell all of them "compute the sum of the first 100 numbers". What you'd do is "Alice, you compute the sum of numbers from 0 to 24. Bob, you get 25 through 49. Charlie gets 50 through 74. Dave, you get the rest".
so you define an algorithm where everyone has to decide what to do based on their name ID
 
@johnsmith The question isn't good, but IMHO your ignorance about how to do that task with proper looping doesn't deserve 5 downvotes. However, SO isn't designed to give tuition in the fundamentals of a language or programming. But we can help you when you've learned the basics but have some gaps in your knowledge, or misunderstandings you may have picked up along the way. But to get that help, you have to write questions that conform to the SO standard.
 
Note that voting on votes is the worst thing since sliced bread
 
10:27 AM
@PM2Ring I literally answered that question (are you trolling me?)
 
user6718998
so then i should divide the width to the number of ranks (size) and call the function for each part
 
@johnsmith No, he isn't trolling you. He stated some logical reasoning as to why you might have the downvotes (while opining that the downvotes weren't deserved) among other constructive suggestions.
 
alright
 
user6718998
thanks for advice, I will come back tomorrow maybe and tell u what I achieved
 
@AndrasDeak I rarely give sympathy votes, but I do practice relative voting on answers, rather than absolute voting. My goal is to affect the relative rank of answers, and I prefer to do that with upvotes, but I'm no stranger to dishing out downvotes when required.
 
10:31 AM
@Thewise good luck
 
@AndrasDeak Do you mean that choosing if/how to vote shouldn't depend on the existing votes?
 
Yup. Vote on content, not on the percieved "price" of the post
 
@Aran-Fey i wrote html script to the .php because that was part of the program i made to pin point certain words in a long set of data and turned them into bold text so they were easier to read
 
Not piling on with another downvote is fine. Adding an upvote because "it's crap but not -5 crap" is awful. Especially with how votes scale in rep
 
@johnsmith No. It's great that you answered your question. But unfortunately, the downvoters probably didn't notice that.
 
10:36 AM
Sounds like the idealism vs pragmatism debate
are you fine with being an idealist? =D
 
@johnsmith But why are you doing that with the csv module?
(Sorry, chat scrolled right when I clicked reply)
 
@Aran-Fey i was write to row in a excel file before the php and never changed it
 
@Arne what makes you think I'm not one?
 
i wasn't sure if was going with excel file or the php file
 
If you're going to write a php file, don't use the csv module. The answer you accepted is garbage
 
10:39 AM
@AndrasDeak I do give sympathy votes (disclaimer: I didn't do the +1 on that -5), but only because (and when) I like to upvote new OPs dishing out nicely formatted, well-asked question. Never do it with answers because they're supposed to be good, if they aren't, a -1 or a comment (if deserved) should be in line.
(so technically, that may or may not be a sympathy vote)
 
Nicely formatted well-asked questions deserve upvotes easily
 
@Aran-Fey so instead of writing with csv i should have just wrote directly to it
 
(somehow we're now at +3, and I do agree that the question is good (now), but I'd refrain from voting because I am involved in the meta discussion, not sure if that's a good logic)
 
It is
 
@AndrasDeak unsure what that comment is replying to :-p (could you link it?)
 
10:44 AM
> not sure if that's a good logic
 
ah, thanks :-p
 
@AndrasDeak Now that I think about it I don't have an answer
I guess you were an idealist all along, and my perception is just warped
 
11:09 AM
alright fixing it with the default writing method was the best fix for that

file = open('C:/xampp/htdocs/new-site/text.php', 'w')
#content here
file.write(start)
 
cbg
@PM2Ring He wants to binarize a matrix with math, what could be clearer?
Closing in on 45K, just need a few more upvotes on answers I posted 10 years ago
 
@PaulMcG Edit the questions to nump them to the front page. ;) On a more serious note, consider updating where necessary to cover Python 3.
 
I just did that on one a few minutes ago (just put parens on the print statements) - I'll start updating them as they post rep to my profile
 
11:40 AM
congrats on the 45k
 
@PaulMcG nice job
 
Hmmm, that was a suspicious burst of rep, but melon anyway (now I have a bunch of answers to Py3-ize)
 
Wow, some mod is really bored. Got a comment about a typo, I edited and posted a quick “thanks” and not even a minute later both comments are gone
 
you're saying superhuman speed implies boredom? :-p
 
I'm trying to verify this guess via a solid reference, preferably from the docs, but Google isn't cooperating.
Just guessing: the comparison is n==0, and the error message tells us that this is a conditional recursion. — PM 2Ring 11 mins ago
 
11:58 AM
Just did a test, and I think the message is just there to give us a hint when the recursion depth is reached
i.e. which function was called while it happened
>>> class A:
...     def __init__(self):
...         self.parent = None
...     def __repr__(self):
...         return f'{self.parent}'
...
>>> a = A()
>>> a.parent = a
>>> a
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<input>", line 6, in __repr__
  File "<input>", line 6, in __repr__
  File "<input>", line 6, in __repr__
  [Previous line repeated 326 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object
But I don't find anything in the docs about the code which fetches the last-called-function from the stack
 
@shad0w_wa1k3r Yes? I don’t expect that those comments were flagged (not that quickly at least), so that mod went out of their way to find that themselves ^^
 
@Arne That sounds reasonable. Except in the linked example, the recursion doesn't occur in the calculation of the comparison, which compares 2 simple integers, but in an execution path controlled by that comparison. Which is rather useful info.
 
@poke maybe they were on that question anyway?
 
Umm... has any had ipython when writing a loop interactively immediately execute the command, eg: I can't get further than:
 
maybe / probably
 
12:05 PM
Cleaning up is best done proactively (if you have the time :-p )
 
for i in range(10):
    print(i)
 
@PM2Ring Huh, I assumed the comparison was involved in the recursion call. Now I need to dig
 
Normally you hit enter and it goes to another line and you have to hit enter again to execute it and the odd thing is - it's only just started happening... I'm confused
 
Now I feel bad.. :( The author of the competing answer deleted their answer and vandalized it afterwards, hope they don’t feel bad about me being unhappy with their solution :(
 
@JonClements can't replicate on 3.6.5 (ipython 6.2.1)
(goes to a new line, with added indentation)
In [1]: for i in range(10):
   ...:     print(i)
   ...:
temp rbrb, hungry for KFC
 
12:09 PM
@Arne Well, it sort of is, but a couple of operations separate the comparison & the call. Take a look at the dis dump. (I'm on my phone, so it's not easy to do stuff like that).
 
Please don't go serial voting here
 
huh?
 
@JonClements I assume you've tried restarting ipython...
 
In [1]: for i in range(10):
   ...:     print(i)
0
1
2
3
4
5
6
7
8
9
 
Oh. Yeah, don’t do that. Even if you want to help people with reaching the “next big goal”, it will not help at all as serial voting is reversed anyway.
 
12:13 PM
@PM2Ring yup... and opened it in a new shell as well just in case... maybe I've somehow triggered an option somewhere?
 
@PM2Ring I think you're right with your initial assertion
Now I'm really curious how RecursionError builds that message
 
@JonClements If it's an option, it doesn't sound very useful. ;) But I don't know ipython, so I don't know much about its quirks.
 
@shad0w_wa1k3r Umm... I'm using 7.0.1 on 3.6.6... wonder what happens if I specify 6.2.1 to install
Yeah... that behaves as expected...
 
@Aran-Fey That also sounds reasonable, but do you have a ref, or can you verify it in any way?
It means that a stack overflow happened in the comparison n == 0. What's the big deal? — Aran-Fey 16 mins ago
Eg, if we throw in some other operations after the comparison does it change the error message?
 
@PM2Ring Nope :(
Actually:
  File "untitled.py", line 3, in count
    if not str(n < 0):
RecursionError: maximum recursion depth exceeded while getting the str of an object
 
12:28 PM
if not str(n < 0) - that code looks like something that can cause cancer :P
 
It can if you set cancer = RecursionError :P
 
12:43 PM
@Aran-Fey Ok, I'll pay that.
 
hi people. I have a problem with writing to file on raspberry pi. I am reading serial port at 460k baudrate, with 80 byte chunks using PySerial. If I write the data to a file every time I read data, some of the data is corrupted. If I keep all data in io.BytesIO() and later write to file, data is good.
but I don't have enough memory to keep data in bytesio
I was wondering, why can't it write to file properly? I tried flushing the file everytime.
 
@ThiefMaster It could be worse, eg if str(n<0) == 'False': :D
 
This was a tortured comparison I saw in a question recently: if not zero_division_check != True:
 
@nurp We can't answer that without seeing your code
 
>>> str(1==0) is "False"
True
 
12:53 PM
@PaulMcG I don't want to even try to guess at the thought processes that lead to that code. ;)
 
I call it the Double-Reverse-Southern-Hemisphere Inversion logic
 
@PM2Ring I think that's an improvement, because unlike not str(n < 0) it's not always False
 
Cabbage
:-)
 
@Aran-Fey, I will put at pastebin, is that ok?
 
yes
 
1:04 PM
@nurp What Aran-Fey said. But you may need to do a flush before writing the BytesIO data.
 
@JonClements workaround: ctrl+o is force newline
 
@Aran-Fey, I put the code in the link pastebin.com/EQZiTjdh
@PM2Ring hmm, I'll check that. thanks
 
@nurp Ah. You didn't say you were using threading. That makes it a little trickier.
 
do I have to protect the file writing with a lock? they are separate files
 
1:08 PM
@nurp Isn't that the code that works? It's using BytesIO
 
@PM2Ring I tried my best, would you say this is an answer? stackoverflow.com/a/52874423/962190
 
this works, right
sorry, let me make the other version. thought comments could be enough
 
@nurp Can you try dropping the baud rate? Maybe you are just overwhelming the processor with I/O
 
@nurp OTOH, you're doing the reading & writing in the same thread, so that shouldn't be an issue. So doing a flush on the io_bytes should stop the corruption. If my theory is correct. :) But I've never done any serial port work in Python. Or on a Raspberry Pi.
 
I don't see anything wrong with the code, and I don't have a serial device to test it with :(
 
1:17 PM
@PaulMcG, I am testing a device for high speed actually, so I can't drop it. maybe raspberry pi is not a good platform for this then?
 
@nurp Just a simple test that might illuminate whether you are hitting a hardware constraint instead of a software one
 
@PaulMcG good advice. I will drop the amount of data
 
In my work repository, there's a library that is shared among multiple projects. It has a method, get_widgets_from_db(criteria, maximumRows). To avoid gobbling up all system memory, the function raises an exception if maximumRows is higher than 500. But my project needs to get 750 rows.
 
@Arne You comment seems a bit misleading here. RecursionError happens when the call stack exceeds the recursion limit, not "when the interpreter detects a cycle" - there are many times when a cycle is intentional; and conversely others when an RE gets raised when there is no cycle (happens in pyparsing with complex parsers from time to time)
 
Also, I wouldn't dump the io_bytes on every block of 80 bytes. It will be less CPU intensive if you write larger chunks to file, eg 64kB. If that's still to big, try a smaller chunk, but I wouldn't go any smaller than a disk block, which may be 512 bytes, or maybe 2k. The OS should handle disk buffering, so the exact size isn't that important. The goal is to simply reduce the number of copying operations.
 
1:21 PM
I could just edit the function to delete the exception-raising behavior. But then I'd have to go through every other project in source control and verify that none of them are passing untrusted user input into maximumRows, or else risk an attack vector where the user enters sitename.com/widget_search?maximumRows=999999999999
 
@AndrasDeak ahhh thanks... wonder why that appears to be a change in 7.x...
 
@PaulMcG, @Aran-Fey, @PM2Ring thanks. have a nice day.
 
@Kevin Add an optional argument im_the_human_and_i_know_what_im_doing_yam_it_all=False, and then make your call with it equal to True
 
I really seriously thought about that.
 
@PaulMcG I took a bit of liberty, since it's only a comment. OP seemed as if they could understand the concept of a cycle better than bringing up the recursion limit, but I might be wrong. Feel free to join in.
 
1:24 PM
Ultimately I decided to just inline the good parts of the function into my own project. It's three lines long.
 
"good parts of the function".... don't tell me the function was originally 100 lines long or something :)
 
The part that gets widgets from the database is the good part, and that's three lines long. The part that checks maximumRows and raises an exception is the bad part, and that is two lines long.
There is also a blank line, which is neither good nor bad.
 
So the blank line is sort of Chaotic Neutral
@Arne Looks like @Aran-Fey covered it
 
If this was a sitcom, it would be the yellow line painted down the middle of the room, where both characters assert that this is their side of the house, and they will not cross into that side of the house
 
@Aran-Fey whoops, should I delete my comment that had faulty information?
 
1:31 PM
I think any day you delete faulty information from SO is a good day
 
I'd leave it. The whole conversation wouldn't make much sense without it
 
(hmm I tried to word that to make it clear that each character gets a different half of the house, but an equally valid interpretation is that they're both standing on one side of the line, which they have agreed to share, and the other half belongs to nobody. Maybe there is something in that other half. Something... Unnatural.)
 
hello
 
@PaulMcG but I'd end up with barely any answers *-(
 
1:40 PM
\o cbg
 
TIL python has no restriction on the length of a function name
>>> exec(f'def {"a"*1000000}(): print("foo")\n{"a"*1000000}()')
foo
 
@shad0w_wa1k3r nice find - thanks... so looks like nothing will happen until 7.1 proper is released...
 
Why should it? :P
 
It has a limit on the number of indentations..
Just one of things I never found out unless I actively tried to break something
 
xD
 
1:45 PM
I'm pretty sure you can verify whether a string is a valid identifier in O(N) time, so I expect the lexer wouldn't complain about a name of any size
 
I don't know enough about compilers to make a similar statement about indentations D=
 
Yeah, I was just thinking about that. But in the best case, I think parsing nested blocks is also O(N) time.
 
@Kevin TvTropes This Is My Side
 
@PM2Ring Thanks. I went looking for that page myself, but couldn't find a good way to phrase the search query. That would have bothered me all day :-)
Maybe it's an issue of memory rather than time. Maybe a regex that matches an identifier uses O(1) additional memory, but parsing deeply nested blocks uses O(N).
 
can you compile a module that reads data from a csv, does some transformations then puts it into self.data... then have another script import that module and have access to the data within that modules self.data?
 
1:54 PM
Possible issues:
1. Python programs are not 'compiled' in the traditional sense
2. Modules do not have a `self` to assign things to
 
right ok
 
(ok, lots of Python implementations compile to bytecode, but that is automatic and largely invisible to the user, so it's usually best to pretend it's running straight from source)
(ok, you _could_ create an object named `self` in your module and assign attributes to it. But there's nothing special about the name `self` in that context, you could just as easily call it `steve`)
But if what you're really asking is "can I have one module do some work, then store the result in a variable, then access that variable from another module?", then yes, you can
 
that's basically what i'm asking
kinda
 
c:\Users\Kevin\Desktop>type a.py
def do_some_difficult_work():
    return 23

result = do_some_difficult_work()

c:\Users\Kevin\Desktop>type test.py
import a
print(a.result)

c:\Users\Kevin\Desktop>python test.py
23
Tadaa, the result assigned to a.result is accessible from inside test.py
Although this raises the question of why you're doing result = do_some_difficult_work() inside a.py instead of inside test.py
i.e.
c:\Users\Kevin\Desktop>type a.py
def do_some_difficult_work():
    return 23
c:\Users\Kevin\Desktop>type test.py
import a
print(a.do_some_difficult_work())
c:\Users\Kevin\Desktop>python test.py
23
 

« first day (2924 days earlier)      last day (2023 days later) »