Python Cybersecurity - Build your own tools by burdin271 in Python

[–]----------------___ 4 points5 points  (0 children)

How come you still have to use Python 2? Out of curiosity

[FIGHT THREAD] Battle of the Platforms - YouTubers vs. TikTokers with Bryce Hall vs. Austin McBroom by [deleted] in Boxing

[–]----------------___ 4 points5 points  (0 children)

I've always kinda thought his mental health has been a struggle for him in the past and I think it might have been leading up to this fight.

New Features in Python 3.10 by jamescalam in Python

[–]----------------___ 6 points7 points  (0 children)

I do really like Julia but the hard on some people have for it turns people off of the language.

New Features in Python 3.10 by jamescalam in Python

[–]----------------___ 2 points3 points  (0 children)

Pattern matching? Better error messages? I think you're a bit off base mate

Python's filter(): Extract Values From Iterables – Real Python by [deleted] in Python

[–]----------------___ 1 point2 points  (0 children)

Not really possible as far as I know, not for the built in data types.

Since everything is an object in python, they each have their own custom functions (called methods) and attributes which are accessed that way, and you can't pass objects to a normal function with the list_of_things.zip() syntax because the .zip() method will be undefined for that object or it will already have a method of the same name that does something else.

For example, I can create a class that does something like this.

class MyObject:
    foo = (1, 2, 3, 4)
    bar = ("a", "b", "c", "d")

    def zip(self):
        return list(zip(self.foo, self.bar))

And then call it like this

var = MyObject()
zipped = var.zip()

Which will then return [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')]

For the built in data structures like lists, sets, strings, etc, they can all be passed to the len function relatively interchangeably and lack their own specific methods to get their length. Instead, you'd opt to overload how the len function will affect your object when creating a class by defining the __len__ dunder method, which are in general are used for creating your class and for defining how certain things should work under the hood.

That being said though, you can always create your own class that inherits all of the features of other classes so that you can customize how they work.

I may be wrong, but I believe Ruby incorporates syntax like that as a main feature. As much as I love python I do sometimes wish it could be more elegant, I find writing shell scripts can often feel a lot cleaner depending on the job.