1 ๋ถ„ ์†Œ์š”

Ellipsis?

ํŒŒ์ด์ฌ ์ฝ”๋“œ๋ฅผ ์ฝ๋‹ค๋ณด๋ฉด ... ์œผ๋กœ ํ‰ ์น˜๋Š” ์ฝ”๋“œ๊ฐ€ ์ž์ฃผ ๋ณด์ธ๋‹ค.

์ตœ๊ทผ์—๋Š” Django์˜ CommonMiddleware ํด๋ž˜์Šค์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

Django์˜ CommonMiddleware

from typing import Any

from django.http.request import HttpRequest
from django.http.response import HttpResponseBase, HttpResponsePermanentRedirect
from django.utils.deprecation import MiddlewareMixin

class CommonMiddleware(MiddlewareMixin):
    response_redirect_class: Any = ...
    def process_request(
        self, request: HttpRequest
    ) -> HttpResponsePermanentRedirect | None: ...
    def should_redirect_with_slash(self, request: HttpRequest) -> bool: ...
    def get_full_path_with_slash(self, request: HttpRequest) -> str: ...
    def process_response(
        self, request: HttpRequest, response: HttpResponseBase
    ) -> HttpResponseBase: ...

class BrokenLinkEmailsMiddleware(MiddlewareMixin):
    def process_response(
        self, request: HttpRequest, response: HttpResponseBase
    ) -> HttpResponseBase: ...
    def is_internal_request(self, domain: str, referer: str) -> bool: ...
    def is_ignorable_request(
        self, request: HttpRequest, uri: str, domain: str, referer: str
    ) -> bool: ...

... ๊ฐ€ ๊ฐ–๋Š” ์˜๋ฏธ๊ฐ€ ๋ฌด์—‡์ผ๊นŒ ๊ถ๊ธˆํ–ˆ๋‹ค.

์ด ... ์€ Ellipsis ๋ผ๊ณ  ํ•˜๋Š” ํŒŒ์ด์ฌ ๊ธฐํ˜ธ์˜€๊ณ , ์‚ฌ์ „์ ์œผ๋กœ๋Š” ์ƒ๋žต , ์ƒ๋žต๋ถ€ํ˜ธ ๋ผ๋Š” ์˜๋ฏธ๋ฅผ ๊ฐ–๊ณ  ์žˆ๋‹ค.

ํŒŒ์ด์ฌ ๊ณต์‹ ๋ฌธ์„œ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

๊ฒฐ๊ตญ ์•„๋ฌด ๋™์ž‘๋„ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด๋ฏ€๋กœ, pass ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๋Š” ๊ฒƒ์ด์—ˆ๋‹ค.

์ผ๋‹จ ๋งŒ๋“ค๊ณ  ๋‚ด๋ถ€ ๊ตฌํ˜„์€ ๋‚˜์ค‘์— ์ž์„ธํžˆ ํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ๋กœ..!

pass?

pass ๋˜ํ•œ Ellipsis ์ฒ˜๋Ÿผ ์•„๋ฌด ๋™์ž‘์„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค.

์ผ๋ถ€ ์ฝ”๋“œ๊ฐ€ ๊ตฌ๋ฌธ ์ƒ ํ•„์š”๋Š” ํ•˜์ง€๋งŒ ํ”„๋กœ๊ทธ๋žจ์ด ์•„๋ฌด ์ž‘์—…๋„ ํ•˜์ง€ ์•Š๊ธฐ๋ฅผ ์›ํ•˜๋Š” ๊ฒฝ์šฐ์— ์‚ฌ์šฉํ•œ๋‹ค.

์ด๋ ‡๊ฒŒ ๋งํ•˜๋ฉด ์–ด๋–ค ๊ฒฝ์šฐ์— ์‚ฌ์šฉํ•ด์•ผํ•˜๋Š” ๊ฒƒ์ธ์ง€ ์™€๋‹ฟ์ง€๋Š” ์•Š๋Š”๋ฐ, ์ถ”์ƒํด๋ž˜์Šค ํ˜น์€ ๋ฐ˜๋ณต๋ฌธ์—์„œ์˜ ๊ฒฝ์šฐ๋ฅผ ์ƒ๊ฐํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๋‹ค.

์ฐธ๊ณ  ์ž๋ฃŒ

ํŒŒ์ด์ฌ % // -> ** @ ๋“ฑ ํŒŒ์ด์ฌ ๊ธฐํ˜ธ ์™„๋ฒฝ์ •๋ฆฌ

[python] ํŒŒ์ด์ฌ pass ์„ค๋ช…๊ณผ ์˜ˆ์ œ

์นดํ…Œ๊ณ ๋ฆฌ:

์—…๋ฐ์ดํŠธ:

๋Œ“๊ธ€๋‚จ๊ธฐ๊ธฐ