416 questions
0
votes
0
answers
18
views
Why isn't my simple conversion program working when i call a function within a function? [duplicate]
def rods_to_meters(rods):
meters = rods * 5.0292#converts rods to meters and stores in appropriate variable.
return(meters)
def rods_to_feet(rods):
feet = (rods * 5.0292) / 0.3048#...
0
votes
1
answer
103
views
Positional arguments in nested functions
This question relates to this video: https://www.youtube.com/watch?v=jXugs4B3lwU
The piece I'm missing is somewhat simpler than the concept the video is covering overall. In the example code below:
...
0
votes
0
answers
43
views
Headless mode while using Selenium webdriver won't perform function
This is a nested function inside a function that I defined. But somehow the webdriver in Headless mode just won't perform the xport.click function. This function WORKS on a regular window but won't in ...
2
votes
2
answers
826
views
Whether to use nested function for better readability in composables or not?
When using Jetpack Compose, there are some scenarios where there is a piece of code that does a specific job but since it is calling lambda parameters of the composable, it is not possible to fully ...
0
votes
0
answers
21
views
A question related to function enclosure and call-by-name of Python language [duplicate]
Consider the following code snippet:
def part1():
flist = []
for i in range(10):
def hello():
print(f"Hello {i = }.")
flist.append(hello)
for f ...
0
votes
0
answers
26
views
Why is my nested function not called from my anonymous function? [duplicate]
I tried accomplishing a small task in PHP 7.4 (a language I never use) and decided to use a nested utility function isReverseScored, to be called inside an "arrow function", like so:
// ...
1
vote
1
answer
84
views
Python generator yielding from nested non-generator function
This is a dumb example based on a more complex thing that I want to do:
from typing import Generator
def f() -> Generator[list[int], None, None]:
result = list()
result.append(1)
if len(...
0
votes
2
answers
61
views
Importing custom created module
So i have created Custom_module.py module that i want to import or rather to import specific function in .py file that i am currently working on.
for example like this:
# Custom_module.py
def test1():...
1
vote
1
answer
213
views
Variables' scope of nested function in MATLAB
I am a little confused about the variables' scope in a nested function in MATLAB.
As nested function help docs explains: vaiable remains local to the nested function.
function main
nestedfun1
...
-1
votes
1
answer
39
views
N-back-for-matlab returned errors [closed]
I downloaded nback from https://www.mathworks.com/matlabcentral/fileexchange/67976-n-back-for-matlab
I am trying to set up this task in R2023b matlab, but there are numerous errors on the script for ...
1
vote
2
answers
66
views
Acces to import of the nested function JS
I need some help to get how some function export works inside JS.
Let's say I have this code
function goodbuy() {
console.log('bye');
}
function myModule() {
function hello() {
console....
1
vote
2
answers
262
views
convert gcc forward-declared nested function to clang blocks
I know this is impossible because I've spent hours on it and also read these below but I am determined to approximate a clang block forward definition even if it takes linker tricks or inline assembly:...
0
votes
1
answer
121
views
Using nested helper functions while building a class
I want to build a class which is merely a wrapper for some data. This is the basic idea:
class Fruits:
fruits = [ 'apple', 'orange', 'cherry' ]
My fruits aren’t strings, though, but classes ...
0
votes
1
answer
161
views
Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' -- when running a nested function
Problem: running get_pi_ij() gives the error:
Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any'
Called from: as.vector(data)
The first thing this function does is to ...
-1
votes
2
answers
72
views
Why won't calling a nested function result in returning original function's value? [closed]
Somehow I can't manage to use a previously defined function inside another one. Is that possible?
def generate_password(length):
import random
password = str()
alpha_num = [i for i in '...