On 23/10/2021 12.51, Greg Ewing wrote:
> On 23/10/21 8:49 am, dn wrote:
>> Whereas, creating a list (or tuple...) is legal because the structure's
>> name is an "identifier"!
>
> No, the restriction only applies to the LHS. The list construction
> is on the RHS.
That contention (above) may have
On Sat, Oct 23, 2021 at 12:24 PM Paulo da Silva
wrote:
>
> Às 20:34 de 22/10/21, Chris Angelico escreveu:
> > On Sat, Oct 23, 2021 at 6:24 AM Jon Ribbens via Python-list
> > wrote:
> >>
> >> On 2021-10-22, Stefan Ram wrote:
> >>> Paulo da Silva writes:
> Why doesn't this work
> i
Às 20:34 de 22/10/21, Chris Angelico escreveu:
> On Sat, Oct 23, 2021 at 6:24 AM Jon Ribbens via Python-list
> wrote:
>>
>> On 2021-10-22, Stefan Ram wrote:
>>> Paulo da Silva writes:
Why doesn't this work
if (self.ctr:=self.ctr-1)<=0:
while this works
if (ctr:=ctr-
On 23/10/21 8:49 am, dn wrote:
Whereas, creating a list (or tuple...) is legal because the structure's
name is an "identifier"!
No, the restriction only applies to the LHS. The list construction
is on the RHS.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
With apologies for pressing Send too early...
On 23/10/2021 08.41, dn via Python-list wrote:
> On 23/10/2021 08.34, Chris Angelico wrote:
>> On Sat, Oct 23, 2021 at 6:24 AM Jon Ribbens via Python-list
>> wrote:
>>>
>>> On 2021-10-22, Stefan Ram wrote:
Paulo da Silva writes:
> Why doesn
On 23/10/2021 08.34, Chris Angelico wrote:
> On Sat, Oct 23, 2021 at 6:24 AM Jon Ribbens via Python-list
> wrote:
>>
>> On 2021-10-22, Stefan Ram wrote:
>>> Paulo da Silva writes:
Why doesn't this work
if (self.ctr:=self.ctr-1)<=0:
while this works
if (ctr:=ctr-1)<=
On Sat, Oct 23, 2021 at 6:24 AM Jon Ribbens via Python-list
wrote:
>
> On 2021-10-22, Stefan Ram wrote:
> > Paulo da Silva writes:
> >>Why doesn't this work
> >> if (self.ctr:=self.ctr-1)<=0:
> >>while this works
> >> if (ctr:=ctr-1)<=0:
> >
> > assignment_expression ::= [identifier
On 2021-10-22, Stefan Ram wrote:
> Paulo da Silva writes:
>>Why doesn't this work
>> if (self.ctr:=self.ctr-1)<=0:
>>while this works
>> if (ctr:=ctr-1)<=0:
>
> assignment_expression ::= [identifier ":="] expression,
> but the attribute references "self.ctr" is no identifier!
This
Hi!
Why doesn't this work
if (self.ctr:=self.ctr-1)<=0:
while this works
if (ctr:=ctr-1)<=0:
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 22, 2021 at 10:36 PM Antoon Pardon wrote:
>
> I have a file with python code but the name doesn't end with the '.py'
> suffix.
>
> What is the easiest way to import this code as a module without changing
> its name?
>
It should be possible to use importlib for this:
https://docs.pyth
The (newer) risc os port does a whole bunch of stuff in importlib to do this,
as it natively doesn’t use extensions but file types.
I’m not sure if you could do something similar without modifying importlib and
re-freezing it.
https://github.com/c-jo/cpython/blob/riscos-310/Lib/importlib/_boots
As far as I know, it can't be done.
If I was REALLY desperate I might try (tested)
import os
os.rename('myfile.myext', 'myfile.py')
import myfile
os.rename('myfile.py', 'myfile.myext')
# with appropriate modifications if myfile is not in the current directory
but this is a horrible solution, sub
I have a file with python code but the name doesn't end with the '.py'
suffix.
What is the easiest way to import this code as a module without changing
its name?
--
Antoon Pardon.
--
https://mail.python.org/mailman/listinfo/python-list
13 matches
Mail list logo