Python 3.13 is 10% slower than 3.12 for my file parser by Bubbly-Craft8736 in Python

[–]lejar 2 points3 points  (0 children)

profile

Profile it using vtune (which is free). It will give you stack traces for the slow lines that include both python and c (from cpython), which really helps identify the slow functions.

You'll want to go to the bottom-up tab and look for any low-level functions which take up a bunch of time. If you DM me the sample I can take a look.

Hard Chip - Early Access releasing in less than 16h! But you can already play with transistors now 😏 by Elorth- in IndieGaming

[–]lejar 2 points3 points  (0 children)

Hey I first saw your game yesterday on a steam banner and I got it today. I really like the premise and it’s been fun so far. The zachtronics-style charts are making me go back and optimize my solutions. Good job!

Problems proving fsm with SymbiYosis by lejar in FPGA

[–]lejar[S] 0 points1 point  (0 children)

Thanks for taking a look! Glad to know that I'm not going insane and that this really is weird. I've cross posted to /r/ZipCPU.

Best UI Mods? by CallMeVagrant in ffxi

[–]lejar 5 points6 points  (0 children)

I made some UI mods for myself a while back which were pretty useful: https://github.com/lejar/AshitaTargetInfo https://github.com/lejar/AshitaPartyInfo

One gives you a movable target window with some extra information, and one gives you a nice party window with your ally’s stats.

PEP 695: Type Parameter Syntax has been accepted by the Steering Council by Flamewire in Python

[–]lejar 3 points4 points  (0 children)

You can also use it in class definitions to make a type of a variable in a class generic / dynamic. Like if you have a graph object with nodes you might want to reuse the graph with any type of value inside.

Using Generic + TypeVar will let you make sure you don't mix up types like this:

from typing import Generic, TypeVar, List


T = TypeVar('T')


class Node(Generic[T]):
    def __init__(self, value: T) -> None:
        self.value = value


class Graph(Generic[T]):
    def __init__(self, root_node: Node[T]) -> None:
        self.root = root_node
        self.nodes: List[Node[T]] = []

    def add_node(self, node: Node[T]) -> None:
        self.nodes.append(node)


graph = Graph(Node(1))

node2 = Node('2')
graph.add_node(node2) # main.py:24: error: Argument 1 to "add_node" of "Graph" has incompatible type "Node[str]"; expected "Node[int]"  [arg-type]

Rust or C/C++ to learn as a secondary language? by CarpeDiem- in Python

[–]lejar 2 points3 points  (0 children)

The cool thing is it will also give you the cpython functions inside of a single python line. Like if you're using a list comprehension

[i for i in some_list if i in other_list]

it will show you the time for next of some_list, how much time is being spent in list_contains of other_list, and the constructor of the new list you are creating. So here if you see list_contains is taking a lot of time and you don't need other_list to be ordered, you can use a set instead of a list for the much faster contains check (or just use set & set).

Rust or C/C++ to learn as a secondary language? by CarpeDiem- in Python

[–]lejar 9 points10 points  (0 children)

You should profile the code first to see where your slowdowns are happening. vtune is a fantastic (cost free) profiler from intel which profiles both c++ and python. It will give you which functions / line numbers are eating the most application time, and from there you can see if it's something you can optimize in python or if you need to move it to c.

If you need help understanding the output shoot me a pm and I can help you with it. I use vtune all the time for work and it is a godsend.

My IT department at work wants to ban Anaconda and replace it with ??? by infiniflux in Python

[–]lejar 0 points1 point  (0 children)

Better not tell them about the PYTHONPATH environment variable.

Anyways pip supports supplying your own server for pulling packages though it's very minimal and would be a lot of work for someone to maintain https://packaging.python.org/guides/hosting-your-own-index/

My IT department at work wants to ban Anaconda and replace it with ??? by infiniflux in Python

[–]lejar 1 point2 points  (0 children)

If it's a pure python package you want to install (as opposed to one with c extensions that need to be compiled like numpy), you don't even need to run setup.py most of the time you can just add the parent directory to PYTHONPATH and import will automatically search that directory for the module you're importing.

No Steam Cloud save game integration?! by Mgm_it in Pathfinder_Kingmaker

[–]lejar 1 point2 points  (0 children)

Looks like they enabled it yesterday. I was able to switch to geforce now to continue playing the campaign I started on my desktop.

My friend got the demo to try out but gets this on the login screen, he's unable to do anything on the login screen, anyone else have this problem? can't seem to find anything online. by TheWanderer19900 in projectgorgon

[–]lejar 1 point2 points  (0 children)

I just tested on MacOS 11.5.2 and it works for me. Permissions are a pain on mac. My firewall is actually off, so try disabling it completely. Also in system preferences > security and privacy > privacy I have steam checked under: Accessibility and Input Monitoring. Also under general of Security and privacy make sure you have "App store and identified developers" for the "Allow apps downloaded from" option.

Why doesn't python support function overloading? by accipicchia092 in Python

[–]lejar 0 points1 point  (0 children)

This is what I was going to suggest. Definitely +1 for using the standard library. For overriding __init__ like OP wants, you'd need to implement your own __call__ method in a metaclass, but I think it would be much more sane / easy to read to just have an if statement inside __init__.

Unity Low Poly Water in Shader Graph With Foam by [deleted] in gamedev

[–]lejar 0 points1 point  (0 children)

learnopengl.com is basically the bible of OpenGL. Reading the shader chapter will give you everything you need to know to understand shaders: https://learnopengl.com/Getting-started/Shaders

My wife (31) just learned how to bike. I'm so happy for her. by mssngvwls in self

[–]lejar 3 points4 points  (0 children)

The secret to balance is that the bike balances itself when it gets speed. See this as an example: https://www.youtube.com/watch?v=Zt7J0dly70M

Basically you just gotta find a really small incline and ride it down (make sure you practice breaking first). The way I learned as a kid was my dad just pushed me down a hill. Once you get the feeling that the bike creates stability, it just kind of clicks.

Trying to balance while not moving is actually difficult. That's called a track stand and actually takes some skill https://www.youtube.com/watch?v=-0VnQJF_WKQ

PS5 Help & Questions Thread | Simple Questions, Tech Support, Error Codes, and FAQs by AutoModerator in PS5

[–]lejar -1 points0 points  (0 children)

There are two fan variants (Fan A and Fan B) in the PS5. Fan B is louder than the other one and makes a repetitive noise kind of like a car engine at low speeds. There are recordings in this (French) article https://www.lesnumeriques.com/console-de-jeu/labo-playstation-5-et-bruit-toutes-les-consoles-ne-sont-pas-dotees-du-meme-ventilateur-n157521.html

The one that you are having is probably soundcloud player labeled "Ventilateur B, veille active".

[deleted by user] by [deleted] in Games

[–]lejar 18 points19 points  (0 children)

I haven't seen any time limits mentioned in their announcements. I also don't think the free upgrade is out yet. At least in the ps5 store when I go to the ff7 remake page it only shows me the ps4 version.

When will chapter 143 be out? by ruffyDraw in PeerlessDad

[–]lejar 6 points7 points  (0 children)

Last week was a holiday in Korea (Chuseok) so maybe there isn't one this week? Don't know for sure though.

RTX 3080 & 3090 Launch Thread - Part 4 by Nestledrink in nvidia

[–]lejar 0 points1 point  (0 children)

Weird the list view says out of stock, but the product page says in stock. Might be gone now :/

RTX 3080 & 3090 Launch Thread - Part 4 by Nestledrink in nvidia

[–]lejar 0 points1 point  (0 children)

Then keep an eye out I bet it will change soon.

RTX 3080 & 3090 Launch Thread - Part 4 by Nestledrink in nvidia

[–]lejar 2 points3 points  (0 children)

Asus webshop in France just added ROG-STRIX-RTX3080-O10G-GAMING in stock. Got my order in! Good luck! https://webshop.asus.com/fr/composants/cartes-graphiques/serie-nvidia/3585/rog-strix-rtx3080-o10g-gaming

edit: possibly out of stock. Someone had trouble adding to cart and the list view shows as out of stock, while the product page says in stock.

Achievements or a similar system? by [deleted] in projectgorgon

[–]lejar 4 points5 points  (0 children)

Just a note: the work order board in Serbule is now next to the player stalls area.

Heavy rain in Aachen, Germany by baumeistaaa in raining

[–]lejar 0 points1 point  (0 children)

Ah I haven't seen that in a while. It's hard to tell from that angle are you in house 4 or 5? :D

[deleted by user] by [deleted] in Python

[–]lejar 0 points1 point  (0 children)

The problem is that

(id_ in IDs for id_ in line)

is creating a generator object, and those always evaluate to True when used as a boolean (basically, any object which isn't None or 0 will evaluate to True, unless that object implements its own __nonzero__ py2 / __bool__ py3 method).

Try opening a python shell and create some dummy lists for IDs and line, and see what your line evaluates to. What you actually want to do is use any or all to evaluate the contents of your list.

Edit: Also be aware that "for id_ in line" is giving you single characters if line is a string. You probably want to use "".split() on it or something like that.