U
U
Uno di Palermo2020-03-27 17:36:44
npm
Uno di Palermo, 2020-03-27 17:36:44

Why doesn't logging.log.warning pass control down the call stack?

def do_smth():
    if condition:
        logging.log.warning("text")
        
    print('test')


Can you tell me why print('test') fails?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
runprogr, 2019-09-09
@runprogr

var newer = require('gulp-newer');
const imagemin = require('gulp-imagemin');
const imageminPngquant = require('imagemin-pngquant');
const imageminMozjpeg = require('imagemin-mozjpeg');

var img_bf_min = './src/img-source/*', // Изображения для минимайза
img_af_min = './src/img/'; // Изображения минимизированные

gulp.task('imgmin', function() {
    return gulp.src(img_bf_min)
        .pipe(newer(img_bf_min))
        .pipe(imagemin([
            imageminPngquant(),
            imageminMozjpeg({
                 progressive: true
            })
            ],{
            verbose: true
        }))
        .pipe(gulp.dest(img_af_min))
});

I use this setting. Everything works perfectly. You can do it by analogy.

D
Dmitry, 2020-03-27
@dmtrrr

Because return

S
Sergey Pankov, 2020-03-27
@trapwalker

Have you turned to psychics or to whom?

Why doesn't logging.log.warning pass control down the call stack?

What is logging here? Is this the standard python library? So in it log is a function and it does not have a warning attribute. The fact that you didn’t provide a traceback and didn’t say anything about the crash at the mention of the undeclared condition, probably, you just quoted a piece of code and somewhere above logging is imported or created, condition is declared globally ... and that’s it.
OK, I always assume and assume that the author of the question is a REASONABLE PERSON AND DOES REASONABLE.
What can I understand from this?
Probably the author's logging.log has nothing to do with standard logging (or the author, simplifying the example, slandered garbage).
Probably the author deliberately put return (how could he not notice it?) or the author just sees the python for the first time and ... damn it ... I don't know.
WHAT'S GOING ON HERE?
Okay. The call stack was mentioned here. You can probably mix up the top and bottom of the call stack a little. But this phrase either refers to complex and very magical bytecode management, or ... or the author uses terms that he does not understand.
Author, just provide code that doesn't work the way you expect. FULLY. In the form in which it does not work for you as you expect. Then I'll show you where you're wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question