First time here? Check out the FAQ!

nathanieljla's profile - activity

2025-03-20 20:41:15 -0500 received badge Notable Question (source)
2025-03-20 20:41:15 -0500 received badge Popular Question (source)
2025-03-20 20:41:15 -0500 received badge Famous Question (source)
2025-02-24 18:32:40 -0500 marked best answer Type hinting method return based on input type

Hi. I'm wondering if it's possible to have intellisense (or whatever it's call in Wing) to understand what a return type will be based on the input to a method. For example:

apple = fruit.to(Apple)
apple.bite() #peel shouldn't be available for code completion, but currently is

orange = fruit.to(Orange)
orange.peel() #Orange shouldn't have bite, but currently does

To_types = typing.Union['Apple','Orange','Fruit', None]

class Fruit():
  @staticmethod
  def can_transform(fruit):
    raise NotImplementedError

  @overload
  def to(self, subclass:'Apple')-> 'Apple':
    ...

  @overload
  def to(self, subclass:'Orange')-> 'Orange':
    ...

  def to(self, subclass:To_types)->To_types:
    result = subclass(self) if subclass.can_transform(self) else None
    return result

class Apple(Fruit):
    @staticmethod
    def can_transform(fruit):
        fruit.is_red()

    def bite(self):
        pass

class Orange(Fruit):
    def peel(self):
        pass

Thanks for any info on this!

2025-02-22 08:35:14 -0500 commented answer Type hinting method return based on input type

Thanks for the reply. I kept reading up on typing and did eventually land on the code below. It sounds like the overlo

2025-02-22 07:47:26 -0500 commented answer Type hinting method return based on input type

Thanks for the reply. I kept reading up on how typing and did eventually land on the code below. It sounds like the ov

2025-02-22 07:46:13 -0500 commented answer Type hinting method return based on input type

Thanks for the reply. I kept reading up on how typing and did eventually land on the code below. It sounds like the ov

2025-02-22 07:45:46 -0500 commented answer Type hinting method return based on input type

Thanks for the reply. I kept reading up on how typing and did eventually land on the code below. It sounds like the ov

2025-02-21 06:13:14 -0500 received badge Enthusiast
2025-02-20 17:23:51 -0500 asked a question Type hinting method return based on input type

Type hinting method return based on input type Hi. I'm wondering if it's possible to have intellisense (or whatever it'

2024-09-26 17:51:24 -0500 received badge Nice Question (source)
2024-09-26 17:51:20 -0500 received badge Famous Question (source)
2023-09-20 22:48:12 -0500 received badge Notable Question (source)
2023-09-20 22:48:12 -0500 received badge Popular Question (source)
2023-09-10 10:48:37 -0500 received badge Famous Question (source)
2023-09-10 10:48:37 -0500 received badge Popular Question (source)
2023-09-10 10:48:37 -0500 received badge Notable Question (source)
2023-08-11 08:25:20 -0500 marked best answer Type hint color

I don't know if this is already a feature and I just can't find it, but I'd love a way to give type hints (and the :) a color different than the variable color.

2023-08-09 05:29:51 -0500 asked a question Type hint color

Type hint color I don't know if this is already a feature and I just can't find it, but I'd love a way to give type hint

2023-07-25 16:18:20 -0500 marked best answer Extension script and importing module

I have a script I'd like to bind to a hotkey in wing. The script required the use of psutil, which isn't a part of the standard python library. When wing starts the script errors because "import psutil" isn't valid. I can't figure out where I should install this package. I tried :

AppData\Roaming\Wing Pro 9\scripts

AppData\Roaming\Python\Python310\site-packages

It looks like it can find my dependencies if I put the code in C:\Program Files\Wing Pro 9\bin__os__\win32\runtime-python3.10\Lib, but obviously that can't be the official answer.

Thanks for the help! Nathaniel

2023-07-25 11:36:14 -0500 commented answer Extension script and importing module

Thanks for the reply. Eventually, I'd like to publish this to github for others to use. So I like the idea of pip "get

2023-07-24 09:40:26 -0500 marked best answer Any option for double clicking a project file not opening copy

Currently, when I double-click on a file from my project view it opens a tab of that file, even if an existing tab of that file is already open. Is there any option it to put focus on the existing tab instead?

Thanks for the help! Nathaniel

2023-07-23 15:02:25 -0500 edited question Extension script and importing module

Extension script and importing module I have a script I'd like to bind to a hotkey in wing. The script required the use

2023-07-23 15:02:25 -0500 received badge Editor (source)
2023-07-23 10:43:28 -0500 asked a question Extension script and importing module

Extension script and importing module I have a script I'd like to bind to a hotkey in wing. The script required the use

2023-07-22 17:05:14 -0500 received badge Rapid Responder ( source )
2023-07-22 17:05:14 -0500 answered a question Any option for double clicking a project file not opening copy

Oh, with your answer I think I found the issue. I'm using windows mklink /j command to keep all my code in one location

2023-07-22 12:10:49 -0500 received badge Student (source)
2023-07-22 12:10:29 -0500 asked a question Any option for double clicking a project file not opening copy

any option for double clicking a project file not opening copy Currently, when I double-click on a file from my project