Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Dennis Lee Bieber
On Fri, 24 Jun 2022 18:27:33 +0300, ???   declaimed
the following:

>I copied  most of the libraries from cython

I doubt that... cython is a specialized Python COMPILER system.
"CPython" is the common interpreted Python language (implemented in C), and
is the most likely source of the packages you are mongrelizing..

https://cython.org/
"""
Cython is an optimising static compiler for both the Python programming
language and the extended Cython programming language (based on Pyrex). It
makes writing C extensions for Python as easy as Python itself. 
"""
"""
The Cython language is a superset of the Python language that additionally
supports calling C functions and declaring C types on variables and class
attributes. This allows the compiler to generate very efficient C code from
Cython code. The C code is generated once and then compiles with all major
C/C++ compilers in CPython 2.6, 2.7 (2.4+ with Cython 0.20.x) as well as
3.3 and all later versions.
"""


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Dennis Lee Bieber
On Fri, 24 Jun 2022 15:14:50 +0300, ???   declaimed
the following:

>My TARGET  is to bind many code libraries to one Huge code file that works
>optimally and do optimizations if needed.
>In this file have code of huge part of falconpy, ALL code of re, argparse,
>are and many other code libraries
>
>This code file is contained 10k lines of python code
>

Which means any program that just uses regular expressions has to
import, parse, and byte-code compile all 10K lines.

There is a reason Python doesn't make super all-in-one libraries.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse modify

2022-06-24 Thread Dennis Lee Bieber
On Thu, 23 Jun 2022 17:01:42 -0600, Mats Wichmann 
declaimed the following:

>Assuming: that the "value" in your init method signature was supposed to
>be 'name' since that's what you use later - and would explain your
>exception!
>

Since it is a "named int", I'd expect value to the integer value of
this "constant" (and there should probably be a generic setter that... bars
changing value or name later). If a "name" keyword argument is not
supplied, using the str() of the value for the name might be valid.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: open text file

2022-06-24 Thread jak

Il 24/06/2022 15:10, simone zambonardi ha scritto:

Good morning, I need to read a text file. How come when I open it (running the 
script) it says this? The text file is type RFT

{\rtf1\ansi\ansicpg1252\cocoartf2636
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0

But even with in .txt it gives me this long string. I think it is a formatting 
problem .
thank you



I don't see the script you are talking about but it is normal to find
those strings inside a file of type '.rtf'. RTF documents are not simple
text documents (https://en.wikipedia.org/wiki/Rich_Text_Format) so if
you want to extract the text contained in these documents you will need
to use a library that can do this
(eg: https://pypi.org/project/striprtf/)
...or write a parser yourself.
--
https://mail.python.org/mailman/listinfo/python-list


Re: 3.11.0b4?

2022-06-24 Thread Richard David
On Friday, June 24, 2022 at 11:36:06 AM UTC-4, Mats Wichmann wrote:
> On 6/23/22 07:14, Richard David wrote: 
> > Is there a new scheduled date for releasing 3.11.0b4? Are there issues with 
> > b4 that have implications for b3? 
> > 
> > I realize it will be released when ready and am not trying to push or 
> > harass anyone involved. It just seems that versions are usually released on 
> > schedule so I'm wondering if there's some problem.
> Was an update today in python-dev (there are still release blockers)

For the record: https://groups.google.com/g/dev-python/c/_S8YGysqsxc

This does seem an unusually long delay.  In any event, it's clearly better to 
make sure it's working properly than to rush to keep to some schedule.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: 3.11.0b4?

2022-06-24 Thread Richard David
On Thursday, June 23, 2022 at 9:15:19 AM UTC-4, Richard David wrote:
> Is there a new scheduled date for releasing 3.11.0b4? Are there issues with 
> b4 that have implications for b3? 
> 
> I realize it will be released when ready and am not trying to push or harass 
> anyone involved. It just seems that versions are usually released on schedule 
> so I'm wondering if there's some problem.
See https://groups.google.com/g/dev-python/c/_3My1hukw6M/m/bz6I_p6kAQAJ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: open text file

2022-06-24 Thread jak

Il 24/06/2022 15:44, jak ha scritto:

Il 24/06/2022 15:10, simone zambonardi ha scritto:
Good morning, I need to read a text file. How come when I open it 
(running the script) it says this? The text file is type RFT


{\rtf1\ansi\ansicpg1252\cocoartf2636
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 
Helvetica;}

{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0 

\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 



\f0\fs24 \cf0

But even with in .txt it gives me this long string. I think it is a 
formatting problem .

thank you



I don't see the script you are talking about but it is normal to find
those strings inside a file of type '.rtf'. RTF documents are not simple
text documents (https://en.wikipedia.org/wiki/Rich_Text_Format) so if
you want to extract the text contained in these documents you will need
to use a library that can do this
(eg: https://pypi.org/project/striprtf/)
...or write a parser yourself.

P.S.
renaming the file extension does not change its content but it is useful
for the system to select the app that knows how to manage it

--
https://mail.python.org/mailman/listinfo/python-list


Re: "CPython"

2022-06-24 Thread Avi Gross via Python-list
David,
I understand now. As a project for your own edification I can understand it, 
albeit it is a more substantial effort than many people might choose, LOL!
So unless it starts being used heavily and adopted by some organization, the 
result of your effort will not necessarily be compatible with many modules now 
available or keep up with changes as python adds features or fixes bugs.
I am curious about why something like numpy could not be integrated into what 
you do. Of course, if you are the only user, ...
My hobbies to spend my time may not be as ambitious, but are quite a bit more 
varied! LOL!



-Original Message-
From: David J W 
To: Avi Gross 
Cc: python-list@python.org 
Sent: Fri, Jun 24, 2022 11:57 am
Subject: Re: "CPython"

The main motivation for a Python virtual machine in Rust is to strengthen my 
knowledge with Rust which currently has some gnarly bits to it but otherwise is 
an impressive low level language.   Rust's future is looking very bright as 
even Linus Torvalds agrees with most of its design choices and is allowing it 
to be used as a linux kernel module language.   
Skipping ahead to the subject of names, Rython was chosen because "Python" is 
trademarked by the PSF so anything with the complete word Python in it is out.  
 A close runner up would have been Camelot but that is already taken.
Going backward to the issue of use and audience.  Making Rython a real virtual 
machine that passes the CPython unit-tests is the only goal.   I am actively 
following the faster CPython fork that Mike Shannon, GVR, and others are 
working on with the intention to try and incorporate what they discover into my 
project but I don't think Rython will be dramatically faster than Cpython 
because I am going to implement the same PyObject reference counting garbage 
collector and unless faster CPython creates a JIT component, Rython won't have 
one either.  Additionally Ryhon won't have the must have killer libraries like 
numpy so it's a moot point if my project turns out to be dramatically faster.
To sum things up, I've been retired for over a decade so I have plenty of free 
time.   Initially I thought I might invest time into becoming a core python 
developer but looking into it further, all I will say is that doesn't feel like 
a very appealing use of my time.


On Thu, Jun 23, 2022 at 9:42 AM Avi Gross  wrote:

David,
I am curious why you are undertaking the effort to take a language already 
decades old and showing signs of being a tad rusty into a language that 
suggests further oxidation.
More seriously, I am interested in what this can gain and the intended user 
base. I studied Rust for a while and it has it's features but have had no 
opportunity to use it. Is it expected to make a faster version of Python, or 
enable better connections to libraries and so on? 
What I mean is that if you are planning on making it pass all tests for python 
functionality, are you also adding unique features or ... ?
My preference is to have names that fully include what they are about. So the 
name "python" would be left intact rather than mangled, even if the name itself 
happens to be totally meaningless. So may I suggest something like 
"""rustic-python""" ?


-Original Message-
From: David J W 
To: python-list@python.org
Sent: Thu, Jun 23, 2022 10:29 am
Subject: Re: "CPython"

>> Let's say they reimplement "reference python" CPython in Rust. What is
>> better? Change the "reference python" CPython name to RPython, for
>> example, or let it as CPython?

>The C implementation would still be called CPython, and the new
>implementation might be called RPython, or RustyPython, or whatever.
>The names are independent of which one is currently blessed as the
>reference implementation.

I am at the pre planning stages of making a Rust implementation of the
Python virtual machine and to avoid ambiguity I've been working with Rython
as the name.  I tried looking for a Monty Python themed name but the good
ones seem to be taken.

Otherwise as for a timeline, solo I figure it's going to take me a couple
years to get something that actually passes cpython's python unit-tests.
-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "CPython"

2022-06-24 Thread David J W
The main motivation for a Python virtual machine in Rust is to strengthen
my knowledge with Rust which currently has some gnarly bits to it but
otherwise is an impressive low level language.   Rust's future is looking
very bright as even Linus Torvalds agrees with most of its design choices
and is allowing it to be used as a linux kernel module language.

Skipping ahead to the subject of names, Rython was chosen because "Python"
is trademarked by the PSF so anything with the complete word Python in it
is out.   A close runner up would have been Camelot but that is already
taken.

Going backward to the issue of use and audience.  Making Rython a real
virtual machine that passes the CPython unit-tests is the only goal.   I am
actively following the faster CPython fork that Mike Shannon, GVR, and
others are working on with the intention to try and incorporate what they
discover into my project but I don't think Rython will be dramatically
faster than Cpython because I am going to implement the same PyObject
reference counting garbage collector and unless faster CPython creates a
JIT component, Rython won't have one either.  Additionally Ryhon won't have
the must have killer libraries like numpy so it's a moot point if my
project turns out to be dramatically faster.

To sum things up, I've been retired for over a decade so I have plenty of
free time.   Initially I thought I might invest time into becoming a core
python developer but looking into it further, all I will say is that
doesn't feel like a very appealing use of my time.



On Thu, Jun 23, 2022 at 9:42 AM Avi Gross  wrote:

> David,
>
> I am curious why you are undertaking the effort to take a language already
> decades old and showing signs of being a tad rusty into a language
> that suggests further oxidation.
>
> More seriously, I am interested in what this can gain and the intended
> user
> base. I studied Rust for a while and it has it's features but have had no
> opportunity to use it. Is it expected to make a faster version of Python,
> or enable better connections to libraries and so on?
>
> What I mean is that if you are planning on making it pass all tests for
> python functionality, are you also adding unique features or ... ?
>
> My preference is to have names that fully include what they are about.
> So the name "python" would be left intact rather than mangled, even if
> the name itself happens to be totally meaningless. So may I suggest
> something like """rustic-python""" ?
>
>
>
> -Original Message-
> From: David J W 
> To: python-list@python.org
> Sent: Thu, Jun 23, 2022 10:29 am
> Subject: Re: "CPython"
>
> >> Let's say they reimplement "reference python" CPython in Rust. What is
> >> better? Change the "reference python" CPython name to RPython, for
> >> example, or let it as CPython?
>
> >The C implementation would still be called CPython, and the new
> >implementation might be called RPython, or RustyPython, or whatever.
> >The names are independent of which one is currently blessed as the
> >reference implementation.
>
> I am at the pre planning stages of making a Rust implementation of the
> Python virtual machine and to avoid ambiguity I've been working with Rython
> as the name.  I tried looking for a Monty Python themed name but the good
> ones seem to be taken.
>
> Otherwise as for a timeline, solo I figure it's going to take me a couple
> years to get something that actually passes cpython's python unit-tests.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: 3.11.0b4?

2022-06-24 Thread Mats Wichmann
On 6/23/22 07:14, Richard David wrote:
> Is there a new scheduled date for releasing 3.11.0b4?  Are there issues with 
> b4 that have implications for b3?
> 
> I realize it will be released when ready and am not trying to push or harass 
> anyone involved. It just seems that versions are usually released on schedule 
> so I'm wondering if there's some problem.

Was an update today in python-dev (there are still release blockers)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
I copied  most of the libraries from cython
בתאריך יום ו׳, 24 ביוני 2022, 17:18, מאת Roel Schroeven ‏<
r...@roelschroeven.net>:

> Op 24/06/2022 om 14:14 schreef נתי שטרן:
> > My TARGET  is to bind many code libraries to one Huge code file that
> > works optimally and do optimizations if needed.
> > In this file have code of huge part of falconpy, ALL code of re,
> > argparse, are and many other code libraries
> Don't do that. Sorry, it's just as simple as that. Don't do that. All
> those modules are not designed to put together like that, all their
> namespaces merged together. Don't do it.
> Even if you could eventually get it to work, it would not be any more
> optimal.
>
> If you need more performance, look into things like Pypy or Cython.
>
> --
> "Experience is that marvelous thing that enables you to recognize a
> mistake when you make it again."
>  -- Franklin P. Jones
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven

Op 24/06/2022 om 14:14 schreef נתי שטרן:
My TARGET  is to bind many code libraries to one Huge code file that 
works optimally and do optimizations if needed.
In this file have code of huge part of falconpy, ALL code of re, 
argparse, are and many other code libraries
Don't do that. Sorry, it's just as simple as that. Don't do that. All 
those modules are not designed to put together like that, all their 
namespaces merged together. Don't do it.
Even if you could eventually get it to work, it would not be any more 
optimal.


If you need more performance, look into things like Pypy or Cython.

--
"Experience is that marvelous thing that enables you to recognize a
mistake when you make it again."
-- Franklin P. Jones

--
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
Where found the license of those libraries?
P. S.  The copied and modified code used only for internal use


בתאריך יום ו׳, 24 ביוני 2022, 15:28, מאת Chris Angelico ‏:

> ‪On Fri, 24 Jun 2022 at 22:16, ‫נתי שטרן‬‎  wrote:‬
> >
> > My TARGET  is to bind many code libraries to one Huge code file that
> works
> > optimally and do optimizations if needed.
> > In this file have code of huge part of falconpy, ALL code of re,
> argparse,
> > are and many other code libraries
> >
> > This code file is contained 10k lines of python code
> >
>
> Did you check the license terms of all of those libraries? Are you
> even legally allowed to do that?
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Chris Angelico
‪On Fri, 24 Jun 2022 at 22:16, ‫נתי שטרן‬‎  wrote:‬
>
> My TARGET  is to bind many code libraries to one Huge code file that works
> optimally and do optimizations if needed.
> In this file have code of huge part of falconpy, ALL code of re, argparse,
> are and many other code libraries
>
> This code file is contained 10k lines of python code
>

Did you check the license terms of all of those libraries? Are you
even legally allowed to do that?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse modify

2022-06-24 Thread נתי שטרן
Thanks a lot.
I will read documentation of enum module

בתאריך יום ו׳, 24 ביוני 2022, 14:33, מאת Roel Schroeven ‏<
r...@roelschroeven.net>:

> Op 24/06/2022 om 0:32 schreef Dennis Lee Bieber:
> > On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer"
> > declaimed the following:
> >
> > >???  wrote at 2022-6-23 15:31 +0300:
> > >>how to solve this (argparse)
> >
> > >>MAXREPEAT = _NamedIntConstant(32,name=str(32))
> > >>TypeError: 'name' is an invalid keyword argument for int()
> > >
> > >This does not look like an `argparse` problem:
> > >the traceback comes from `oracle/RTR.py`.
> >
> >   And the listed code looks quite suspicious to me...
> >
> > >> class _NamedIntConstant(int):
> > >> def __init__(cls, value):
> > >> self = super(_NamedIntConstant, cls).__init__(cls, value)
> > >> self.name = name
> > >> return self
> >
> >   There does not appear to be any provision for keyword arguments at
> all.
> > The only use of "name" is to an undefined object.
> >
> The code seems to be a copy of Lib/re/_constants.py (or
> Lib/sre_constants.py before commit
> 1be3260a90f16aae334d993aecf7b70426f98013), but in _constants.py that
> class uses __new__ instead of __init__:
>
>  class _NamedIntConstant(int):
>  def __new__(cls, value, name):
>  self = super(_NamedIntConstant, cls).__new__(cls, value)
>  self.name = name
>  return self
>
>  def __repr__(self):
>  return self.name
>
>  __reduce__ = None
>
> (unless still older versions did use __init__)
>
> It's used there as a kind of enum. I guess that code was originally
> written before Python had enum.Enum. _makecodes() uses it so create
> named int objects from its arguments, with automatically generated
> consecutive int values, places them in the global namespace (feels like
> a code smell to me) and also returns them.
>
>  def _makecodes(*names):
>  items = [_NamedIntConstant(i, name) for i, name in
> enumerate(names)]
>  globals().update({item.name: item for item in items})
>  return items
>
>  # operators
>  OPCODES = _makecodes(
>  # failure=0 success=1 (just because it looks better that way :-)
>  'FAILURE', 'SUCCESS',
>
>  'ANY', 'ANY_ALL',
>  'ASSERT', 'ASSERT_NOT',
>  'AT',
>  # ...
>  )
>
> נתי שטרן, are you trying to use that semi-enum functionality? Most
> likely you're better of using enum.Enum instead.
>
> --
> "You can fool some of the people all the time, and all of the people some
> of the time, but you cannot fool all of the people all of the time."
>  -- Abraham Lincoln
> "You can fool too many of the people too much of the time."
>  -- James Thurber
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
My TARGET  is to bind many code libraries to one Huge code file that works
optimally and do optimizations if needed.
In this file have code of huge part of falconpy, ALL code of re, argparse,
are and many other code libraries

This code file is contained 10k lines of python code



בתאריך יום ו׳, 24 ביוני 2022, 14:37, מאת Roel Schroeven ‏<
r...@roelschroeven.net>:

> Op 24/06/2022 om 11:10 schreef נתי שטרן:
> > OK. I lifted the full library to a HUGE python file that was saved on LAN
> > in MY WORK
> > Do I need to lift many other  libraries to the file?
> > I glad to any answer
> Answer this: what is it that your _actually_ trying to do? What is the
> ultimate goal of all that copying and changing? Cause there is almost
> always a better and easier way.
>
> --
> "You can fool some of the people all the time, and all of the people some
> of the time, but you cannot fool all of the people all of the time."
>  -- Abraham Lincoln
> "You can fool too many of the people too much of the time."
>  -- James Thurber
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven

Op 24/06/2022 om 11:10 schreef נתי שטרן:

OK. I lifted the full library to a HUGE python file that was saved on LAN
in MY WORK
Do I need to lift many other  libraries to the file?
I glad to any answer
Answer this: what is it that your _actually_ trying to do? What is the 
ultimate goal of all that copying and changing? Cause there is almost 
always a better and easier way.


--
"You can fool some of the people all the time, and all of the people some
of the time, but you cannot fool all of the people all of the time."
-- Abraham Lincoln
"You can fool too many of the people too much of the time."
-- James Thurber

--
https://mail.python.org/mailman/listinfo/python-list


Re: argparse modify

2022-06-24 Thread Roel Schroeven

Op 24/06/2022 om 0:32 schreef Dennis Lee Bieber:

On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer"
declaimed the following:

>???  wrote at 2022-6-23 15:31 +0300:
>>how to solve this (argparse)

>>MAXREPEAT = _NamedIntConstant(32,name=str(32))
>>TypeError: 'name' is an invalid keyword argument for int()
>
>This does not look like an `argparse` problem:
>the traceback comes from `oracle/RTR.py`.

And the listed code looks quite suspicious to me...

>> class _NamedIntConstant(int):
>> def __init__(cls, value):
>> self = super(_NamedIntConstant, cls).__init__(cls, value)
>> self.name = name
>> return self

There does not appear to be any provision for keyword arguments at all.
The only use of "name" is to an undefined object.

The code seems to be a copy of Lib/re/_constants.py (or 
Lib/sre_constants.py before commit 
1be3260a90f16aae334d993aecf7b70426f98013), but in _constants.py that 
class uses __new__ instead of __init__:


    class _NamedIntConstant(int):
    def __new__(cls, value, name):
    self = super(_NamedIntConstant, cls).__new__(cls, value)
    self.name = name
    return self

    def __repr__(self):
    return self.name

    __reduce__ = None

(unless still older versions did use __init__)

It's used there as a kind of enum. I guess that code was originally 
written before Python had enum.Enum. _makecodes() uses it so create 
named int objects from its arguments, with automatically generated 
consecutive int values, places them in the global namespace (feels like 
a code smell to me) and also returns them.


    def _makecodes(*names):
    items = [_NamedIntConstant(i, name) for i, name in 
enumerate(names)]

    globals().update({item.name: item for item in items})
    return items

    # operators
    OPCODES = _makecodes(
    # failure=0 success=1 (just because it looks better that way :-)
    'FAILURE', 'SUCCESS',

    'ANY', 'ANY_ALL',
    'ASSERT', 'ASSERT_NOT',
    'AT',
    # ...
    )

נתי שטרן, are you trying to use that semi-enum functionality? Most 
likely you're better of using enum.Enum instead.


--
"You can fool some of the people all the time, and all of the people some
of the time, but you cannot fool all of the people all of the time."
-- Abraham Lincoln
"You can fool too many of the people too much of the time."
-- James Thurber
--
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
OK. I lifted the full library to a HUGE python file that was saved on LAN
in MY WORK
Do I need to lift many other  libraries to the file?
I glad to any answer
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven

Op 24/06/2022 om 10:43 schreef נתי שטרן:

what's the problem with the code
Have you seen the replies from Mats Wichmann and Chris Angelico, who 
helpfully pointed out some problems with your code and possible 
improvements? Please take those into account instead of asking the same 
thing over and over.


--
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à
ajouter, mais quand il n'y a plus rien à retrancher."
"Perfectie is niet bereikt als er niets meer toe te voegen is, maar als er
niets meer weg te nemen is."
-- Antoine de Saint-Exupéry

--
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
I did the changes on local copy of this code

‫בתאריך יום ו׳, 24 ביוני 2022 ב-11:50 מאת ‪Chris Angelico‬‏ <‪
ros...@gmail.com‬‏>:‬

> ‪On Fri, 24 Jun 2022 at 18:43, ‫נתי שטרן‬‎  wrote:‬
> >
> > class _NamedIntConstant(int):
> > def __new__(cls, value, name):
> > self = super(_NamedIntConstant, cls).__new__(cls, value)
> > self.name = name
> > return self
> >
> > def __repr__(self):
> > return self.name
> >
> > __reduce__ = None
> >  MAXREPEAT = _NamedIntConstant(32,name=str(32))
> >
> > what's the problem with the code
>
> You ripped a bunch of code from the standard library without
> understanding what it does, and now it doesn't work. The problem is
> more with your methodology than your code.
>
> Why are you doing this? Why not simply use what's there?
>
> If you REALLY need to make source-level changes, make *changes*, don't
> try to lift small parts out. Also, you will need to spend some hours
> getting to know the code that you're mutating.
>
> Is there an alternative newsgroup for
> lazy-python-users-who-dont-want-to-do-the-w...@groups.google.com ?
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Chris Angelico
‪On Fri, 24 Jun 2022 at 18:43, ‫נתי שטרן‬‎  wrote:‬
>
> class _NamedIntConstant(int):
> def __new__(cls, value, name):
> self = super(_NamedIntConstant, cls).__new__(cls, value)
> self.name = name
> return self
>
> def __repr__(self):
> return self.name
>
> __reduce__ = None
>  MAXREPEAT = _NamedIntConstant(32,name=str(32))
>
> what's the problem with the code

You ripped a bunch of code from the standard library without
understanding what it does, and now it doesn't work. The problem is
more with your methodology than your code.

Why are you doing this? Why not simply use what's there?

If you REALLY need to make source-level changes, make *changes*, don't
try to lift small parts out. Also, you will need to spend some hours
getting to know the code that you're mutating.

Is there an alternative newsgroup for
lazy-python-users-who-dont-want-to-do-the-w...@groups.google.com ?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
class _NamedIntConstant(int):
def __new__(cls, value, name):
self = super(_NamedIntConstant, cls).__new__(cls, value)
self.name = name
return self

def __repr__(self):
return self.name

__reduce__ = None
 MAXREPEAT = _NamedIntConstant(32,name=str(32))

what's the problem with the code
-- 
https://mail.python.org/mailman/listinfo/python-list


argparse modify

2022-06-24 Thread נתי שטרן
Can you help me for solve it

בתאריך יום שישי, 24 ביוני 2022, מאת Dennis Lee Bieber :

> On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer" 
> declaimed the following:
>
> >???  wrote at 2022-6-23 15:31 +0300:
> >>how to solve this (argparse)
>
> >>MAXREPEAT = _NamedIntConstant(32,name=str(32))
> >>TypeError: 'name' is an invalid keyword argument for int()
> >
> >This does not look like an `argparse` problem:
> >the traceback comes from `oracle/RTR.py`.
>
> And the listed code looks quite suspicious to me...
>
> >> class _NamedIntConstant(int):
> >> def __init__(cls, value):
> >> self = super(_NamedIntConstant, cls).__init__(cls, value)
> >> self.name = name
> >> return self
>
> There does not appear to be any provision for keyword arguments at
> all.
> The only use of "name" is to an undefined object.
>
>
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.
> freeddns.org/
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

-- 
https://mail.python.org/mailman/listinfo/python-list