Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Antoon Pardon
Op 20-07-16 om 07:42 schreef Steven D'Aprano: > Floating point maths is hard, thinking carefully about what you are doing and > whether it is appropriate to use == or a fuzzy almost-equal comparison, or if > equality is the right way at all. > > "But thinking is hard, can't you just tell me the a

Re: Why not allow empty code blocks?

2016-07-26 Thread Antoon Pardon
Op 24-07-16 om 21:00 schreef Chris Angelico: > A skilled craftsman in any field will choose to use quality tools. > They save time, and time is money.[/quote] Sure, but sometimes there is a flaw somewhere. A flaw whose consequences can be reduced by using an extra tool. If that is the case the rea

TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-27 Thread Antoon Pardon
I am rewriting a program so it can work in python3. I am making progress, but now I stumble on the exception mentioned in the subject. The code still works in python2. What I'm doing is to write the results to temporary file that needs to be sorted afterwards. For as far as I understand after don

Re: TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-29 Thread Antoon Pardon
Below is a short program that illustrate the problem It works with python2, whether you use the -c option or not. It only works with python3 if you use the -c option. The problem seems to come from my expectation that a file is its own iterator and in python3 that is no longer true for a NamedTemp

Re: Why not allow empty code blocks?

2016-07-29 Thread Antoon Pardon
Op 23-07-16 om 16:19 schreef Chris Angelico: > On Sun, Jul 24, 2016 at 12:00 AM, BartC wrote: >> Or, for debugging or other reasons, when you need to comment out the >> contents of a block. Then pass needs to be added. > How often do you comment out an entire block and not its header? I > don't re

Re: Why not allow empty code blocks?

2016-07-29 Thread Antoon Pardon
Op 29-07-16 om 13:14 schreef D'Arcy J.M. Cain: > On Fri, 29 Jul 2016 10:58:35 +0200 > Antoon Pardon wrote: >> As BartC already mentions it happens fairly often during debugging. >> Something like. >> >> try: >>Some code >> except Some_Exception:

Re: Why not allow empty code blocks?

2016-07-29 Thread Antoon Pardon
ng it with `pass`, in general > your code will just break again as soon as it continues processing. I think the case where you just want to ignore the exception, but it can at times be useful to get some extra logging information for debuging purposes, is not that rare as you seem to suggest. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why not allow empty code blocks?

2016-07-29 Thread Antoon Pardon
Op 29-07-16 om 16:38 schreef Steven D'Aprano: > On Fri, 29 Jul 2016 11:55 pm, Antoon Pardon wrote: > >> Op 29-07-16 om 15:43 schreef Steven D'Aprano: >>> Of course it won't, which is why I don't believe all these folks who >>> claim that they

Re: Why not allow empty code blocks?

2016-08-02 Thread Antoon Pardon
Op 30-07-16 om 05:49 schreef Steven D'Aprano: > On Sat, 30 Jul 2016 04:32 am, Antoon Pardon wrote: > > > Perhaps its *you* who doesn't understand. The subject line talks > about "empty code blocks", and Bart has suggested that instead of having to > write &

Re: Why not allow empty code blocks?

2016-08-02 Thread Antoon Pardon
Op 30-07-16 om 18:15 schreef Rustom Mody: > > The more general baby that is significant is that beginners should have > it easy to distinguish procedure and function and python does not naturally > aid that. print was something procedure-ish in python2 but the general > notion being > absent is

Re: Why not allow empty code blocks?

2016-08-03 Thread Antoon Pardon
aching language? It is not because it gets the Procedure vs Function ontology right. As far as I know scheme has about the same data structures as python, they are just called differently and there are some limitations. So when putting scheme and python next to each other we should choose schem

Re: make an object read only

2016-08-05 Thread Antoon Pardon
Op 05-08-16 om 02:03 schreef Lawrence D’Oliveiro: > On Wednesday, August 3, 2016 at 3:13:01 AM UTC+12, Robin Becker wrote: >> A reportlab user found he was doing the wrong thing by calling >> canvas.save repeatedly, our documentation says you should not use Canvas >> objects after the save method h

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread Antoon Pardon
On 8/12/18 09:35, Ian Kelly wrote: > On Fri, Dec 7, 2018 at 11:56 PM Henrik Bengtsson > wrote: >> A comment from the sideline: one could imagine extending the Python syntax >> with a (optional) 0d prefix that allows for explicit specification of >> decimal values. They would "complete" the family:

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread Antoon Pardon
On 8/12/18 06:00, Cameron Simpson wrote: > On 07Dec2018 20:24, Jach Fong wrote: >> Ian at 2018/12/8 UTC+8 AM11:28:34 wrote: >>> What is it exactly that you're trying to accomplish with this? Perhaps >>> there's a better way than using eval. >> >> This problem comes from solving a word puzzle, >>  

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread Antoon Pardon
On 8/12/18 07:59, Serhiy Storchaka wrote: > 08.12.18 03:17, jf...@ms4.hinet.net пише: > 00 >> 0 > 03 >>    File "", line 1 >> 03 >>   ^ >> SyntaxError: invalid token > > > In Python 3.8 the error message will be more informative: > 03 >   File "", line 1 > SyntaxError: leading

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread Antoon Pardon
On 10/12/18 11:03, Chris Angelico wrote: > On Mon, Dec 10, 2018 at 9:01 PM Antoon Pardon wrote: >> On 8/12/18 06:00, Cameron Simpson wrote: >>> On 07Dec2018 20:24, Jach Fong wrote: >>>> Ian at 2018/12/8 UTC+8 AM11:28:34 wrote: >>>>> What is it exact

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread Antoon Pardon
On 10/12/18 11:16, Chris Angelico wrote: > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon wrote: >> On 10/12/18 11:03, Chris Angelico wrote: >>> Considering that, in a problem of that description, neither S nor M >>> may represent zero, I don't think there&#

Re: How to replace space in a string with \n

2019-01-31 Thread Antoon Pardon
On 31/01/19 10:18, ^Bart wrote: > Hello everybody! :) > > I got a text and I should replace every space with \n without to use > str.replace, I thought something like this: Have you even tried to run this? > > text = "The best day of my life!" > > space = (' ') > > if text.count(' ') in text: >  

Re: How to replace space in a string with \n

2019-01-31 Thread Antoon Pardon
On 31/01/19 10:37, Michael Poeltl wrote: > hi, > > ^Bart ended in a Mail-Delivery... > so I send it ONLY to the python-list > > ^Bert, a proper way to do what you'd liked to achieve is the following: No it is not the proper way of a school test to copy what others provided. -- Antoon. -- htt

Re: How to replace space in a string with \n

2019-01-31 Thread Antoon Pardon
On 31/01/19 11:47, ^Bart wrote: >>    . A correct answer to the exercise would be: >> >> |You cannot replace a space with \n in a string, >> |because strings are immutable in Python. > > Yes, I thought in a wrong way! :) > Well maybe you can turn the string into a list of characters. Then replace t

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-27 Thread Antoon Pardon
would also work: I don't know. Something like the following is already legal: f(x)[n] = x * n And it does something completly different. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-28 Thread Antoon Pardon
On 27/03/19 22:25, Terry Reedy wrote: > ... > > Before 3.8, I would stop here and say no to the proposal.  But we now > have assignment expressions in addition to assignment statements. > > >>> int(s:='42'+'742') > 42742 > >>> s > '42742' > > To me, function assignment expressions, as a enhanced re

Re: Prepare accented characters for HTML

2019-03-28 Thread Antoon Pardon
and so on. I've had > some success using string.replace(), but it is difficult to cater for > every case. How about this function (python3): def char2html(l): return '&#%d;' % ord(l) -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-29 Thread Antoon Pardon
would go for the following: fac(0) -> 1 fac(n) -> n * fac(n - 1) Which seems incompatible with the proposal for an alternative lambda. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-09 Thread Antoon Pardon
On 8/04/19 23:14, DL Neil wrote: > Is logging an unpopular package? I think it does too much and too litle. On the one hand, you are overwhelmed by the possibilities, most of which you don't need. On the other hand, you find that it is missing a number of levels in comparison with syslog. I als

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-09 Thread Antoon Pardon
.) I use the simultaneous active handlers regularly. I write a lot of things that are called by cron. My standard set up is to have two handlers. One with loglevel INFO that writes to a file and one with loglevel WARNING that writes to stderr. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: super or not super?

2019-07-16 Thread Antoon Pardon
. Can you spot both of them? > Well, obviously it's violating LSP by changing the signature of > __init__, which means that you have to be aware of its position in the > hierarchy. If you want things to move around smoothly, you HAVE to > maintain a constant signature (which might mean using *args and/or > **kwargs cooperatively). I guess the second problem is that C1 doesn't call super. Meaning that if someone else uses this in a multiple heritance scheme, and the MRO reaches C1, the call doesn't get propagated to the rest. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: super or not super?

2019-07-16 Thread Antoon Pardon
On 16/07/19 10:18, Chris Angelico wrote: > On Tue, Jul 16, 2019 at 6:05 PM Antoon Pardon wrote: >> On 16/07/19 09:18, Chris Angelico wrote: >>> On Tue, Jul 16, 2019 at 3:32 PM Ian Kelly wrote: >>>> Just using super() is not enough. You need to take steps if you want

Extending an Enum type

2019-07-18 Thread Antoon Pardon
d side with a list that gets printed something like the following: [, '+', ] I am a bit at a loss right now on how to start. Can someone point me in the right direction? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Extendable Enum like Type?

2019-07-18 Thread Antoon Pardon
contains the following production: Term -> Term '+' Factor I can reprensent the right hand side with a list that gets printed something like the following: [, '+', ] I am a bit at a loss right now on how to start. Can someone point me in the right direction? -- Antoon Pardon --

Re: Extendable Enum like Type?

2019-07-19 Thread Antoon Pardon
On 18/07/19 18:14, Ethan Furman wrote: > On 07/18/2019 06:04 AM, Antoon Pardon wrote: > >> I am experimenting with writing an Earley Parser. Now I would like to >> have the non-terminals from the grammer I am reading in, be represented >> bye an enum like type. So that if

How do I give a decorator acces to the class of a decorated function

2019-09-04 Thread Antoon Pardon
What I am trying to do is the following. class MyClass (...) : @register def MyFunction(...) ... What I would want is for the register decorator to somehow create/mutate class variable(s) of MyClass. Is that possible or do I have to rethink my approach? -- Antoon Pardon

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Antoon Pardon
On 4/09/19 17:46, Peter Otten wrote: > Antoon Pardon wrote: > >> What I am trying to do is the following. >> >> class MyClass (...) : >> @register >> def MyFunction(...) >> ... >> >> What I would want is for the register deco

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Antoon Pardon
On 4/09/19 17:46, Peter Otten wrote: > Antoon Pardon wrote: > >> What I am trying to do is the following. >> >> class MyClass (...) : >> @register >> def MyFunction(...) >> ... >> >> What I would want is for the register deco

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Antoon Pardon
x/prodcution with a specific method to be called in specific circumstances when parsing a string. So I need the lexing and parsing algorithms available to this class, either by adding methods to the class or by making a subclass of the class where they are implemented. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

decorator needs access to variables where it is used.

2019-10-09 Thread Antoon Pardon
I have some logging utilities so that when I write library code, I just use the following. from logutil import Logger log = Logger(__name__) And from then on I just use log, to do the logging of that module. But now I would like to write a decorator trace, so that a decorated function would lo

Re: decorator needs access to variables where it is used.

2019-10-10 Thread Antoon Pardon
On 9/10/19 13:02, Chris Angelico wrote: > On Wed, Oct 9, 2019 at 9:53 PM Antoon Pardon wrote: >> I have some logging utilities so that when I write library code, I just use >> the following. >> >> from logutil import Logger >> >> log = Logger(__name__) >

Curious about library inclusion

2019-10-10 Thread Antoon Pardon
I was wondering how likely it would be that piped-iterators like shown in http://code.activestate.com/recipes/580625-collection-pipeline-in-python/ would make it into a future python version. Once I started using them (and included some more) I found I really liked working with them. For instance I

Re: Curious about library inclusion

2019-10-10 Thread Antoon Pardon
That seems to have been thoruoghly garbled so I start again. I was wondering how likely it would be that piped iterators like shown in http://code.activestate.com/recipes/580625-collection-pipeline-in-python/ would make it into a future python version/ Once I started using them (and included some

Re: Curious about library inclusion

2019-10-10 Thread Antoon Pardon
About including piped iterators: http://code.activestate.com/recipes/580625-collection-pipeline-in-python/ On 10/10/19 13:00, Paul Moore wrote: > As another measure, look at various other libraries on PyPI and ask > yourself why *this* library needs to be in the stdlib more than those > others

Re: Curious about library inclusion

2019-10-15 Thread Antoon Pardon
On 11/10/19 15:48, Rhodri James wrote: > On 10/10/2019 12:40, Antoon Pardon wrote: >> About including piped iterators: >> >> http://code.activestate.com/recipes/580625-collection-pipeline-in-python/ >> >> On 10/10/19 13:00, Paul Moore wrote: >>>

Re: Curious about library inclusion

2019-10-16 Thread Antoon Pardon
On 15/10/19 13:59, Rhodri James wrote: > On 15/10/2019 12:38, Antoon Pardon wrote: >> On 11/10/19 15:48, Rhodri James wrote: >>> On 10/10/2019 12:40, Antoon Pardon wrote: >>>> About including piped iterators: >>>> >>>> http://code.active

Except with empty tuple

2019-10-16 Thread Antoon Pardon
I would like to verify I understand correctly. It is about the following construct: try: statement1 statement2 ... except (): pass As far as I understand and my tests seem to confirm this, this is equivallent to just statement1 statement2 ...

problem with curring in python

2019-10-22 Thread Antoon Pardon
Using python 3.5 I have been experimenting with curried functions. A bit like in Haskell. So I can write the following function: def sum4(a, b, c, d): return a + b + c + d summing = curry(sum4) print summing(1)(2)(3)(4) # this prints 10. The problem is I need the signature of the original

Re: problem with curring in python

2019-10-22 Thread Antoon Pardon
On 22/10/19 12:02, Terry Reedy wrote: > On 10/22/2019 4:58 AM, Antoon Pardon wrote: >> Using python 3.5 >> >> I have been experimenting with curried functions. A bit like in Haskell. >> So I can write the following function: >> >> def sum4(a, b, c, d): >

Re: a regex question

2019-10-25 Thread Antoon Pardon
On 25/10/19 12:22, Maggie Q Roth wrote: > Hello > > There are two primary types of lines in the log: > > 60.191.38.xx/ > 42.120.161.xx /archives/1005 > > I know how to write regex to match each line, but don't get the good result > with one regex to match both lines. Could you provid

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Antoon Pardon
On 5/11/19 19:33, Spencer Du wrote: > Hi > > I want to execute at least two python files at once when imported but I dont > know how to do this. Currently I can only import each file one after another > but what i want is each file to be imported at the same time. Can you help me > write the cod

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-07 Thread Antoon Pardon
erator import truediv from functools import partial ls = range(1, 11) for x in map(partial(truediv, 1), ls): print(x) In the code above "partial(truediv, 1)" will produce a function that will inverse its argument and I don't need to give this function a name to pass

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Antoon Pardon
On 7/11/19 18:10, Stephen Waldron wrote: > What I'm aiming for is the ability to, within a function call, pass a suite > that would be there automatically defined by the compiler/interpreter. > Another comment did mention lambda functions, which does to some degree > provide that capability, but

Re: Syntax Suggestion: Pass Function Definition as Argument

2019-11-08 Thread Antoon Pardon
On 8/11/19 13:00, Chris Angelico wrote: > On Fri, Nov 8, 2019 at 10:57 PM Antoon Pardon wrote: >> On 7/11/19 18:10, Stephen Waldron wrote: >>> What I'm aiming for is the ability to, within a function call, pass a suite >>> that would be there automatically def

Re: nonlocal fails ?

2019-11-15 Thread Antoon Pardon
On 14/11/19 18:46, R.Wieser wrote: > Jan, > >> So what you want to do is dynamic scope? > No, not really.I was looking for method to let one procedure share a > variable with its caller - or callers, selectable by me. And as a "by > reference" argument does not seem to exist in Python ...

low-level csv

2019-11-17 Thread Antoon Pardon
.reader and csv.writer but that would be some convoluted code. Anyone some suggestions? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a piece of code ('inspect') that displays all/most of the attributes/methods in a frame, traceback, generator object in a readable fashion

2019-11-19 Thread Antoon Pardon
Maybe you should have a look at: http://code.activestate.com/recipes/52215-get-more-information-from-tracebacks/ On 19/11/19 15:08, Veek M wrote: > Basically I want to call a method and pretty print the object contents > for some code I'm playing with. > > Instead of manually writing all this cru

Would like some design feedback.

2019-11-23 Thread Antoon Pardon
I am working on a module that works out this idea of a piline in python http://code.activestate.com/recipes/580625-collection-pipeline-in-python I have a number of design questions I would like some feedback on. 1) In the recipe the '|' is used as the pipe line operator. I like that for its simi

Re: Python3 - How do I import a class from another file

2019-12-10 Thread Antoon Pardon
On 10/12/19 13:44, R.Wieser wrote: > Chris, > >> Well, that's exactly what happens. > So, only the reference count gets lowered. Yep, thats daft. > > ... unless you explain why it can only be done that way. > >> Also, when you scorn something without knowing your facts, >> you tend to make yoursel

Re: Python3 - How do I import a class from another file

2019-12-10 Thread Antoon Pardon
On 10/12/19 16:10, Chris Angelico wrote: > On Wed, Dec 11, 2019 at 1:53 AM Antoon Pardon wrote: >> What would you want to happen in the following case: >> >>foo1 = Bar() >>foo2 = foo1 >>del foo1 >> >> Should the object be cleaned up now

Re: Python3 - How do I import a class from another file

2019-12-10 Thread Antoon Pardon
On 10/12/19 16:56, Chris Angelico wrote: > On Wed, Dec 11, 2019 at 2:36 AM Antoon Pardon wrote: >> On 10/12/19 16:10, Chris Angelico wrote: >>> On Wed, Dec 11, 2019 at 1:53 AM Antoon Pardon wrote: >>>> What would you want to happen in the following case: >>

Re: Python3 - How do I import a class from another file

2019-12-11 Thread Antoon Pardon
t you expect is not within the language specification. If next time you try out an other python implementation, there is no guarantee this will still work as you expect. That you think you can infer general behaviour from your limited experience is a mistake. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3 - How do I import a class from another file

2019-12-13 Thread Antoon Pardon
he goes wrong. Stop arguing and start listening. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: More efficient/elegant branching

2019-12-13 Thread Antoon Pardon
On 9/12/19 12:27, Musbur wrote: > Hello, > > I have a function with a long if/elif chain that sets a couple of > variables according to a bunch of test expressions, similar to > function branch1() below. I never liked that approach much because it > is clumsy and repetetive, and pylint thinks so as

How to get filesystem in python.

2020-01-17 Thread Antoon Pardon
I would like to get the information given by the df command on linux/unix. I found the os.statvfs call, but it misses one thing: The filesystem. Does anyone know how to get that information. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list

Re: queue versus list

2020-03-20 Thread Antoon Pardon
Op 20/03/20 om 02:10 schreef Cameron Simpson: On 20Mar2020 00:37, duncan smith wrote: Thread safety is unimportant (for my purposes), but the docs at https://docs.python.org/2/library/collections.html#collections.deque state "Deques support thread-safe, memory efficient appends and pops from

How to incorporate environment from with python.

2020-03-22 Thread Antoon Pardon
on. I would like to start python from an unprepared bash, and do the necessary stuff to make the import work. I already tried changing os.environ and using os.putenv, but that didn't seem to work. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

super not behaving as I expected

2020-03-29 Thread Antoon Pardon
File "slottest", line 15, in __str__ attrs = self.getslots() File "slottest", line 9, in getslots ls = super().getslots() AttributeError: 'super' object has no attribute 'getslots' -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Better use a class decorator or a metaclass?(was: super not behaving as I expected)

2020-04-04 Thread Antoon Pardon
Op 29/03/20 om 16:49 schreef Peter Otten: > Antoon Pardon wrote: > >> >> I have the following program >> >> class slt: >> __slots__ = () >> ... >> >> class slt1 (slt): >> __slots__ = 'fld1', 'fld2' >>

Is it possible to inheret a metaclass.

2020-04-09 Thread Antoon Pardon
I am experimenting with subclasses that all need the same metaclass as the base class. Is there a way to make the metaclass be inherited, so that you don't have to repeat the "metaclass = MetaClass" with every subclass. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to inheret a metaclass.

2020-04-10 Thread Antoon Pardon
Op 9/04/20 om 18:37 schreef Peter Otten: Antoon Pardon wrote: I am experimenting with subclasses that all need the same metaclass as the base class. Is there a way to make the metaclass be inherited, so that you don't have to repeat the "metaclass = MetaClass" with every subc

Re: Function to avoid a global variable

2020-04-28 Thread Antoon Pardon
cely depth += inc return parseStack parseStack = make_parseStack() -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Multithread and locking issue

2020-05-15 Thread Antoon Pardon
Op 15/05/20 om 00:36 schreef Stephane Tougard: Hello, A multithreaded software written in Python is connected with a Postgres database. To avoid concurrent access issue with the database, it starts a thread who receive all SQL request via queue.put and queue.get (it makes only insert, so no

How to turn a defaultdict into a normal dict.

2020-06-10 Thread Antoon Pardon
present, should raise KeyError. Is that somehow possible? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

How to install your personal module/package on site.

2020-08-14 Thread Antoon Pardon
Well the question is in the subject. I have a number of modules/packages which were until recently personal use only. However python is getting more popular at work and some of my work was considered useful enough to install in a public available spot. How should I approach this? -- Antoon. --

Re: How to install your personal module/package on site.

2020-08-15 Thread Antoon Pardon
Op 15/08/20 om 07:33 schreef dn via Python-list: > On 14/08/2020 22:32, Antoon Pardon wrote: >> Well the question is in the subject. >> >> I have a number of modules/packages which were until recently >> personal use only. However python is getting more popular >>

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-15 Thread Antoon Pardon
e problem. I think writing code that is at heart a state machine would be a lot more easy if python would have TCO. Then each state could be implemented by a function and transitioning from one state to the next would be just calling the next function. Sure you can resolve this by wri

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-15 Thread Antoon Pardon
Op 15/08/20 om 15:02 schreef Chris Angelico: > On Sat, Aug 15, 2020 at 10:45 PM Antoon Pardon > wrote: >> >> >> I don't understand this argument. The trace back information that is >> destroyed with this optimization, is information that isn't availab

Re: How to install your personal module/package on site.

2020-08-21 Thread Antoon Pardon
h pip. Note that the above example pulls a particular tagged release via the "@5.0.3" suffix. That is a nice feature. I will have a closer look at this. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Faking stdlib

2020-10-01 Thread Antoon Pardon
mport chain -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Antoon Pardon
is treated but not appear itself. 2) If it is not special, it should just appear and not change how the ' is treated. What python does here is a combination of both. The \ appears and it changes how the ' is treated. That is IMO broken. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Searching unittest for dictionaries.

2005-09-28 Thread Antoon Pardon
I'm writing a class with a lot of dictionary like behaviour. I was wondering whether a unittest for dictionaries already exists somewhere so that I could use it as a start for a unittest for my class. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching unittest for dictionaries.

2005-09-28 Thread Antoon Pardon
Op 2005-09-28, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> I'm writing a class with a lot of dictionary like behaviour. >> I was wondering whether a unittest for dictionaries already >> exists somewhere so that I could use it as a star

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
r consenting adults. No it is not. Consenting means you had the choice. Python doesn't give you the choice not to consent. Unless of course you write it as a C-extension, then you can hide all you want. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
g goes wrong with the class he has to find out what and that is easier if he can assure that clients didn't mess with certain implementation details. Sure the developer can make a mistake here, just as he can mistakes anywhere in his code. If that happens, you should report a bug. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
erent from changing the implementation. A (documented) interface is like a contract. The implementation is just one way to follow that contract. > People who think that forbidding access to private variables/methods > will save themselves from upgrade woes are deluding themselves. It helps, ju

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
would prefer the opposite such as a interface to mark objects which are not private, but that would break too much code. 2) Allow the client access to these private variables, through a special construct. Maybe instead of "from ... import ..." "from ... spy ...". Just an idea. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
Op 2005-09-30, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2005-09-29, Steve Holden schreef <[EMAIL PROTECTED]>: >> >> >>>Think about it: we have a language that has an eval() function and an >>>exec statement,

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
Op 2005-09-30, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2005-09-29, Bill Mill schreef <[EMAIL PROTECTED]>: >> >>>But, if your users can't figure out that they shouldn't be changing >>>the variable called t._test_

Re: Will python never intend to support private, protected and public?

2005-09-30 Thread Antoon Pardon
ed, the supporting code were disabled in 1996, > and all traces were removed from the sources around 1997-89. > > those who don't know history etc etc What history? If it was only partially implemented and almost immediately deprecated, there can't have been much experience with it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Antoon Pardon
t; Learning and using standard idioms is an essential part of learning a > language; python is no > exception to this. Well I'm a bit getting sick of those references to standard idioms. There are moments those standard idioms don't work, while the gist of the OP's remark still stands like: egold = 0: while egold < 10: if test(): ego1d = egold + 1 -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread Antoon Pardon
Op 2005-09-30, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Fri, 30 Sep 2005 06:52:50 +, Antoon Pardon wrote: > >> Op 2005-09-29, Bill Mill schreef <[EMAIL PROTECTED]>: >>> >>> But, if your users can't figure out that they shouldn'

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread Antoon Pardon
Op 2005-09-30, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2005-09-30, Steve Holden schreef <[EMAIL PROTECTED]>: >> >>>Antoon Pardon wrote: >>> >>>>Op 2005-09-29, Bill Mill schreef <[EMAIL PROTECTED]>

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread Antoon Pardon
Op 2005-09-30, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Fri, 30 Sep 2005 07:37:14 +, Antoon Pardon wrote: > >> Well I have the following reasons not to like the current python way: >> >> 1) Beginning all your private variables with an underscore is

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread Antoon Pardon
Op 2005-09-30, Rocco Moretti schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >>>What if the class author removes a non-private variable or changes a >>>method's documented parameters in the next version of the class, because >>>he thi

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Antoon Pardon
Op 2005-10-03, Duncan Booth schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >> Well I'm a bit getting sick of those references to standard idioms. >> There are moments those standard idioms don't work, while the >> gist of the OP's remark stil

Problem with slices.

2005-10-03 Thread Antoon Pardon
etween the two. I don't think it very likely but I could have a table with indexes from 2147483647 to 2147483700, so having 2147483647 as value that indicated till the end of the sequence is a bit awkward. The same problems occur when I have a tree with integer key values. But even if I don

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-03 Thread Antoon Pardon
else Y >> >> which is the same as today's >> >> (Y, X)[bool(C)] > > What's wrong with "C ? X:Y"? > > Aside from ":" being overloaded? Nothing, but afaiu Guido dislikes it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread Antoon Pardon
Op 2005-10-03, Duncan Booth schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >> A language where variable have to be declared before use, would allow >> to give all misspelled (undeclared) variables in on go, instead of >> just crashing each time one is encount

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Antoon Pardon
Op 2005-10-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Mon, 03 Oct 2005 13:58:33 +, Antoon Pardon wrote: > >> Op 2005-10-03, Duncan Booth schreef <[EMAIL PROTECTED]>: >>> Antoon Pardon wrote: >>> >>>> A language where variab

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Antoon Pardon
Op 2005-10-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Mon, 03 Oct 2005 06:59:04 +, Antoon Pardon wrote: > >> Well I'm a bit getting sick of those references to standard idioms. >> There are moments those standard idioms don't work, while the

Re: Will python never intend to support private, protected and public?

2005-10-04 Thread Antoon Pardon
Op 2005-10-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Mon, 03 Oct 2005 09:14:34 +, Antoon Pardon wrote: > >> If you are in a project with >> multiple authors, your usage of private variables can break code >> that other people rely on. > &

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Antoon Pardon
back or you just code without initialisation, intending to go back an do it later. > Or you just code without declaring, intending to go > back and do it later, and invariably forget. What's the problem, the compilor will allert you to your forgetfullness and you can then correct them all at once. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Antoon Pardon
Op 2005-10-04, Steve Holden schreef <[EMAIL PROTECTED]>: > Paul Rubin wrote: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >> >>>>Or you just code without declaring, intending to go >>>>back and do it later, and invariably forget. >>> &g

<    1   2   3   4   5   6   7   8   9   10   >