[issue46455] Deprecate / remove os.name=java

2022-01-21 Thread Xavier Morel
Xavier Morel added the comment: PS: "platform.system()" also documents `Java` as a value which doesn't seem to make that much sense, however it's an open set so probably less of an issue / source of confusion. -- ___ Python track

[issue46455] Deprecate / remove os.name=java

2022-01-21 Thread Xavier Morel
New submission from Xavier Morel : os.name is defined as: > The following names have currently been registered: 'posix', 'nt', 'java'. In my understanding, the value `'java'` is for the benefit of jython, which is rather poorly. Other third-party implementations which may or may not h

[issue45368] ~(True) and ~(False) gives incorrect result

2021-10-05 Thread Xavier Morel
Xavier Morel added the comment: > True is a boolean so ~True should return False according to me. That's be a BC break for no reason: if you want to invert a boolean you can just `not` it. > True is not the same as 1 For historical reasons, in Python it is: >>> bool.mro()

[issue45365] concurrent.futures.Future should be suitable for use outside of executors

2021-10-04 Thread Xavier Morel
New submission from Xavier Morel : concurrent.futures.Future currently has the note: > Future instances are created by Executor.submit() and should not be created > directly except for testing. That seems like a shame as futures are useful concurrency construct and having to rebuil

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-08-07 Thread Xavier Morel
Xavier Morel added the comment: > If working Python 3 program suddenly became emitting BytesWarning it will > confuse users. Oh yeah no I meant making it a normal warning, without needing the `-b` flag, not enabling it by default. Because controlling / configuring warnings can b

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-08-07 Thread Xavier Morel
Xavier Morel added the comment: And though I did not check, I expect the `-b` flag exists mostly because of the performance impact of the warning any time bytes are checked for equality, but surely that impact would be limited and probably not very relevant for the stringification of bytes

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-08-07 Thread Xavier Morel
Xavier Morel added the comment: > I am not against documenting the behavior of -b and BytesWarning clearly. I > don't think that anyone would be against. Just somebody have to provide a PR. Right but what about the ability to enable warning on stringification without enabling the w

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-08-06 Thread Xavier Morel
Xavier Morel added the comment: Serhiy an other question (because I've encountered it *again*), do you think it'd be possible to split out the specific warning of stringifying (but *not* explicitely repr-ing) a bytes instance from everything else? There are use-cases for it, but I think

[issue44178] Add an interpreter-level critical section construct

2021-05-19 Thread Xavier Morel
New submission from Xavier Morel : Python code uses a fair amount of globals, and sometimes there's no good choice but to do dodgy things and temporarily update global state for one reason or another e.g. redirect a standard fd or stream (cf redirect_stdout), monkey-patch a builtin

[issue12056] "…" (HORIZONTAL ELLIPSIS) should be an alternative syntax for "..." (FULL STOP FULL STOP FULL STOP)

2021-05-19 Thread Xavier Morel
Xavier Morel added the comment: > But if we allow for ellipsis, then would we not also have to start allowing > characters like ≥ and ≤ in Python? No, they're not defined as canonically equivalent to >= and <= by the Unicode specification: >>> unicod

[issue44157] redirect_* should also redirect C-level streams

2021-05-17 Thread Xavier Morel
New submission from Xavier Morel : In 3.4 (resp. 3.5), `redirect_stdout` and `redirect_stderr` were added to provide easy and reentrant stream redirection. Although that is documented, it seems like a waste that they only redirect the high-level `sys.std*` streams: those are already pretty

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-03-20 Thread Xavier Morel
Xavier Morel added the comment: > In normal circumstances you should never deal with BytesWarning. The -b > option is only used for testing your program for some possible bugs caused by > migration from Python 2. If your program always worked only with Python 3, > the -b optio

[issue43527] Support full stack trace extraction in warnings.

2021-03-17 Thread Xavier Morel
New submission from Xavier Morel : When triggering warnings, it's possible to pass in a `stacklevel` in order to point to a more informative cause than the `warnings.warn` call. For instance `stacklevel=2` is a common one for DeprecationWarning in order to mark the call itself as deprecated

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-03-17 Thread Xavier Morel
Xavier Morel added the comment: Addendum: is there a way to force `-b` from within the running Python program? -- ___ Python tracker <https://bugs.python.org/issue43

[issue43526] Programmatic management of BytesWarning doesn't work for native triggers.

2021-03-17 Thread Xavier Morel
New submission from Xavier Morel : When setting `BytesWarning` programmatically (via the warnings API), though the `warnings.filters` value matches what's obtained via `python -b` and an explicit `warnings.warn` trigger will trigger, "native" triggers of the warning fail to trigge

[issue43036] TOS-behaviour documentation is inconsistent

2021-01-27 Thread Xavier Morel
Change by Xavier Morel : -- title: TOS-behaviour documentation is -> TOS-behaviour documentation is inconsistent ___ Python tracker <https://bugs.python.org/issu

[issue43036] TOS-behaviour documentation is

2021-01-27 Thread Xavier Morel
New submission from Xavier Morel : I was looking at the disassembly of a fairly straightforward listcomp: [e for e in s if e[0]] 1 0 BUILD_LIST 0 2 LOAD_FAST0 (.0) >>4 FOR_ITER16 (to 22)

[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Xavier Morel
Xavier Morel added the comment: Oh I now see you've created a PR to do essentially that, nm. -- ___ Python tracker <https://bugs.python.org/issue42644> ___ ___

[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Xavier Morel
Xavier Morel added the comment: > I think that patching logging.disable to raise a type error immediately would > be welcome FWIW `logging` has a built-in checker / converter[0] which is already used in a bunch of places (e.g. the aforementioned setLevel), it could just be added

[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Xavier Morel
Xavier Morel added the comment: The problem seems to be in the user code? As you were told by "Carreau", loggin.disable takes a logging level (an integer), since you're giving it a string which it dutifully stores, it blows up at the next logging call which happens to be

[issue42572] Better path handling with argparse

2020-12-08 Thread Xavier Morel
Xavier Morel added the comment: > What exactly do you do with a path argument? Because they mention "convert[ing] the string to a path", I would expect an output of `pathlib.Path`, optionally checked for existence / non-existence and / or kind (file, directory, symlink, ...

[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-12-06 Thread Xavier Morel
Xavier Morel added the comment: Tried patterning the PR after the one which originally added the warning. Wasn't too sure how the news item was supposed to be generated, and grepping the repository didn't reveal any clear script doing that, so I made up a date and copied an existing random

[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-12-06 Thread Xavier Morel
Change by Xavier Morel : -- pull_requests: +22532 pull_request: https://github.com/python/cpython/pull/23665 ___ Python tracker <https://bugs.python.org/issue42

[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-12-04 Thread Xavier Morel
Xavier Morel added the comment: I was preparing to open the PR but now I'm doubting: should I open the PR against master and miss islington will backport it, or should I open the PR against 3.9? -- ___ Python tracker <https://bugs.python.

[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-11-27 Thread Xavier Morel
Xavier Morel added the comment: > Do you want to submit a PR for this? Sure. Do you think the code I proposed would be suitable? > * The current logic matches the logic before the warning was added. > * The proposed logic matches what the code will do after the > deprec

[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-11-26 Thread Xavier Morel
New submission from Xavier Morel : In 3.9, using `random.sample` on sets triggers DeprecationWarning: Sampling from a set deprecated since Python 3.9 and will be removed in a subsequent version. *However* it also triggers on types which implement *both* Sequence and Set, despite Sequence

[issue42106] docs.python.org prioritises search horribly

2020-10-21 Thread Xavier Morel
Xavier Morel added the comment: Apparently it's at least a possibility on DDG's side (https://duckduckgo.com/search_box), don't know how easy it'd be to integrate in sphinx, or whether a hard dependency on an external search engine is acceptable / desirable

[issue42106] docs.python.org prioritises search horribly

2020-10-21 Thread Xavier Morel
New submission from Xavier Morel : I expect it simply uses sphinx and I don't know if sphinx's search is easily customisable but the experience is really terrible when looking for the doc of a specific thing, *especially* when that thing is or is related to a builtin, which I'd expect

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2020-10-16 Thread Xavier Morel
Xavier Morel added the comment: The 3.9 changelog mentions WITH_EXCEPT_FINISH but that seems to have ultimately been called WITH_EXCEPT_START, maybe it shoudl be updated also? -- nosy: +xmorel ___ Python tracker <https://bugs.python.

[issue24828] Segfault when using store-context AST node in a load context

2020-10-16 Thread Xavier Morel
Xavier Morel added the comment: Should I close this since I believe 2.7 is not supported anymore? -- ___ Python tracker <https://bugs.python.org/issue24

[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-10-15 Thread Xavier Morel
Xavier Morel added the comment: @rhettinger checking software against 3.9 there's a little issue with the way the check is done: if passed something which is *both* a sequence and a set (e.g. an ordered set), `random.sample` will trigger a warning, which I don't think is correct. Should I

[issue42033] Seemingly unnecessary complexification of foo(**kw)

2020-10-15 Thread Xavier Morel
Xavier Morel added the comment: I have not noticed anything, I was just looking at the bytecode changes and stumbled upon this oddity. Though I would expect a small slowdown as every fn(**kw) would now incur an extra dict copy, unless there’s something in call_function_ex which copies

[issue42033] Seemingly unnecessary complexification of foo(**kw)

2020-10-14 Thread Xavier Morel
New submission from Xavier Morel : Following bpo-39320 the highly specialised bytecode for vararg calls were replaced by simpler ones, but there seems to be at least one area where the generated bytecode regressed for possibly no reason? In Python 3.8, foo(**var) compiles to: 0 LOAD_GLOBAL

[issue41641] Add a "message" action to warnings, to trigger for every *unique* message

2020-08-26 Thread Xavier Morel
New submission from Xavier Morel : Warning actions allow deduplicating warning triggers based on category ("once"), category + file ("module") and category + exact location ("default"). One thing which is missing is support for a single location generating

[issue30951] Documentation error in inspect module

2020-06-25 Thread Xavier Morel
Xavier Morel added the comment: Maybe something along the lines of "names other than arguments and function locals", or "names of the symbols used in the code object, other than arguments and function locals"? This is still slightly confusing because in the case of

[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Xavier Morel
Xavier Morel added the comment: > Fair enough. So we can just add a sentence informing readers that `meta_path`, by default, holds entries to handle the standard kinds of modules (.py files, extension modules…). Yeah that's basically what I meant, talking about a "warning" in pytho

[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Xavier Morel
Xavier Morel added the comment: > A warning is probably too strong. Also, it's easy to check sys.meta_path at > the interpreter prompt, so I'm not sure it's worth mentioning at all. It's easy if you think of it and did not miss a small bit of the Python 3.3 release note indi

[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Xavier Morel
Xavier Morel added the comment: > I'm fine with adding a note to the Python 2 docs, but putting it in Python 3 > seems to be going in the wrong direction as having sys.meta_path not be empty > is how Python will be going forward. I don't think putting a note is any hint that the

[issue29920] Document cgitb.text and cgitb.html

2017-06-01 Thread Xavier Morel
Xavier Morel added the comment: Should I close this since the PR was merged? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Xavier Morel
Xavier Morel added the comment: And it turns out the change was noted in the Python 3.3 release notes[0] though not all the consequences were spelled out (and the meta_path and path_hooks documentations were not changed) [0] https://docs.python.org/3/whatsnew/3.3.html#visible-changes

[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Xavier Morel
Xavier Morel added the comment: Addendum: the warning was present (in the documentation) until Python 3.5, even though Python 3.3 is apparently where the "default finders" were moved to meta_path: > python3.2 -c 'import sys;print(sys.meta_path)' [] > python3.3 -c '

[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Xavier Morel
New submission from Xavier Morel: Encountered this issue porting Python 2 code manipulating meta_path to Python 3. In Python 2, meta_path is empty by default and its documentation specifically notes that: > sys.meta_path is searched before any implicit default finders or sys.p

[issue29920] Document cgitb.text and cgitb.html

2017-03-27 Thread Xavier Morel
Changes by Xavier Morel <xavier.mo...@masklinn.net>: -- pull_requests: -747 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29920] Document cgitb.text and cgitb.html

2017-03-27 Thread Xavier Morel
Xavier Morel added the comment: PR targetted to master rather than 2.7 -- pull_requests: +748 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29920] Document cgitb.text and cgitb.html

2017-03-27 Thread Xavier Morel
New submission from Xavier Morel: Currently, cgitb documents the hook (enable) and somewhat unclearly the ability to dump the HTML traceback to stdout, but despite that being technically available it does not document the ability to dump the traceback to a string as either text or html

[issue24828] Segfault when using store-context AST node in a load context

2015-08-08 Thread Xavier Morel
New submission from Xavier Morel: It looks to be fixed in 3.3 and up, but in Python 2.7 import ast m = ast.Module(body=[ ast.Expr(value=ast.Name(id='foo', ctx=ast.Store())) ]) ast.fix_missing_locations(m) code = compile(m, '', mode='exec') eval(code

[issue13405] Add DTrace probes

2014-06-26 Thread Xavier Morel
Changes by Xavier Morel xavier.mo...@masklinn.net: -- nosy: +xmorel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13405 ___ ___ Python-bugs-list

[issue14776] Add SystemTap static markers

2014-06-26 Thread Xavier Morel
Changes by Xavier Morel xavier.mo...@masklinn.net: -- nosy: +xmorel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14776 ___ ___ Python-bugs-list

[issue21590] Systemtap and DTrace support

2014-06-26 Thread Xavier Morel
Changes by Xavier Morel xavier.mo...@masklinn.net: -- nosy: +xmorel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21590 ___ ___ Python-bugs-list

[issue15639] csv.Error description is incorrectly broad

2012-08-14 Thread Xavier Morel
Xavier Morel added the comment: Correction: csv also seems to raise csv.Error if the file contains NUL bytes: Error: line contains NULL byte -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15639

[issue15639] csv.Error description is incorrectly broad

2012-08-13 Thread Xavier Morel
New submission from Xavier Morel: In both Python 2.7 and Python 3.x, csv.Error is documented as: Raised by any of the functions when an error is detected. As far as I can tell from using the module and looking at the code, this is completely incorrect. There is actually a single instance

[issue13850] Summary tables for argparse add_argument options

2012-03-25 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: Had some time to play with this today, here's a draft matrix of actions and add_argument parameters which is pretty readable, but: * It's incredibly not helpful for people who don't know argparse * I tried adding effects descriptions

[issue13850] Summary tables for argparse add_argument options

2012-03-25 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: completion for list item 4: although it would definitely make the raw text (in-rst) much harder to read compared to the current table (which can be used from the rst source without compiling

[issue13850] Summary tables for argparse add_argument options

2012-01-24 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: Creating the tables should not be too hard, especially using e.g. org-mode, but: 1. Where should those tables live? The argparse documentation is pretty big and there's no completely obvious place. I would guess table 1. could just

[issue13850] Summary tables for argparse add_argument options

2012-01-24 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: My specific suggestion is to have a dedicated Quick Reference section before the first example. OK, that looks like a good plan. -- ___ Python tracker rep...@bugs.python.org http

[issue13850] Summary tables for argparse add_argument options

2012-01-24 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: The Parameters column would span multiple lines, with one parameter and a brief description of the parameter on each line. I started looking into that, and it turns out that's more annoying than expected: a bunch of parameters

[issue12056] … (HORIZONTAL ELLIPSIS) should be an alternative syntax for ... (FULL STOP FULL STOP FULL STOP)

2011-05-11 Thread Xavier Morel
New submission from Xavier Morel xavier.mo...@masklinn.net: In Python 3, ... became useable as a normal expression, and translates into an ellipsis instance. Unicode defines an ellipsis character … (U+2026 HORIZONTAL ELLIPSIS) which is canonically equivalent to a 3-sequence of FULL STOP [U

[issue11979] Minor improvements to the Sockets readme: typos, wording and sphinx features usage

2011-05-02 Thread Xavier Morel
New submission from Xavier Morel xavier.mo...@masklinn.net: First patch fixes a typo (the reads a reply - then reads a reply) and — I believe — improves the wording of a pair of sentences. Second patch makes use of Sphinx's ``:abbr:`` role, and removes some period which I think are redundant

[issue11979] Minor improvements to the Sockets readme: typos, wording and sphinx features usage

2011-05-02 Thread Xavier Morel
Changes by Xavier Morel xavier.mo...@masklinn.net: Added file: http://bugs.python.org/file21854/sphinx-features ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11979

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-22 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: Do tests currently exist for smtpd run as a script? I have to confess I didn't think to check. If not, our experience with converting compileall to argparse indicates a thorough test suite is needed (and even so we missed some

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-22 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: any of the undocumented command-line interfaces are intentionally undocumented -- they were there for the convenience of the developer for exercising the module as it was being developed and are not part of the official API. I can

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-22 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: One more note I forgot previously: the conversion of as much scripts as possible to argparse would be for three reasons: * Make behavior consistent across the board (e.g. -h/--help) * Make CLI documentation format consistent across

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-22 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: Barry, do I correctly understand your comment to mean I should write end-to-end tests of the CLI (until reaching the already tested meat of smtpd), not just the CLI options parsing

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-22 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: Only document and formalize the parts that are well thought out. I don't believe I have the knowledge, right or ability to make that call for any module or package but a pair of extremely obvious ones (http.server seems a pretty good

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-20 Thread Xavier Morel
New submission from Xavier Morel xavier.mo...@masklinn.net: argparse has been merged to the standard library in 3.2, and (tell me if I'm wrong) would therefore be the best-practices way to parse command-line arguments. Numerous stdlib modules can be used as scripts, but they tend to have ad

[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-20 Thread Xavier Morel
Xavier Morel xavier.mo...@masklinn.net added the comment: Second patch: documenting smtpd-as-a-script in the module's rst -- Added file: http://bugs.python.org/file20813/smtpd-as-script-doc.diff ___ Python tracker rep...@bugs.python.org http

Re: Hashtables in pyhton ...

2006-03-09 Thread Xavier Morel
Konrad Mühler wrote: Hi, are there predefinded chances to use hashtables in python? How can I use Hashtable in python? Or do I have to implement this on my own? Thanks A Java Hashtable/Hashmap is equivalent to a Python dictionary, which is a builtin objects (and not a second-class

Re: a question about zip...

2006-03-08 Thread Xavier Morel
KraftDiner wrote: I had a structure that looked like this ((0,1), (2, 3), (4, 5), (6,7) I changed my code slightly and now I do this: odd = (1,3,5,7) even = (0,2,4,6) all = zip(even, odd) however the zip produces: [(0, 1), (2, 3), (4, 5), (6, 7)] Which is a list of tuples.. I wanted

Re: python debugging question

2006-03-08 Thread Xavier Morel
[EMAIL PROTECTED] wrote: I am a python newbie. I have writen some 500 lines of code. There are 4 classes and in all 5 files. Now, I am trying to run the program. I am getting wrong values for the simulation results. Is there any debugging facilities in python which would let me go step by

Re: Why I chose Python over Ruby

2006-03-06 Thread Xavier Morel
Bil Kleb wrote: Xavier Morel wrote: 2) Ruby does not have true first-class functions living in the same namespace as other variables while Python does : In Ruby you need extra syntax that ruins the first-class-ness : The extra syntax is a side-effect of the parensless call of method

Re: Why I chose Python over Ruby

2006-03-06 Thread Xavier Morel
Torsten Bronger wrote: Yes, however, this is also true for Python in my opinion. Ruby's ability to generate DSLs is an order of magnitude better than Python's at least. I only know of the Lisp dialects that get better at DSLs. Check Rails' validation methods (in the models), or if you don't

Re: how do you move to a new line in your text editor?

2006-03-06 Thread Xavier Morel
John Salerno wrote: So I'm wondering, how do you all handle moving around in your code in cases like this? Is there some sort of consistency to these things that you can write rules for your text editor to know when to outdent? It doesn't seem like you can do this reliably, though. Under

Re: Use python from command line

2006-03-06 Thread Xavier Morel
trixie wrote: Using WinXP and Python24 on generic desktop. Being used to linux and command line operations I cannot make Windows accept the 'python myprog.py' command. Any help appreciated. Bob I think you could've given us the error message that this command yields. Issue is probably

Re: Why I chose Python over Ruby

2006-03-05 Thread Xavier Morel
I'll just play the devil's advocate here Francois wrote: 1) In Ruby there is a risk of Variable/Method Ambiguity when calling a method with no parameters without using () : Yes, but that's in my opinion a programmer error, not necessarily a language error. 2) Ruby does not have true

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Xavier Morel
[EMAIL PROTECTED] wrote: Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C dict1 = {1:23,2:76,4:56} dict2 = {23:'A',76:'B',56:'C'} dict((k, dict2[v]) for k, v in dict1.items()) {1: 'A', 2: 'B',

Re: Pure python implementation of string-like class

2006-02-26 Thread Xavier Morel
Ross Ridge wrote: Xavier Morel wrote: Not if you're still within Unicode / Universal Character Set code space. Akihiro Kayama in his original post made it clear that he wanted to use a character set larger than entire Unicode code space. Ross Ridge

Re: Pure python implementation of string-like class

2006-02-25 Thread Xavier Morel
Akihiro KAYAMA wrote: Sorry for my terrible English. I am living in Japan, and we have a large number of characters called Kanji. UTF-16(U+...U+10) is enough for practical use in this country also, but for academic purpose, I need a large codespace over 20-bits. I wish I could use

Re: Pure python implementation of string-like class

2006-02-25 Thread Xavier Morel
Ross Ridge wrote: Steve Holden wrote: Wider than UTF-16 doesn't make sense. It makes perfect sense. Ross Ridge Not if you're still within Unicode / Universal Character Set code space. While UCS-4 technically goes beyond any

Re: Processing text using python

2006-02-20 Thread Xavier Morel
nuttydevil wrote: Hey everyone! I'm hoping someone will be able to help me, cause I haven't had success searching on the web so far... I have large chunks of text ( all in a long string) that are currently all in separate notebook files. I want to use python to read these strings of text,

Re: Processing text using python

2006-02-20 Thread Xavier Morel
Fredrik Lundh wrote: did you read the string chapter in the tutorial ? http://docs.python.org/tut/node5.html#SECTION00512 around the middle of that chapter, there's a section on slicing: substrings can be specified with the slice notation: two indices separated

Re: define loop statement?

2006-02-17 Thread Xavier Morel
Rene Pijlman wrote: David Isaac: I would like to be able to define a loop statement (nevermind why) so that I can write something like loop 10: do_something instead of for i in range(10): do_something Possible? If so, how? Yes. By implementing a compiler or an interpreter

Re: define loop statement?

2006-02-17 Thread Xavier Morel
Rene Pijlman wrote: David Isaac: I would like to be able to define a loop statement (nevermind why) so that I can write something like loop 10: do_something instead of for i in range(10): do_something Possible? If so, how? Yes. By implementing a compiler or an interpreter

Re: Python, Forms, Databases

2006-02-15 Thread Xavier Morel
Tempo wrote: Larry I do see your point. There does seem to be a lot more support for PHP and MySQL together than there is Python and ASP. But I want to first try to accomplish my goal by using Python first before I give up and revert back to PHP. So if I was going to parse HTML forms and place

Re: appending to a list via properties

2006-02-11 Thread Xavier Morel
Alex Martelli wrote: Carl Banks [EMAIL PROTECTED] wrote: ... class better_list (list): tail = property(None, list.append) This is an impressive, spiffy little class. Yes, nice use of property. Alex I don't know, I usually see people considering that properties are cool

Re: Create dict from two lists

2006-02-10 Thread Xavier Morel
Diez B. Roggisch wrote: py wrote: I have two lists which I want to use to create a dictionary. List x would be the keys, and list y is the values. x = [1,2,3,4,5] y = ['a','b','c','d','e'] Any suggestions? looking for an efficent simple way to do this...maybe i am just having a brain

Re: creat a DOM from an html document

2006-02-09 Thread Xavier Morel
Mark Harrison wrote: I thought I saw a package that would create a DOM from html, with allowances that it would do a best effort job to parse non-perfectly formed html. Now I can't seem to find this... does anybody have a recommendation as to a good package to look at? Many TIA! Mark

Re: A __getattr__ for class methods?

2006-02-08 Thread Xavier Morel
Dylan Moreland wrote: I'm trying to implement a bunch of class methods in an ORM object in order to provide functionality similar to Rails' ActiveRecord. This means that if I have an SQL table mapped to the class Person with columns name, city, and email, I can have class methods such as:

Re: A __getattr__ for class methods?

2006-02-08 Thread Xavier Morel
Oh, and I wondered too: is your goal to build an ORM, or do you just need an ORM? Cause if it's the latter then Python does already have some fairly good ORMs such as SQLAlchemy or PyDO2, you don't *need* to create yours. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ternary Operator Now?

2006-02-08 Thread Xavier Morel
Ben Wilson wrote: I read somewhere else that Python was getting a ternary operator (e.g. x = (true/false) ? y : z). I read the PEP about it and that the PEP had been approved this past Fall. Has this been released into the wild yet? IIRC, the operator is like: x = y if C : else z PEP

Re: Dual Core outlook

2006-02-07 Thread Xavier Morel
malv wrote: Of course, multiprocessing has been used for many years but this always involved a much higher level of sophistication on the part of the designers. This point seems to be largely hidden from the public, ignorant and semi-ignorant, by the chip manufacturers. Will new languages see

Re: Dual Core outlook

2006-02-07 Thread Xavier Morel
malv wrote: Maybe this is too simplistic, but given two programs, one in Python the other in Java or C#. Would this mean that running the latter on a dual core processor would significantly increase execution speed, whereas the Python program would be running in one processor only without any

Re: tricky regular expressions

2006-02-07 Thread Xavier Morel
Ernesto wrote: I'm not sure if I should use RE's or some other mechanism. Thanks I think a line-based state machine parser could be a better idea. Much simpler to build and debug if not faster to execute. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python good for web crawlers?

2006-02-07 Thread Xavier Morel
Paul Rubin wrote: Generally I use urllib.read() to get the whole html page as a string, then process it from there. I just look for the substrings I'm interested in, making no attempt to actually parse the html into a DOM or anything like that. BeautifulSoup works *really* well when you

Re: tricky regular expressions

2006-02-07 Thread Xavier Morel
Ernesto wrote: Xavier Morel wrote: Ernesto wrote: I'm not sure if I should use RE's or some other mechanism. Thanks I think a line-based state machine parser could be a better idea. Much simpler to build and debug if not faster to execute. What is a line-based state machine ? Parse

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Xavier Morel
Terry Reedy wrote: John Pote [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would wish to secure this data gathering against crashes of the OS, I have read about people running *nix servers a year or more without stopping. He'd probably want to check the various

Re: Importing a class, please help...

2006-02-05 Thread Xavier Morel
anon wrote: Would somebody please drop me a hint, please? Yeah, the definition of JAR is Java ARchive, why the hell would a Python script be able to read a JAR in the first place (truth is it is, a JAR file is nothing but a renamed ZIP, therefore the zipfile module allows you to read it's

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: x = input(raw_input(Please enter your name: )) if x==myself: print 'OK' It kinda works - I can get to the please enter your name bit but then it simply reprints your input as output. Someone please HELP! -- C:\python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: p.s. Xavier Morel, you seem to be using Windows, not Linux I don't see how this may even remotely be relevant, Python is cross platform and (mostly) works the same regardless of the OS I got the idea of stacking input on a raw_input from the official Python Tutorial

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: http://docs.python.org/tut/node6.html#SECTION00610 -- x = int(raw_input(Please enter an integer: )) -- Unless my eyes fail me, it's written int, not input, the goal of this line is to convert the return value of raw_input (a string) into an integer. --

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: Assumption. Im also new to programing, so could do something stupid like think a Windows path is a command/input/etc. (really, ive done things like that before.) Don't assume anything when you have no reason to, and especially don't assume that a cross-platform programming

  1   2   >