Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101757

Re: Powerful perl paradigm I don't find in python

From me <self@example.org>
Newsgroups comp.lang.python
Subject Re: Powerful perl paradigm I don't find in python
Date 2016-01-15 15:20 +0000
Organization Aioe.org NNTP Server
Message-ID <n7b2o1$1ns2$1@gioia.aioe.org> (permalink)
References <n7adse$k6$1@dont-email.me> <n7athj$593$1@news2.informatik.uni-stuttgart.de>

Show all headers | View raw


On 2016-01-15, Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote:
> Charles T. Smith <cts.private.yahoo@gmail.com> wrote:
>> while ($str != $tail) {
>>     $str ~= s/^(head-pattern)//;
>>     use ($1);
>> }
>
> use() is illegal syntax in Perl.

Actually it is not. OP is defnitely thinking of `use` as a placeholder for
some general use of the value $1.

In fact, according to the documentation of perl,

    use Module LIST

is equivalent of 

    BEGIN{ require Module; Module->import(LIST); }

For the rusty perl users, the code in `BEGIN` blocks are executed "as soon
as possible", that is before the remaining part of the code, and in order
of definition.

The idea is that you want to import all modules before running the code.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Powerful perl paradigm I don't find in python "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-01-15 09:24 +0000
  Re: Powerful perl paradigm I don't find in python Peter Otten <__peter__@web.de> - 2016-01-15 10:43 +0100
    Re: Powerful perl paradigm I don't find in python Michael Vilain <vilain@NOspamcop.net> - 2016-01-15 02:20 -0800
  Re: Powerful perl paradigm I don't find in python Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2016-01-15 11:42 +0100
    Re: Powerful perl paradigm I don't find in python "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-01-15 11:04 +0000
      Re: Powerful perl paradigm I don't find in python "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-01-15 11:06 +0000
      Re: Powerful perl paradigm I don't find in python Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2016-01-15 14:20 +0100
        Re: Powerful perl paradigm I don't find in python "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-01-18 13:05 +0000
          Re: Powerful perl paradigm I don't find in python Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2016-01-18 14:33 +0100
      Re: Powerful perl paradigm I don't find in python Peter Otten <__peter__@web.de> - 2016-01-15 14:34 +0100
  Re: Powerful perl paradigm I don't find in python Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-01-15 13:51 +0000
    Re: Powerful perl paradigm I don't find in python me <self@example.org> - 2016-01-15 15:20 +0000
  Re: Powerful perl paradigm I don't find in python Nathan Hilterbrand <nhilterbrand@gmail.com> - 2016-01-15 11:54 -0500

csiph-web