Yes, nesting functions is valuable & necessary for closures and wrapping
functions for creating properties. But is nesting, simply for hiding data,
a preferred solution? I have a number of member functions which are
prefaced with underscores pointing out that they should not be called by
client c
Yes, nesting functions is valuable & necessary for closures and wrapping
functions for creating properties. But is nesting, simply for hiding data,
a preferred solution? I have a number of member functions which are
prefaced with underscores pointing out that they should not
_
I am lacking in understanding of the @staticmethod property.
Explanation(s)/links might be helpful. I have not found the descriptions
found in the Internet wild to be particularly instructive. Given the code
below:
=8<--
from collections import namedtuple
class Foo():
Dim
This should be a slow ball pitch. Unfortunately, I haven't stumbled across
a reasonable answer yet.
On occasion, I put long URL's into comments/docstrings simply to document
where I found specific information. However, to be a good disciple of
PEP8, anything which can't fit within 72 characters
I ask this having more C++ knowledge than sense.
There is an adage in the halls of everything Stroustrup that one needs to
think about how resource allocation will be unwound if an exception is
thrown. This gets watered down to the mantra "Don't throw exceptions from
within constructors." Does t
help(module_name) will place any text in the *first* module-level docstring
into the description section of the help page in Python 3.4.5. Subsequent
docstrings found at module level are ignored.
I have been using this factoid for placement of a copyright & licensing
notice. By placing a rather
It is preferable to sprinkle tests files throughout the directories of a
project, or coalesce all tests in a test directory?
Thanks!
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/li
I can successfully override __getitem__() for rvalues, but the following
example shows that more is required when used as an lvalue:
===8<-
#!/usr/bin/env python
class Foo():
def __init__(self, n):
self.d = dict.fromkeys([i for i in range(0, n)])
def __getitem__(self, i):
I have implemented the equivalent of "insert if unique" in Python &
SQLAlchemy to help with data normalization. However to help minimize the
number of preliminary SELECT statements needed, it helps to check types
through calls to isinstance() before getting to the salient code.
Unfortunately, the
The Python 3 tutorial discusses relative imports at:
https://docs.python.org/3/tutorial/modules.html#intra-package-references
I have the following directory structure for a package in development:
+ outer_package/
+ __init__.py
+ inner_package
| + __init__.py
| + mycl
In my current project, I am developing a package. It makes sense to embed
tests throughout the package's directory structure as they should be part
of the package & its distribution. It may raise eyebrows that I have tests
sprinkled through various directories, but there are reasons for keeping
s
On Wed, Sep 14, 2011 at 1:13 PM, Walter Prins wrote:
> On 14 September 2011 21:03, James Hartley wrote:
>
>> On Wed, Sep 14, 2011 at 12:54 PM, Walter Prins wrote:
>>
> Aside: If you want to interact with a mail server there's probably better
>> modules to
On Wed, Sep 14, 2011 at 12:54 PM, Walter Prins wrote:
> Hence, try using read_some() instead of read_very_eager().
>
read_some() captures what I was hoping to catch. Thanks!
>
> Aside: If you want to interact with a mail server there's probably better
> modules to be using than the telnet mod
I'm trying to programmatically create a telnet session. Within the
interactive environment, this appears to work very well as server messages
can be saved as strings:
$ python
Python 2.7.1 (r271:86832, Sep 3 2011, 01:32:33)
[GCC 4.2.1 20070719 ] on openbsd5
Type "help", "copyright", "credits" or
This is more a design question.
One lesson C++ programmers might learn is that throwing exceptions from
within library code is fraught with problems because the internals of
exception handling were spelled out in the C++ standard. This manifests
itself as problems when the library was compiled wi
Thanks, Peter for taking the time to respond. I need to study the reference
further, & your comments pointed out some of my misconceptions. Thank you
for clearing up some of my half-researched understanding.
Jim
On Thu, Sep 1, 2011 at 10:53 PM, Peter Otten <__pete...@web.de> wrote
I'm just needing to verify some behavior.
Functionality within the logging module is exercised by calling functions
defined within the module itself. I am using SQLAlchemy for database
access, but it can be configured to dump out intermediate access information
& queries to the logging module --
On Thu, Sep 30, 2010 at 7:27 AM, R. Alan Monroe wrote:
>
> >> I'm needing to transfer the following shell construct to Python,
> >> plus save
> >> the output of execution:
>
> >> FTP_SITE='ftp.somesite.com'
> >> ftp -a $FTP_SITE < >> binary
> >> prompt off
> >> cd /some_dir
> >> dir
> >> bye
> >>
I'm needing to transfer the following shell construct to Python, plus save
the output of execution:
FTP_SITE='ftp.somesite.com'
ftp -a $FTP_SITE <___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.o
I suspect this is a brain-dead question...
Given the following code, output is as expected:
$ cat test.py
d = { 'a' : 1, 'd' : 2, 'b' : 3, 'c' : 0 }
for i in d.keys():
print "%s\t%s" % (i, d[i])
$ python test.py
a 1
c 0
b 3
d 2
$
But if the keys are sorted, I get an
A Perl script can easily serve as a filter within a pipe as seen in
the following:
use strict;
use warnings;
open(IN, 'cat hello.txt |') or die 'unable to open file';
while () {
print;
}
close(IN);
Can I do the same within Python? Thanks.
Jim
___
On 7/23/07, Shidan <[EMAIL PROTECTED]> wrote:
> I'm looking for a Python module that provides methods for ordering
> regexes based on
> how general they are ( how much they match). Do I have to write it
Your question is relative. Classifying which regular expression is
more general depends upon t
22 matches
Mail list logo