RE: [Python-ideas] Proposal: Query language extension to Python (PythonQL)

2017-03-26 Thread Gerald Britton
(Forgot the subject) > >* On 25 Mar 2017, at 15:51, Gerald Britton ><https://mail.python.org/mailman/listinfo/python-ideas>> wrote: > *> >* On 25 March 2017 at 11:24, Pavel Velikhov <http://gmail.com> <http://gmail.com/ <http://gmail.com/>>> wrot

What are your opinions on .NET Core vs Python?

2017-01-30 Thread Gerald Britton
plemented in .NET, has no GIL and doesn't need it since ir runs on the CLR. That means that, for some things, IronPython can be more performant. No word yet if the IronPython project intends to port to .NET core or enable to run it on OS's other than Windows. Also, it's worth noting that the P

Fwd: What are your opinions on .NET Core vs Python?

2017-01-29 Thread Gerald Britton
> > As you guys might know, .NET Core is up and running, promising a > "cross-platform, unified, fast, lightweight, modern and open source > experience" (source: .NET Core official site). What do you guys think about > it? Do you think it will be able to compete with and overcome Python in the >

[issue29257] Possible error in discussion of Abstract Base Classes and abstract properties

2017-01-12 Thread Gerald Britton
New submission from Gerald Britton: I was rereading the 2.7 docs about abstract base classes the other day. I found this: "This defines a read-only property; you can also define a read-write abstract property using the ‘long’ form of property declaration:" along with an exam

Re: Question about abstract base classes and abstract properties -- Python 2.7

2017-01-10 Thread Gerald Britton
I was rereading the 2.7 docs about abstract base classes the other day. I found this line in the usage section of the abc.abstractproperty function: "This defines a read-only property; you can also define a read-write abstract property using the ‘long’ form of property declaration:" along with

Question about abstract base classes and abstract properties -- Python 2.7

2016-10-22 Thread Gerald Britton
n (otherwise, what's the point of the example?) Is this a doc bug, an ABC bug or just me? (I've been known to be buggy from time to time!) -- Gerald Britton -- https://mail.python.org/mailman/listinfo/python-list

RE: How to reduce the DRY violation in this code

2016-09-27 Thread Gerald Britton
eepy=60, sneezy=70): > # the usual assign arguments to attributes dance... > self.bashful = bashful > self.doc = doc > # etc. This looks like a situation where the GoF Builder pattern might help -- Gerald Britton, MCSE-DP, MVP LinkedIn Profile: http://ca.linkedin.com/in/geraldbritt

RE: Any ReST aware editors?

2016-09-22 Thread Gerald Britton
at least, updated every thirty seconds or so.) Anybody know > anything like that? Visual Studio Code does an OK job with the reStructuredText Language Support for Visual Studio Code Extension -- Gerald Britton, MCSE-DP, MVP LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton -- https://ma

Question about abstract base classes and abstract properties -- Python 2.7

2016-09-04 Thread Gerald Britton
gy from time to time!) -- Gerald Britton, MCSE-DP, MVP LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton -- https://mail.python.org/mailman/listinfo/python-list

Re: Learning Descriptors

2016-07-31 Thread Gerald Britton
>On Sun, Jul 31, 2016 at 6:33 AM, Gerald Britton > wrote: >> Today, I was reading RH's Descriptor HowTo Guide at >> >> https://docs.python.org/3/howto/descriptor.html?highlight=descriptors >> >> I just really want to fully "get" this. >> >>

Learning Descriptors

2016-07-31 Thread Gerald Britton
Today, I was reading RH's Descriptor HowTo Guide at https://docs.python.org/3/howto/descriptor.html?highlight=descriptors I just really want to fully "get" this. So I put together a little test from scratch. Looks like this: class The: class Answer: def __get__(self, obj,

re: Operator Precedence/Boolean Logic

2016-07-16 Thread Gerald Britton
/mail.python.org/pipermail/python-list/2016-July/thread.html#711777> [ subject ] <https://mail.python.org/pipermail/python-list/2016-July/subject.html#711777> [ author ] <https://mail.python.org/pipermail/python-list/2016-July/author.html#711777> ------

Package setup best practice style question

2016-05-28 Thread Gerald Britton
that would indicate to prefer method 1 or method 2? Are there methods 3, 4, 5, ... that I should consider that are even better? -- Gerald Britton, MCSE-DP, MVP LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton -- https://mail.python.org/mailman/listinfo/python-list

Question about imports and packages

2016-05-24 Thread Gerald Britton
On Wed, 25 May 2016 10:00 am, Steven D'Aprano wrote: >On Wed, 25 May 2016 09:35 am, Gerald Britton wrote: > >For brevity, here's your package setup: > > >testpkg/ >+-- __init__.py >+-- testimport.py which runs "from testpkg.testimported import A" >+-- testi

Question about imports and packages

2016-05-24 Thread Gerald Britton
ile "testimport.py", line 1, in from testpkg.testimported import A ImportError: No module named testpkg.testimported However, I thought I was doing what the doc describes for intra package imports. What am I missing? Or is the problem simply that I do not have subpackages? -- Gerald Brit

RE: Please critique my script

2011-07-14 Thread Gerald Britton
' + destpatt + '\n' + port + p + '\n' forward-digits 7 if line[0:3] == y and q == y else '\n' ) Which keeps the eye focused on the data being written (at least for me). -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespaces in functions vs classes

2011-04-19 Thread Gerald Britton
understand the Python does not consider a class definition as a separate namespace as it does for function definitions. That is a helpful understanding. Anyway, thanks for jumping in to the discussion. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespaces in functions vs classes

2011-04-19 Thread Gerald Britton
Gerald Britton wrote: I now understand the Python does not consider a class definition as a separate namespace as it does for function definitions. That is a helpful understanding. That is not correct. Classes are separate namespaces -- they just aren't automatically searched. The only

Namespaces in functions vs classes

2011-04-17 Thread Gerald Britton
as an unqualified variable inside the method in the class. If Python allowed such a thing, what problems would that cause? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

value of pi and 22/7

2011-03-20 Thread Gerald Britton
horsepower and the size of sys.maxint on your machine, this may take a few *days* to run. Note: The sum in the Python expression above runs in reverse to minimize rounding errors. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Compile time evaluation of dictionaries

2011-03-14 Thread Gerald Britton
C code to speed up things: http://docs.python.org/extending/extending.html, when really needed. How do you spell red herring? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Compile time evaluation of dictionaries

2011-03-10 Thread Gerald Britton
, an optimization was done for sets (See Optimizations at http://docs.python.org/py3k/whatsnew/3.2.html) though I do not see anything similar for dictionaries. -- Gerald Britton -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Python 3.2 and html.escape function

2011-02-20 Thread Gerald Britton
I see that Python 3.2 includes a new module -- html -- with a single function -- escape. I would like to know how this function differs from xml.sax.saxutils.escape and, if there is no difference (or only a minor one), what the need is for this new module and its lone function -- Gerald Britton

Python 3.2 and html.escape function

2011-02-20 Thread Gerald Britton
' -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

lint warnings

2011-02-15 Thread Gerald Britton
the latter neater for the same reasons as above -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

lint warnings

2011-02-15 Thread Gerald Britton
is exactly the point. f you have an expression that can be inlined you save the function call overhead with the list comprehension. Of course, but that's not the point. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Map vs. List Comprehensions (was lint warnings)

2011-02-15 Thread Gerald Britton
, a').timeit() 2.4131419658660889 So, what's the feeling out there? Go with map and the operators or stick with the list comps? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

How can I print a traceback without raising an exception?

2011-02-13 Thread Gerald Britton
File stdin, line 2, in f File stdin, line 2, in g File stdin, line 2, in h Exception -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

How can I tell if I am inside a context manager?

2011-02-01 Thread Gerald Britton
not in a context manager on f: with h as f(): # insert code here to return True, since I am in a context manager on f: -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

How can I tell if I am inside a context manager?

2011-02-01 Thread Gerald Britton
On Dienstag 01 Februar 2011, Gerald Britton wrote: I'd like to know how (perhaps with the inspect module) I can tell if I am running in a context manager. class f(object): def __init__(self): self.inContext = False def __enter__(self): self.inContext = True return

Re: How can I tell if I am inside a context manager?

2011-02-01 Thread Gerald Britton
with f() as x: hasattr(x,'__enter__') True As you can see, the object has a '__enter__' method regardless of how it was created. Whatever the test, it needs to return False in the first case and True in the second case, without modifying the class definition. Gerald Britton

Style question: Nicknames for deeply nested objects

2011-01-30 Thread Gerald Britton
you don't really need in this case. I have a couple of questions: 1. If you had to choose between approaches 1 and 2, which one would you go for, and why? 2. What other techniques have you used in such a situation? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Slice lists and extended slicing

2011-01-26 Thread Gerald Britton
TypeError: list indices must be integers, not tuple but that clearly doesn't work! So, when and how can one use slice lists? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

PEP8, line continuations and string formatting operations

2011-01-21 Thread Gerald Britton
? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

RE: Code review request

2010-12-22 Thread Gerald Britton
thing without the escapes: sqlchk = 'select * from employees where id = %s' % (arg) Anyway -- just some food for thought. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

RE: PEP8 compliance and exception messages ?

2010-12-08 Thread Gerald Britton
indent the individual lines any way you like. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Style question for conditional execution

2010-11-24 Thread Gerald Britton
approach and, if so, what was your motivation? Is there a good/bad reason to choose one over the other? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: if {negative} vs. if {positive} style

2010-02-10 Thread Gerald Britton
): continue # process x -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking the coding style

2010-02-07 Thread Gerald Britton
Quijano Estudiante de Ingeniería Informática (UCA) Alumno colaborador del Departamento de Lenguajes y Sistemas Informáticos Participante del IV Concurso Universitario de Software Libre -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org

Re: Exception class documentation

2010-02-06 Thread Gerald Britton
If you browse the Python source tree, you should be able to find it. http://svn.python.org/view/python/trunk/Objects/exceptions.c?revision=77045view=markup On Fri, Feb 5, 2010 at 7:27 PM, Charles Yeomans char...@declaresub.com wrote: On Feb 5, 2010, at 2:13 PM, Gerald Britton wrote: On Fri

Re: which

2010-02-05 Thread Gerald Britton
. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: list.extend([]) Question

2010-02-05 Thread Gerald Britton
/#why-doesn-t-list-sort-return-the-sorted-list -- Aahz (a...@pythoncraft.com)           *         http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: which

2010-02-05 Thread Gerald Britton
(for me) to read. But there was considerable resistance to spending so much vertical space in the source code. Weird! It's three lines and the original was four lines was it not? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Editor for Python

2010-02-05 Thread Gerald Britton
. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception class documentation

2010-02-05 Thread Gerald Britton
,),) -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: method names nounVerb or verbNoun

2010-02-05 Thread Gerald Britton
, with words separated by underscores as necessary to improve readability. mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Last M digits of expression A^N

2010-02-05 Thread Gerald Britton
://mail.python.org/mailman/listinfo/python-list http://docs.python.org/3.1/library/decimal.html#decimal.Context.power -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble with os.system

2010-02-03 Thread Gerald Britton
with files such as : foo.txt, bar.txt. Any idea ? Thanks, Cpa -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble with os.system

2010-02-03 Thread Gerald Britton
= sys.argv[1:] os.system('mkdir tmp') # Some code to create the .tex # Compile tex files os.system('for file in tmp/*; do pdflatex $file; done') Pretty simple, alas. -- Cpa On 3 fév, 18:54, Gerald Britton gerald.brit...@gmail.com wrote: Can you post your code? On Wed, Feb 3, 2010

Re: exec within function

2010-02-03 Thread Gerald Britton
.) -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over a function call

2010-02-02 Thread Gerald Britton
will show up sooner. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: lists as an efficient implementation of large two-dimensional arrays(!)

2010-02-02 Thread Gerald Britton
. In particular, if the array was sparse, rather than completely full, the two-level dictionary implementation would be the natural representation. -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Iterating over a function call

2010-02-01 Thread Gerald Britton
in 2.x (calls the function with each value returned by the iterator) but return nothing. Maybe apply isn't the best name; it's just the first one that occurred to me. Or is this just silly and should I forget about it? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over a function call

2010-02-01 Thread Gerald Britton
you want to eat up the rest of the iterable. It also solves the iterator-variable leakage problem and is only a wee bit slower than a conventional for-loop. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Gerald Britton
-- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
curious and I'd like to know: 1. Can anyone else confirm this observation? 2. Why should the pure list comprehension be slower than the same comprehension enclosed in '[...]' ? -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
Thanks! Good explanation. On Tue, Jan 19, 2010 at 10:57 AM, Alf P. Steinbach al...@start.no wrote: * Gerald Britton: Yesterday I stumbled across some old code in a project I was working on.  It does something like this: mystring = '\n'.join( [ line for line in lines if some conditions

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
in the generator expression. That in itself probably accounts for the differences since function calls are somewhat expensive IIRC. On Tue, Jan 19, 2010 at 11:18 AM, Stephen Hansen apt.shan...@gmail.com wrote: On Tue, Jan 19, 2010 at 7:30 AM, Gerald Britton gerald.brit...@gmail.com wrote: [snip

Re: Create list/dict from string

2010-01-19 Thread Gerald Britton
},               {action_name: action_2, val: asdf, val2: asdf},               {action_name: action_1, val: asdf, val2: asdf}] And have this create a list/dict.  I'm aware of pickle, but it won't work as far as I can tell. Thanks. -- http://mail.python.org/mailman/listinfo/python-list -- Gerald

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
it, I would suppose that join could use a dynamic-table approach to hold the result, starting with some guesstimate then expanding the result buffer if and when needed. -- http://mail.python.org/mailman/listinfo/python-list -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
, Arnaud Delobelle arno...@googlemail.com wrote: Gerald Britton gerald.brit...@gmail.com writes: [snip] Yes, list building from a generator expression *is* expensive. And join has to do it, because it has to iterate twice over the iterable passed in: once for calculating the memory needed

[issue5909] Segfault in typeobject.c

2009-05-03 Thread Gerald Britton
Gerald Britton gerald.brit...@gmail.com added the comment: This bug reports corresponds to one opened on Gnome: http://bugzilla.gnome.org/show_bug.cgi?id=578419 According to the devs there: As far as I can tell this is a Python/C bug. PyGObject is doing everything by the book

[issue5909] Segfault in typeobject.c

2009-05-02 Thread Gerald Britton
New submission from Gerald Britton gerald.brit...@gmail.com: Python 2.6 segfaults when starting up the gramps application -- assignee: theller components: ctypes files: gdb-python.txt messages: 86981 nosy: gbritton, theller severity: normal status: open title: Segfault in typeobject.c

var is None vs. var == None

2009-01-23 Thread Gerald Britton
Hi -- Some time ago I ran across a comment recommending using var is None instead of var == None (also var is not None, etc.) My own testing indicates that the former beats the latter by about 30% on average. Not a log for a single instruction but it can add up in large projects. I'm looking

Re: Lazy List Generator Problem

2009-01-16 Thread Gerald Britton
For those interested in the Sieve of Eratosthenes, have a look at: http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf The examples in the paper are in Haskell, but I have been corresponding with the author who provided this Python version: def sieve(): innersieve = sieve() prevsquare =