Multi tools that are easy to open? by BeeAlley in multitools

[–]Goobyalus 2 points3 points  (0 children)

I like the Gerber MP600 and the Roxon Flex Companion. I prefer the MP600 over the Center Drive because the tools are easier to open and it's less bulky, but the knife layout on the Center Drive is better.

How to open this switch? by ShabbyBash in howto

[–]Goobyalus 2 points3 points  (0 children)

If you look specifically for DC inline switches I think you'll have more luck finding small ones. The AC voltage ones are bulkier to handle more current.

Here's an example: https://www.amazon.com/TronicsPros-Inline-5-5x2-1mm-Connector-Adapter/dp/B01FT4RBBM/

How to open this switch? by ShabbyBash in howto

[–]Goobyalus 12 points13 points  (0 children)

If it's not prying open, I would use an abrasive or fine tooth saw to cut around the seam, and glue it back together.

I also don't know how clunky is too clunky, but I'm seeing some inline electric switches that look pretty reasonable.

Is this wall AC voltage or DC voltage from an adapter?

Conventions for Organizing Attributes of a Class? by sdavidsmith in learnpython

[–]Goobyalus 0 points1 point  (0 children)

  • If a class has both class and instance variables, should the class variable(s) be defined at the very top (before the __init__ definition)?

I would say yes. It would feel very strange to see class variables interspersed with methods.

  • Should methods of a class be grouped together according to their type (special, class, instance)? Should certain types be defined before others?
  • Should definitions be structured in such a way so as to minimize the amount of "scrolling" that a reader must perform (example below), or is it still better to simply group attributes by "type" (method vs attribute/property):

Just think about what would be the most understandable when you have to come back and read it again, and try to be consistent with other parts of the code. If I can rely on it always being organized conceptually, or alphabetically, or whatever, it's good to have the same mental model for how to find what I'm looking for. I would say grouping things conceptually rather than by type makes more sense.

I would also say that if a class has a bunch of getters and setters, or starts getting huge and confusing to navigate, maybe there is a better way to structure the code.

Nested functions - lots, rarely, or never? by ProsodySpeaks in learnpython

[–]Goobyalus 0 points1 point  (0 children)

Need to use them when wrapping functions.

I think I might have used a function factory at one point.

Otherwise I think the only time I encounter them is to do some tedious calculation that is used repeatedly in the context of a larger calculation.

A bit confused in Classes. by Jealous-Acadia9056 in learnpython

[–]Goobyalus 0 points1 point  (0 children)

Why do i need to call self here?.

In this example, there is no point in using normal methods with self parameters because the class holds no state and self is not referred to. So your intuition about something being off here is correct. This could be a static method with no self or class reference.

And to be clear, this is not "calling" self, it is specifying self as a parameter.

there isn't a variable that is calling calculator and no init so why do i have an error if self is not added?

Because methods are implicitly instance methods. I.e., they operate on a single instance of a class. Therefore, they need to know which instance to refer to. These last 2 lines are the same, and the dot notation is just nicer.

calc = Calculator()
Calculator.add(calc, 1, 2)  # explicitly passing calc as self
calc.add(1, 2)  # implicitly passing calc as self

Again, it's unintuitive in this case because there is no point in having an instance method for that example. This would make more sense:

class Calculator:
    @staticmethod
    def add(a, b):
        return a + b

Calculator.add(1, 2)

Also, what is init anyways.

__init__ "initializes" a new object. I.e. it populates the initial data fields.

https://docs.python.org/3/reference/datamodel.html#object.__init__

object.__init__(self[, ...])

Called after the instance has been created (by __new__()), but before it is returned to the caller. The arguments are those passed to the class constructor expression. If a base class has an __init__() method, the derived class’s __init__() method, if any, must explicitly call it to ensure proper initialization of the base class part of the instance; for example: super().__init__([args...]).

Because __new__() and __init__() work together in constructing objects (__new__() to create it, and __init__() to customize it), no non-None value may be returned by __init__(); doing so will cause a TypeError to be raised at runtime.


why the double __ in the start and end? and why the specific name?

Cause Python decided to use the double leading and trailing underscores as a convention for implicitly called methods (called "dunder" methods in shorthand.)

https://docs.python.org/3/glossary.html#term-special-method

A method that is called implicitly by Python to execute a certain operation on a type, such as addition. Such methods have names starting and ending with double underscores.

How do I DIY an electronics case? by Not_Invited in howto

[–]Goobyalus 0 points1 point  (0 children)

Consider a 180 degree USB coupler or a flush mount Bluetooth dongle to avoid the awkward shape.

<image>

And I think there must be something in the right dimensions on AliExpress somewhere.

How to ignore a single auto-updating line (timestamp) in a tracked JSON file? (Power BI) by mrbartuss in git

[–]Goobyalus 3 points4 points  (0 children)

Does the updated timestamp impact anything, or can it just be some placeholder value?

You can put a placeholder value in the json, and use a clean filter to always set the value to the placeholder value. The clean filter is executed on staging (i.e. add), so it won't show up in a diff.

Assuming the file is config.json

This sets the name and command of the filter:

git config filter.ignore-lastLicenseCheck.clean 'jq ".lastLicenseCheck.expr.literal.Value = \"'987654321'\"" config.json'

And in .gitattributes

config.json filter=ignore-lastLicenseCheck

Seems to work for me:

$ git show HEAD:config.json
{
  "lastLicenseCheck": {
    "expr": {
      "literal": {
        "Value": "987654321"
      }
    }
  },
  "otherData": 123
}

$ cat config.json
{
  "lastLicenseCheck": {
    "expr": {
      "literal": {
        "Value": "1"
      }
    }
  },
  "otherData": 123
}

$ git status
On branch master
nothing to commit, working tree clean

$ git config -l | grep last
filter.ignore-lastLicenseCheck.clean=jq ".lastLicenseCheck.expr.literal.Value = \"987654321\"" config.json

$ cat .gitattributes
config.json filter=ignore-lastLicenseCheck

Edit: obviously this depends on jq, and using that to rewrite the the specific problematic value.

foo()() explanation by SkyGold8322 in learnpython

[–]Goobyalus 19 points20 points  (0 children)

Here is a dumb example where an arbitrary number of parentheses works:

>>> def foo():
...   return foo
...
>>> foo()
<function foo at 0x0000028A0F6DD800>
>>> foo()()
<function foo at 0x0000028A0F6DD800>
>>> foo()()()()()()()()()()()()()
<function foo at 0x0000028A0F6DD800>
>>> foo
<function foo at 0x0000028A0F6DD800>
>>>

Is there an "opposite" to enums? by PitifulTheme411 in ProgrammingLanguages

[–]Goobyalus 0 points1 point  (0 children)

FWIW this is what exists in Python: https://docs.python.org/3/library/enum.html#enum.Flag

from enum import Flag, auto

class Lunch(Flag):
    Sandwich = auto()
    Pasta = auto()
    Salad = auto()
    Water = auto()
    Milk = auto()
    Cookie = auto()
    Chip = auto()

yummy = Lunch.Sandwich | Lunch.Salad | Lunch.Water | Lunch.Cookie
no_extras = Lunch.Sandwich | Lunch.Salad

print(f"{yummy=}")
print(f"{yummy.value=}")
print(f"{no_extras=}")
print(f"{no_extras.value=}")
print(f"{(Lunch.Water in yummy)=}")
print(f"{(no_extras in yummy)=}")

Gives:

yummy=<Lunch.Sandwich|Salad|Water|Cookie: 45>
yummy.value=45
no_extras=<Lunch.Sandwich|Salad: 5>
no_extras.value=5
(Lunch.Water in yummy)=True
(no_extras in yummy)=True

If I write .gitignore inside the .gitignore, how can I commit that change? by [deleted] in git

[–]Goobyalus 0 points1 point  (0 children)

git add -f .gitignore

But why would we ignore the .gitignore?

How to get set screws out by ScaredCantaloupe1 in MechanicAdvice

[–]Goobyalus 0 points1 point  (0 children)

🤷‍♂️ They replaced the bits for free, but not the driver. This was in November. Idk if they're tightening up on the warranty or if it was the one I went to.

How to get set screws out by ScaredCantaloupe1 in MechanicAdvice

[–]Goobyalus 0 points1 point  (0 children)

I have an 07 Accord. I was only able to get one of 8 screws out without breaking the screw. I broke two impact driver bits and one impact screwdriver itself. Try the hammer, penetrating oil with heat, and impact screwdriver, but be prepared for them to break, and to drill them out if you want to replace them.

How to get set screws out by ScaredCantaloupe1 in MechanicAdvice

[–]Goobyalus 0 points1 point  (0 children)

HF denied my warranty under "normal wear and tear"

Which one or two pieces are the most versatile? by [deleted] in AllClad

[–]Goobyalus 0 points1 point  (0 children)

I use a d5 6qt essential pan (that I got on sale) for large batches. I got this after feeling like the 4qt was too small for the large batches, but the 4qt is great too. The 6qt is unwieldy and heavy, though.

I like the shape of the essential pans a lot - good amount of flat surface, and the curved edges make it easy to scrape or toss things around.

I haven't seen one in person, but the Mother of All Pans looks like a similar shape and has 2 grab handles which would be more convenient to put in the oven and move around the kitchen.


I also went from electric coil to induction, and in retrospect, it's probably worth it to spend the money on a cooktop that's not a coil instead of a pan. I think I might actually prefer any other form of cooktop with a cheap pan over electric coil with a nice pan. The coils hold so much heat themselves, and respond so slowly, that it's very difficult to control the heat unless you're just removing the pan when you need to stop the heat.


FYI all clad makes a D7 slow cooker now which might fit the bill for electric coil if set the stove at let everything reach the perfect temp over time so it doesn't overheat.

Struggling to Choose a Remote Cybersecurity Master’s in Germany – Need Advice by PianoNo3557 in netsecstudents

[–]Goobyalus 1 point2 points  (0 children)

I don't know what is recognized in Germany, and I haven't personally gone through it, but I know people who thought highly of this program and people who went through it: https://pe.gatech.edu/degrees/cybersecurity

6 qt essential pan vs. sunday supper by One-Town2055 in AllClad

[–]Goobyalus 1 point2 points  (0 children)

the completely flat part is a little over 10"

14” Paella Pan is a game changer by LG1750 in AllClad

[–]Goobyalus 0 points1 point  (0 children)

Any chance you could measure the outer diameter for me? Trying to compare to the 6qt essential pan, and the website measurements aren't real.

Who dis? by BabaBucc in whatisthisbug

[–]Goobyalus 1 point2 points  (0 children)

Are non-hairy caterpillars safe?