[-] radarsat1@lemmy.ml 6 points 1 year ago

my favorite part of that video is when he says (paraphrasing):

this is like a video call, and that's cool.. but we can do so much more.. like, we can ... have meetings

such vision :)

[-] radarsat1@lemmy.ml 88 points 1 year ago

I spend my days in emacs and terminal emulators and I want this very badly in a laptop form factor so I can comfortably work outside.

[-] radarsat1@lemmy.ml 5 points 1 year ago

I would argue that what's going on is that they are compressing information. And it just so happens that the most compact way to represent a generative system (like mathematical relations for instance) is to model their generative structure. For instance, it's much more efficient to represent addition by figuring out how to add two numbers, than by memorizing all possible combinations of numbers and their sum. So implicit in compression is the need to discover generalizations. But, the network has limited capacity and limited "looping power", and it doesn't really know what a number is, so it has to figure all this out by example and as a result will often come to approximate versions of these generalizations. Thus, it will often appear to be intelligent until it encounters something that doesn't quite fit whatever approximation it came up with and will suddenly get something wrong that seems outside the pattern that you thought it understood, because it's hard to predict what it's captured at a very deep level and what it only has surface concepts of.

In other words, I think it is "kind of" thinking, if thinking can be considered a kind of computation, but it doesn't always capture concepts completely because it's not quite good enough at generalizing what it's learned, but it's just good enough to appear really smart within a certain distribution of inputs.

Which, in a way, isn't so different from us, but is maybe not the same as how we learn and naturally integrate information.

[-] radarsat1@lemmy.ml 0 points 1 year ago

We use Notion at work and one thing that worries me is how the hell I'd make a local backup of all the data we're putting on there. If there were a way to import my Notion data into something like this it would make a fantastic solution.

1
submitted 1 year ago by radarsat1@lemmy.ml to c/python@lemmy.ml

Let's say I have a context manager that provides a resource that then mutates on exit:

from contextlib import contextmanager

@contextmanager
def context():
    x = ['hi']
    yield x
    x[0] = 'there'

I found that if I want to make another context class that uses this, such that the context (before mutation) is valid, I have to pass it in:

class Example1:
    def __init__(self, obj):
        self.obj = obj
    def use_obj(self):
        print(self.obj)
    def __enter__(self):
        print("start")
        return self
    def __exit__(self, *exc):
        print("end")

with context() as x:
    with Example1(x) as y:
        y.use_obj()

prints:

start
['hi']
end

However, what I don't like is, let's say that obj is an internal detail of my class. I don't want the user to have to define it beforehand and pass it in.

The only way I can figure how to do this is by calling the context manager's __enter__() explicitly:

class Example2:
    def use_obj(self):
        print(self.obj)
    def __enter__(self):
        print("start")
        self.ctx = context()
        self.obj = self.ctx.__enter__()
        return self
    def __exit__(self, *exc):
        print("end")
        self.ctx.__exit__(None, None, None)

with Example2() as y:
    y.use_obj()

which also prints,

start
['hi']
end

For comparison, just as some other random attempt, the following doesn't work because the context ends when self.obj is created:

class Example3:
    def use_obj(self):
        print(self.obj)
    def __enter__(self):
        print("start")
        with context() as x:
            self.obj = x
        return self
    def __exit__(self, *exc):
        print("end")

with Example3() as y:
    y.use_obj()

which prints,

start
['there']
end

Okay, so my point is that Example2 is the right solution here. But, it's really ugly. So my question is, is there a better way to write Example2?

[-] radarsat1@lemmy.ml 1 points 1 year ago

If you're pickling that much data you should definitely consider using a more appropriate data format. Maybe a database or HDF5?

radarsat1

joined 4 years ago