GithubHelp home page GithubHelp logo

python-pep505's People

Contributors

acaos avatar cdce8p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-pep505's Issues

Syntax proposal

Hi Doug,

I've been reading today about PEP 505 and I wondered if the following syntax could take away the complaint about new Python users finding the .? syntax unintuitive:

x = foo -> .help -> .get_user("doug") -> ["name"]

This would be the none-aware way to access foo.help.get_user("doug")["name"].

It comes down to using -> . instead of ?. and -> [ instead of ?[. I think that new users will intuitively understand that the -> arrows form a chain that might be broken at some point (and then None is returned).

Best,
Maarten

ps I just came to the conclusion that I personally also find this syntax easier on the eyes than .?. It seems to work well on the code examples that you give in PEP505

Environment-dependent errors when using non-ASCII characters

Hello.

In a Japanese Windows environment, the following parsing error occurs when attempting to execute source code containing non-ASCII (multibyte) characters.

> python -m main
Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Python310\lib\runpy.py", line 157, in _get_module_details
    code = loader.get_code(mod_name)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\parsinghook\hook.py", line 98, in get_code
    return FULLNAME_TO_LOADER[fullname]._parse_module()
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\parsinghook\hook.py", line 84, in _parse_module
    tree = self._parser.parse_module(f, self._filename)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\hook.py", line 52, in parse_module
    tree = parser.start()
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 405, in start
    (file := self.file())
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 416, in file
    (a := self.statements(),)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 489, in statements
    (a := self._loop1_3())
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 6463, in _loop1_3
    (statement := self.statement())
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 500, in statement
    (a := self.compound_stmt())
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 669, in compound_stmt
    self.positive_lookahead(self._tmp_7, )
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 250, in positive_lookahead
    ok = func(*args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\parser.py", line 6521, in _tmp_7
    (literal := self.expect('def'))
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 60, in memoize_wrapper
    tree = method(self, *args)
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\parser.py", line 230, in expect
    tok = self._tokenizer.peek()
  File "C:\Sandbox\sdvx_score_tool\venv\lib\site-packages\pep505\pegen\tokenizer.py", line 46, in peek
    tok = next(self._tokengen)
  File "<string>", line 452, in _tokenize
UnicodeDecodeError: 'cp932' codec can't decode byte 0x82 in position 998: illegal multibyte sequence

The source code file itself is written in UTF-8, but we think the reason is that Python on Japanese Windows tries to open the file in CP932 (SHIFT-JIS) by default.

I don't know much about the inner workings, but if you can solve this by explicitly specifying the encoding when opening the file, please do so.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.