« first day (2896 days earlier)      last day (2056 days later) » 

2:14 PM
I'm not comfortable responding to a question that has files containing "Ransomware" in the pathname… stackoverflow.com/questions/52427070/…
 
Devil's advocate: we should help ransomware authors with their projects, because a high-quality ransomware project scrambles files in a recoverable way, but a buggy ransomware project might scramble them in an unrecoverable way. The typical victim would prefer the former over the latter.
 
Is Kevin True Netural?
 
That said, I think we can go ahead and let this particular OP flounder, because in all likelihood his project won't even execute without our help. A ransomware project that does nothing is the best-case scenario
 
Or Lawful Neutral?
 
definitely chaotic
 
2:27 PM
Chaotic Selfish
 
Definitely not chaotic based on the "against broken ransomware" argument.
 
ask him the same thing tomorrow
 
Good point!
 
Depending on my mood I waffle between 1) looking for game-theoretically optimal cooperation strategies with real-world applications, and 2) thinking "yeah, I'd probably burn the rest of the world to the ground if it would make my own stately pleasure dome 10% nicer"
1 is necessary for 2 because you can only get a stately pleasure dome in the first place if you can credibly signal that you're the type of person that cooperates in decision problems, while you secretly plot to betray everyone in the climactic round
@AndrasDeak, here's my program from Tuesday, except it considers all eight neighbors instead of just the ones in the northerly directions. As we suspected, the obvious gap is no longer evident.
I'm not 100% convinced that the density of points at the center is the same as at the edges, but it's close enough that I'm willing to move on to a different part of the project and revisit this if/when a bias becomes evident in a different style of visualization down the line
 
@Kevin dancy dancy!
 
2:39 PM
@Kevin nice work, what causes the simultaneous change in speed?
 
density looks reasonable to me, which of course means nothing coming from a physicist
 
@W.Dodge The points are following the path of lots of interconnected quadratic bezier curves. Bezier curves tend to "accelerate" towards the center of the curve, and decelerate near the ends.
That's what I want to address next. I'm happy to permit my points to have non-constant velocity, but I'd like to somehow stagger it so they don't all speed up and slow down at the same time.
 
are the curves closed?
 
If all of the curves were drawn, it would make a single connected shape.
 
I'm wondering if you can introduce shifts along the curve
Probably easier to reparametrize your curve. How is a Bezier path defined?
 
2:45 PM
hey guys whats the exact difference between cpython vs pypy in terms of compilation - interpretation - execution pipeline? Any link explaining / contrasting their architecture?
 
rbrb good people of the sopython chatroom :)
 
en.wikipedia.org/wiki/PyPy says that PyPy is sometimes faster than CPython, which surprises me.
 
yess...I read that in a lot of articles
 
I guess it makes sense, since it operates on a restricted subset of Python, so it can perform all kinds of shortcuts based on assumptions that you can't make in unrestricted Python.
 
It is. I think it runs through twice and optimizes
JIT and/or whatnot
*mumble* adaptive *mumble*
 
2:49 PM
but I want difference specific to "compilation-interpretation-execution pipeline", not performace comparison...
I know cpython compiles source to bytecode and then interprets the bytecode at runtime...
But then what that pypy JIT does differently?
 
May 14 at 17:55, by abarnert
PyPy continues to amaze me. I tried to throw random values at each loop and then subtract out the cost for randomizing, but I forgot to include negative numbers in the range, and it appears to have optimized out the calls to abs. Anyway, it It takes 41ns for max, 27ns to 50ns for or (depending on short-circuiting again).
@Mahesha999 I don't think cpython is JIT in the usual sense
when I hear JIT I think "optimized compile for the specific type of inputs"
 
I did not say cpython is JIT
 
which might or might not have any truth to it
oh OK, I misunderstood, sorry
 
This is probably quite difficult to quantify in a numeric way... Suppose PyPy could execute for loops a hundred times faster than CPython, but its while loops were fifty times slower than CPython's. Even with hard data of this nature, you can't draw any conclusions about the runtime of the average program, because you don't know how many while loops and for loops an average program has.
 
I'm pretty sure JIT was the motivation behind PyPy
 
2:51 PM
please please no performance comparison
 
hmm, OK, cpython is not JIT at all: JIT is compiling before calling. Python compiles on import
I know there's a peephole optimizer that does simple things
 
"Well why don't they just publish a table with the comparative speed of for and while loops?" you hypothetically ask. That's a toy example. The real analysis might have hundreds of comparisons, all at the level of "a LOAD_FAST instruction preceding an absolute jump in a context with at least three frames may be 17.7% faster in PyPy, assuming a FAT32 architecture"
 
Lets first understand cpython
------------------------------------------------
when we run python abc.py, it "compiles" py source to bytecode and then interprets the bytecode. What does it exactly mean by "interprets the bytecode"? Converts the bytecode to machine code and executes it?
 
Also note that I said "compiles" in last comment...it sounds me like JIT only!!! "JIT is compiling before calling."
Isnt it?
 
2:54 PM
@Mahesha999 that's my uneducated impression, yes, i.e. JIT is compiling right before calling
 
@AndrasDeak yes to me? if yes, to which of last two comments?
 
but if you have import d in abc.py then d.py is compiled at import
 
@AndrasDeak yup that I know
 
JIT is compilation with an attempt at optimisation
 
when cpython compiles it has no idea about the number and type of inputs
 
2:55 PM
CPython loops have no idea what they will encounter at run time so nothing can be optimised
 
@AndrasDeak as you may know, quadratic bezier curves are defined by four control points, two of which dictate the position of the curve's end points, and the other two dictating the slope of those end points.
My program generates a sequence of random points, which correspond to the slope-defining control points. Then I calculate the midpoints of those points, which correspond to the position-defining control points. Then I iterate T from 0 to 1 and plot bezier(T) for each of those curves, and render them on the T*64th frame of the gif.
I don't know if this answers your question.
 
If they have an idea what data types might be encountered, then certain things can be optimised to account for this. Exactly what gets optimised, I'm not sure
 
(I'm only vaguely aware of the points which can be pulled to and fro in inkscape and how that affects the curve, and that's about it)
@Kevin I think it does. For each point choose a random T0 between 0 and 1? But then you need to extend the rest of the motion to the next curve...
 
I think you're on to something. If I can somehow break the one-to-one correspondence between T and the frame number, then that should introduce the staggering that I need.
The trick is introducing staggering while still ensuring that one curve can "hand off" the point to the next curve without an interruption in time or space
Like my last problem, I don't think this will turn out to be conceptually difficult, it's just tricky to wedge it into my existing program design
 
Are your points such that T=1 of one point always corresponds to the T=0 of another point?
 
3:00 PM
Yeah.
 
I see.
then no, you should reparametrize your curves :)
instead of linear T use a nonlinear one that goes fast -> slow -> fast
T_to_index ~ atan(T)
or just a linear thingy, something simple first
 
Hmm, yes. If I play around with functions that satisfy "f(0) = 0; f(1) = 1", then I could probably find one that makes the points move at constant speeds. Or at least, close enough that a human wouldn't notice.
 
(I mean T_to_index = {a1*T if T<T1, a2*T+c2 if T1<=T<T2, a3*T+c3 if T2<T}, something continuous like this where a1,a3 < 1 and a2>1
Yeah, bit spicing it up could be enough to make it seem smoothish. But the fact that the points move in unison makes it a bit harder, I mean noticing the rhythm easier.
still less work than staggering the points
 
wim
The comparisons where PyPy is outperforming CPython are odd, because they use pretty un-CPythonic code in the benchmarks
e.g. situations where any sane Python developer would be using numpy or cython instead
 
Is pypy stacked?
 
3:14 PM
In the sense of "does it depend on the C stack the way that CPython does and Stackless Python does not?"? My guess is yes, or else its Wikipedia page would mention it
 
@Mahesha999 "Converts the bytecode to machine code and executes it?". No. Python bytecode is the machine code of a virtual stack-based machine. The CPython interpreter executes that bytecode on the the virtual machine. Sure, ultimately stuff gets done by the actual hardware CPU executing hardware machine code, but you should not think of the virtual machine as translating bytecode into hardware machine code.
This article gives a brief introduction. It's not fantastic, but it should give you the general idea.
 
@Kevin yeah, in that sense. Thanks.
 
wim
@AndrasDeak yes
the way it works is actually pretty interesting
it makes runtime assumptions about various types and bounds
and, for safety, it checks the assumptions are holding during execution
sort of like an assert statement with consequences
assuming the assumptions hold, you get fast compiled performance
if they fail, you get kicked back into a slow-but-correct python runtime
 
3:31 PM
Kicked back to CPython?
 
 
wim
hmm, I don't think they use CPython.
 
@wim I think that's why it's called pypy
(and why the logo is a ouroboros)
 
Ah, that makes sense
 
wim
I'm a bit hazy on how the RPython stuff works
 
3:36 PM
Here's a graph of the velocities of three randomly generated bezier curves. Noteworthy observations: some curves have sharper humps than others. A curve does not necessarily start and end with the same velocity. Curves do not possess the same maximum velocity as other curves.
This makes the strategy of "reparametize all curves so they have smooth velocities" harder, since a transformation that smoothes one of these curves may not work on the others.
... But I'm not completely confident in this data. I think my implementation may be buggy because if you had asked me five minutes ago, I would have said that bezier curves always have 0 velocity at T=0 and T=1.
 
@Kevin if you can compute that velocity we could reverse-engineer the time transformation needed to get a constant velocity. Since const = v(t) = ds/dt = ds/dT * dT/dt = v(T)*dT/dt, from which dT/dt = 1/v(T) from which t = int v(T) dT. Oh yeah, this is called the arc length parametrization of a curve :)
@Kevin with 0 velocity they'd never move
 
Hmm, to test your theory I will require a tortoise and an arrow
@AndrasDeak Hmm, that's promising.
Hmm hmm hmm
 
Yey, that's the last constraint implemented in my optimiser. Super-productive day :) A 6 month slog finally coming to an end.
 
What I could do is: take lots and lots of samples of the complete curve. Let's say, an order of magnitude more than I am currently using right now. Then I pick elements out of that list so that successive elements have as close to constant distance as I can get.
Effectively giving me arc length parameterization without actually doing any calculus
 
sure
 
3:50 PM
I could even interpolate between sample points to get perfect constant distance. luckily bezier curves tend not to fluctuate wildly, so that should give results quite close to the real curve
 
Interpolating dense points is...computing arc lengths ;)
 
[I have no idea what I'm doing dot png]
 
well, close enough I mean
 
@Kevin Didn’t know you were a dog as well
 
I have many guises.
I think I have enough of a concept to actually write some code now.
 
wim
4:10 PM
is that a safe way to monkeypatch?
>>> class A:
...     def foo(self):
...         print('hello')
...
>>> class A(A):
...     def bar(self):
...         print('world')
...
>>> a = A()
>>> a.foo()
hello
>>> a.bar()
world
 
Not if the original class uses super(A, self) anywhere
 
The final A class will have a differently shaped MRO than if you had just defined foo and bar in the original A to begin with, but I feel like well-behaved classes shouldn't care about that
@Aran-Fey Hmm, true. Does zero-argument super still work?
I dislike all versions of super that have more than zero arguments, so this is just another strike against them
 
Yeah, because that's equivalent to super(__class__, self)
 
rb folks
 
Cool. I wasn't sure if the dark magycks of zero-argument super depended on inspecting the namespace that the class was defined in, in which case it too would be confused by a redefinition of A
 
wim
4:18 PM
@Aran-Fey ...is it?
 
@Kevin It's explained in why is super magic?. Referencing super or __class__ in a method will automagically create the local variable __class__:
class Demo:
    def with_super(self):
        super()
        print(locals())

    def with__class__(self):
        __class__
        print(locals())

    def with_nothing(self):
        print(locals())

demo = Demo()
demo.with_super()    # {'self': <__main__.Demo object at 0x7ff5f97434a8>, '__class__': <class '__main__.Demo'>}
demo.with__class__() # {'self': <__main__.Demo object at 0x7ff5f97434a8>, '__class__': <class '__main__.Demo'>}
demo.with_nothing()  # {'self': <__main__.Demo object at 0x7ff5f97434a8>}
@wim Pretty sure.
Well, more accurately, it's super(__class__, name_of_the_method's_first_parameter)
 
wim
I will not be surprised if you can detect the difference, somehow
 
Now this is interesting:
class Demo:
    def meth(self):
        __class__ = Demo
        super().meth()

Demo().meth()

# Traceback (most recent call last):
#   File "untitled.py", line 8, in <module>
#     Demo().meth()
#   File "untitled.py", line 5, in meth
#     super().meth()
# RuntimeError: super(): __class__ cell not found
 
4:43 PM
meth(): not even once
3
 
I never hear the term "cell" in any context other than discussion about the magic of super, and I can't deduce its meaning from just one data point. docs.python.org/3/c-api/cell.html only clears things up to the extent of "it has something to do with variables and scope"
 
AFAIK there's some distinction between "cells" and "freevars" (that I don't understand), but cells are basically the things that hold a function's closure variables
 
> Closure cells refer to values needed by the function but are taken from the surrounding scope.
 
>>> def f():
...  x = 3
...  def g():
...   return x
...  return g
...
>>> g = f()
>>> g.__closure__
(<cell at 0x7f45720ce8e8: int object at 0x7f4572bf8420>,)
>>> g.__closure__[0].cell_contents
3
 
My mental model is "if a variable is used only in the scope that created it, then the compiler does not create a cell. Otherwise, [???]"
Perhaps the cell object is useful here because it prevents x's refcount from dropping to zero once f() finishes executing
Just that alone would justify its existence
KevinScript has closures but I don't remember how I implemented them. I may have been possessed by an otherworldy force that's smarter than I am.
 
wim
4:55 PM
From the c-api page you linked:
> Cell objects are not likely to be useful
 
;_;
 
tfw you write a SO question and figure out the answer when you're 90% finished writing...
 
Relatable
 
I posted it anyways ¯\_(ツ)_/¯
 
I destroy all of my 90% complete questions, so nobody can ever discover that there was a fact I did not know.
 
4:58 PM
Shenanigans:
class A:
    def meth(self):
        print('A')

class B(A):
    def meth(self):
        print('B')

class C(B):
    def meth(self):
        nonlocal __class__
        __class__ = B
        super().meth()

C().meth()  # output: A
 
wim
That's fine - sometimes I'll post questions that I 100% know the answer to, just because it seems like a good Q to have on site.
 
Then, that night, I go out to the crossroads off of the old highway. I take the sky lantern out of my passenger side seat. I light it, and whisper my ignorance into the flame. Then I release it into the sky.
 
wim
vaulthah'd
 
The lantern flies up and takes its place among the stars. Every point of light you see is a quantum of human progress. Slowly, the dark is losing.
 
So much puzzle potential wasted... "Create a closure without nested functions" would've been a fun one
 
wim
5:31 PM
10 points for Yury Selivanov
 
On an aesthetic level I'd prefer lambda to have exactly as much power as any proper function with a body containing only a return statement. But on a practical level I have no use for an async lambda.
 
I've never done anything with async. Am I missing out?
 
I tried using async yesterday in order to circumvent the maximum recursion depth, but it didn't work, and I suspect that my approach was doomed from the start
 
@Aran-Fey Sounds all-inclusive to me, either you're using async, or you're async with async. ;)
 
The only thing I've done with async is make a promise that I will learn how to use it in the future
 
5:40 PM
Making promises is how async works, right?
 
(I probably should have specified a timeout)
 
wim
@Aran-Fey yes
 
Not really sure what I'd use async for, though. Maybe as a replacement for threads in a GUI program?
 
I should like async, because I like coroutines, and if you have async, then you don't have to write your own coroutine framework. But I also like reinventing frameworks, so.
 
wim
this stuff came way too late to Python
Python probably lost a big chunk of developers to golang because they took so long to get a coherent async story in place
 
5:45 PM
@Aran-Fey it performs really well in IO tasks
Network requests in particular
 
I see async and the only thing I can think of is someone saying "I think" with a horrible horrible accent
Mostly getting every other item in a list, right?
 
"How come my function, which has an unconditional return in a loop, is only returning one value?" is a pretty common question, but I don't know if we have a canonical target
 
@vaultah Good point. I have one or two programs that upload a lot of stuff onto the internet... guess I should learn asyncio one of these days
 
I think they revamped the asyncio docs a few days ago
So now may be a good time to start
 
Last time I read them they were... .... ... not helpful. Like they were written for people who already know how asyncio works.
 
5:55 PM
Yeah
 
I was somewhat stymied by the asyncio docs because all of the examples used asyncio.run, which does not exist in 3.6, which I am using
 
Only took me 20 minutes of quiet anger to come up with the bright idea of looking at the 3.6 version of the docs
 
6:12 PM
I submitted a PR and used "backport" correctly. I feel like a grown-up!
 
wim
yeah I actually noticed it was looking better today when reading about some of the "provisional" stuff they added in 3.7
another 10 points for Yury, this guy on fire 🔥
 
uh oh... has someone been playing with matches and petrol again? :)
 
6:29 PM
@Kevin I believe the reason you think that the density in your beehive is off is that in the initial state there are random clumps and anticlumps, and since the points spend more time near the start and the end of the period these anticlumps seem more prominent than merited
 
Quite possibly
 
7:16 PM
cbg
 
Shall I try to put everything inside classes or only when it's necessary needed?
 
.. the latter
Well, there's this phase where someone learning OOP will try and fit everything into a class, and it can be a worthwhile learning to do it, but invariably people tend to not do that
 
@EnderLook turning that on it's head... would you generally do something if it wasn't needed? :p
 
@JonClements You have right, but since I learned the existence of classes I don't know why but I have the feeling that everything should be inside a class... just to make more clear the code
 
Hmm, I wrote a comment asking whether the OP's tags were appropriate, and they self-deleted. Here's hoping his reasoning was "oh, by thinking clearly about the problem, I figured it out, so nevermind" and not "If oafs like this Kevin person are going to attend to my problem, I'd rather not even get a solution, so nevermind"
 
7:21 PM
Definitely don't put everything inside a class... you really don't need a Michael class, for example...
 
wim
What should I do with this? delete, or keep?
 
depends. do you want a peer-pressure badge?
 
wim
no
 
I'd be inclined to keep
 
@wim I say keep it. I don't agree with Martijn's dupe.
 
wim
7:23 PM
can't see any obvious reason for the downvotes
 
won't it be roomba'd at some point or does the duplicate closure prevent that?
 
stackoverflow.com/questions/52431667/… stubborn gold badger refuses to admit his dupes don't answer the question
 
wim
I do agree with the dupe (on my question, not that regex one)
 
Any question that could conceivably be interpreted to mean "what was the intention of the language developers when they did..." will get negative attention
Mostly because posts that actually ask that kind of question tend to become subjective quagmires
 
I've seen that particular gold badge owner act like that a few times already. I've been involved in reopening much too quick closures from them often enough that I remember their name.
 
wim
7:25 PM
my mistake was thinking it was explicitly allowed
in fact, it was just "not not allowed", which is different
and would have been a perfectly acceptable answer to me, but was already mentioned on dupe..
 
The average SO user is clueless about what sort of questions are allowed :-I
Or are you saying "I thought [a for b in c if d if e] was explicitly allowed"
 
Quick question about the python interactive shell
I'm sure I'm not the first one to be in the situation where they are typing a long snippet of code, only to accidentally press the up arrow key and lose it
is there a way to get what you were typing back?
 
wim
@Kevin yes. but it turned out to be just a harmless side-effect of allowing multiple for
 
@J.L.Louis I thought the advice for that situation was "when you're in that situation, write in a file"
 
@J.L.Louis start using an improved shell such as ipython
 
7:29 PM
@FélixGagnon-Grenier I must've missed that then
 
@Aran-Fey reopened
 
also I can't repro, what happens when you press up?
because I can press down again and get back what I was working on
 
It recalls previous typed snippets
 
Ditto, I don't recall a shell where that didn't work.
 
... rly?
I generally lose a command when pressing up nvm
 
7:31 PM
@FélixGagnon-Grenier with downvoted posts there's 1-year roomba I think
 
Anecdote: I'm in the Windows command prompt and when I press up it goes to my previous statement and when I press down nothing happens
 
What kind of command are we talking about? I tried with a multiline tuple. Let my try with a def
yup, downarrow works still
yet another reason to use linux
 
Hm I'm using the default python shell on windows
down arrow doesn't recall what was being typed
oh well, I guess I'll try ipython
 
Me and JL are in the same boat. I cope with this problem by using a text editor for any code that would be painful to rewrite
 
@FélixGagnon-Grenier nevermind, according to the FAQ answers on dupes will prevent roomba
@J.L.Louis either that or a jupyter notebook; similar but different beast (the latter is a spin-off of the former)
 
7:36 PM
Windows kind of has down-arrow support. I can type 1+2 and Enter and 3+4 and Enter, and then press Up twice to get back to 1+2, and then down once to get to 3+4. But anything I typed without submitting with Enter is just gone forever.
 
sounds like premature optimization
As in, that line is discarded prematurely. Have you considered binding it to a name in order to preserve its nonzero reference count?
 
I would never do that. The garbage collector demands tribute.
 
woa. TIL tuples can be used as keys in dicts. how useful.
 
@FélixGagnon-Grenier they are immutable sequences so eligible to be keys :)
 
my_dict[x,y] isn't just for fancy numerical libraries, us regular slobs can use them too
 
7:44 PM
\o/
 
In terms of semantics, what constitutes the context manager? Is it with on its own, or the combination of with and the __enter__ and __exit__ methods. In my head, __enter__ and __exit__ are passive in the whole thing, and "context manager" is synonymous with with
 
Good question.
 
I would say the context manager is the object returned by the expression in the with statement. e.g. in with open(s) as f:, the file object is the context manager.
 
I ask because the comment here doesn't sound correct to me
 
@FélixGagnon-Grenier Very useful. Here is an example I did a while ago that uses dicts with tuple keys for solving a couple of Exact Cover problems: polyomino packing and graph colouring.
 
7:52 PM
> A context manager is an object that defines the runtime context to be established when executing a with statement. The context manager handles the entry into, and the exit from, the desired runtime context for the execution of the block of code. Context managers are normally invoked using the with statement (described in section The with statement), but can also be used by directly invoking their methods.
 
@PM2Ring wow :)
 
funny, I wondered about the same thing yesterday
 
@FélixGagnon-Grenier Thanks. :)
 
@roganjosh I'd say "prefix returns a context manager when called" would be more correct
 
7:55 PM
I always end up having to implement half baked "coordinate" types when having to deal with mapping or graph, the tuple is so much simpler
 
lambda: 23 returns an integer, but it is not itself an integer
 
cbg all
 
But, hmm, some context managers are defined so that they return themselves.
 
context managers are one of my favorite Python features
def __enter__(self, *args): return self boom, done
 
that reminds me I wanted to look something up about nullcontext
 
7:59 PM
"prefix is a context manager" may be approximately as correct as "defaultdict is a dictionary". defaultdict is a type, not a dictionary, but from context one may understand the statement to mean "defaultdict inherits from dictionary" or "instances of defaultdict are also instances of dict"
 
It seems that ipython is no longer being shipped as a standalone program?
 
So if prefix is a class that implements __enter__ and __exit__, you might reasonably call it a context manager, even though strictly speaking only instances of prefix are context managers
 
The numbered statements in docs.python.org/3/reference/… suggest to me that the "context manager" only exists when all the component parts are combined
 
@J.L.Louis define "standalone program"
 
@J.L.Louis you can just pip install it
 
8:00 PM
with on its own is just an intention to define a context manager
 
when you install ipython with pip you get ipython or python -m IPython
 
@Kevin I've been playing around with your Bézier curve problem. You said you were using quadratic Bézier curves, but I think they're actually cubic, since you have 4 control points. Anyway, Wikipedia has an equation for the derivative. From dx/dt and dy/dt we can get the rate of change of arc length, ds/dt, using Pythagoras: ds/dt = ((dx/dt)**2 + (dy/dt)**2)**0.5.
We can then use that to step along the curve using delta_t = k / (ds/dt) for suitable k. The only problem is that we need to determine a good constant k to get the number of steps we want and to not overshoot the end of the curve. And we have to keep delta_t small, as usual in any numerical integration procedure.
 
I just remembered using it as a windows console once upon a time
 
@PM2Ring Oops, I got the terminology backwards. I thought "cubic" implied three control points, since cubes have three dimensions; and "quadratic" implied four control points, since "quad" means four.
 
maybe I'm not remembering correctly
but @AndrasDeak
@JonClements @Kevin
thanks!
 
8:03 PM
@Kevin No worries. I've been doing some experiments using Tkinter. But at this stage the code's too ugly to post. :)
 
No my arrow keys don't do anything. Thanks IPython! :)
Now8
 
This derivative equation is news to me. This should come in handy :-)
 
@J.L.Louis they'll start doing things once you start accumulating a history
but the arrows should be reversible...
at least on linux :P
 
@AndrasDeak I mean after I begin to type something
No need to worry about losing progress
 
ah, yes
you can start typing out multiline code and navigate the lines with arrows
start typing out a function def, then go back to editing its args
 
8:06 PM
Yeah! Such simple functionality, so life changing.
 
read up on some tutorial or similar, it has nifty convenience features
 
Cabbage
 
hi how can i connect to raspberry pi with ssh when i am not in the same network? i have a apache server and portforwarding and a domain on the raspberry pi.
i thought
ssh domain:port pi@local_ip
but this does not work
 
Nice :)
 
@KTWorks that's only gonna work if you have ssh or blanket port forwarding
you can't ssh over http(s), that I'm aware
though if your ssh server is listening on port 443 you can ssh over the https port
which is handy because it looks just like https traffic to most proxies/firewalls
 
8:09 PM
port is 9933
what should i do?
 
@jmd_dk there are several physicists here, and one that uses mpl a lot :)
 
10
Q: SSH access from inside and outside a LAN using the same terminal command

AeronaeliusI have a Raspberry Pi (RPi) and I am making remote connections to it using ssh. I have managed to set up ssh correctly such that I can access the RPi both from a local area network and from the internet (using a specific port that I opened on my router). Assuming an user name john and a RPi name...

ssh -p 1234 john@12.345.67.89
ssh -p 1234 12.345.67.89
i dont understand why there is no local ip from the raspberry
 
@jmd_dk There's a reason for the big version jump:
yesterday, by Andras Deak
> Happy to announce Matplotlib 3.0.0!
This is the first version of Matplotlib to only support Python 3.
 
@PM2Ring If there is one I haven't found it yet. I am going to search deeper and, if I found out something, I will let you know.
Even the docs are not very clear about it. They say they added some features, but I think this features won't justify a new major relase.
 
8:27 PM
@Aran-Fey making quite the close-vote duo on that type of question :P
 
@CarloFedericoVescovo The reason is explained in Andras' message that I quoted: it's purely because Matplotlib is now Python 3 only. Also see the answer of jmd_dk's question stackoverflow.com/questions/52432588/why-matplotlib-3-0
 
@roganjosh Yup. Not having to search for a dupe is nice (:
 
:)
 
Usually if an answer I give is not well received due to me missing the mark (or being lazy) I'll delete the post. This particular one I feel adds value and I'm inclined to leave it despite the downvote. However, thought I'd ask if there was something obvious I'm missing that makes what I've done an answer that is not useful. As it is, The question is poorly produced and that might have implications on my answer... I'd appreciate honest feedback if you care to look
 
@piRSquared the answer is heavy on Pandas and the question doesn't mention it. Other than the tag, there's no evidence for pandas IMO, so that might be why
 
8:37 PM
@piRSquared I don't know Pandas, but it looks ok to me. My guess is that the downvote is because you're answering a no-effort question.
 
If someone didn't read the tags then it looks very unusual
 
@roganjosh It's got a pandas tag.
 
@PM2Ring as I said, "Other than the tag, there's no evidence...."
 
Right. It's getting late here, and my reading skills are starting to fade. :)
 
:P
 
8:39 PM
rbrb @PM
As I've said, I'm inclined to leave it because I think it adds value. If I'd done something lame but didn't see it, I'd delete it upon being told.
 
I don't agree with downvoting good answers to no-effort questions, unless it's a really basic question that anyone with a week of experience ought to be able to answer. I try to encourage OPs to post some evidence of effort. But sometimes it's reasonable that they have nothing to show because it's a tricky problem and they don't know where to start.
 
In this specific case, it does not seem to be overly tricky... I also don't agree with downvoting answers solely because the author decided to answer a close-vote worthy question, while I indeed have done it time and again. (not my downvote @piRSquared)
 
(-: I like the #NotMyDownvote
 
#NotMyDownvote
lol I'll use that all the time :) I sometimes end up explaining to downvotee why someone could have downvoted, I'll lead up with that
 
If I have a ndarray (2d) 500 x 500 and I want to print it similar to '\n'.join(row) is there a quick way for numpy, I know I can increase the set_printoptions threashold, but that doesn't print the whole row in one row... if that make sense...
 
8:45 PM
#NotMyDownvote #JustSayin #My2cpIfEnglishCurrencyWorkedWithCentsAsLowestDenomination
 
Folks aren't looking for "effort" because they think displays of struggle are some sort of magic pixie dust, able to turn a terrible, useless question into gold. They're looking for effort because the lack thereof is the most blatantly obvious hallmark of the thousands of terrible, terrible questions asked every day on Stack Overflow.
 
@MooingRawr I don't get what your after
 
let me dpaste something up
 
@MooingRawr You must have a very wide screen & a small font if you can fit 500 numbers on one line
 
8:47 PM
@PM2Ring In the spirit of "welcoming" I have changed my initial comment to, I guess, passive aggressive. "Please show what you have implemented from your research" or something along those lines. The implication being you have obviously tried something, right? without saying it. I'm trialing it.
 
dpaste.com/1X2KE4X right now It's printing out like that
ideally I want each sub [ ] to be on one line
 
Yeah. I generally say something with that implication, eg "What does your code currently look like?"
 
Let's Golf what is the most succinct way to generate n tuples [(0, 1), (1, 2), (2, 3), (3, 4)... (n - 1, n)]
 
and even more ideally get rid of the quotes but I guess here's my code while I'm at it dpaste.com/069T1K9
You can call the first function and it's the output I wish to have, second AsciiWithNumpy is the one I want to fix but life stinks
 
[(i, i + 1) for i in range(10)]
 
8:50 PM
also you need a picture called test.jpg or w.e
 
@piRSquared golfing with PEP8? (i, i + 1). Whitespace! <shudder>
 
lol... yeah more as a demonstration of what I mean and setting some sort of a bar
I'm assuming we can all mentally remove whitespace
 
list(enumerate(range(1,10)))
 
[*enumerate(range(1,10))]
 
kevin'd :\
 
8:53 PM
yeah, but that was me adding [*...] to your answer
 
I don't think I can go lower than that lol
unless there's an enum function somewhere deep in Cpython that was left in there for debugging purposes that functions the same as enumerate
 
^ I'm looking for enum :P
 
@roganjosh We prefer a neater conceptual version of golf in room 6. :) Chat markup is a PITA, so we don't need to do stuff to make code even more unreadable.
 
^ more civilized (-:
 
welp back to my problem, I look forward to seeing if someone has a better answer than I do
 
8:56 PM
For some reason I see that comment being said in a period drama. "We don't don't like the barbaric sport of removing whitespace here" said in some stately home
 
@roganjosh we used to call it code croquet
 

« first day (2896 days earlier)      last day (2056 days later) »