that?
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 15, 1:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
Carl Banks pavlovevide...@gmail.com wrote:
I don't see what the big deal is. Right now isinstance accepts a type
or a tuple of types. The code could be changed to allow a type, or
any iterable the returns types (wherein
On Jan 14, 1:40 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 13 Jan 2009 20:17:08 -0800, Carl Banks wrote:
On Jan 13, 9:50 pm, Carl Banks pavlovevide...@gmail.com wrote:
The cultural impact that would have on the community is far worse,
IMHO, than any short
On Jan 14, 2:44 am, Russ P. russ.paie...@gmail.com wrote:
On Jan 13, 11:51 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
At GE there was no encapsulation in sight on any system I worked on.
In fact, our engine simulation was a special
than GPL software.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
to a wishlist request, though.
As a workaround, you can just cast the set to a tuple like this:
isinstance(x,tuple(s))
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
in an appropriate
decorator, superclass, or whatever.
Well, I guess you are the sacrifical lamb so that everyone else can
take advantage of the dynamicism.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 13, 6:45 pm, Russ P. russ.paie...@gmail.com wrote:
On Jan 13, 3:07 pm, Carl Banks pavlovevide...@gmail.com wrote:
I've seen no evidence that any Python project is moving even remotely
toward data encapsulation. That would be a drastic change. Even if
it were only a minor change
On Jan 13, 9:50 pm, Carl Banks pavlovevide...@gmail.com wrote:
The cultural impact that would have on the
community is far worse, IMHO, than any short-sighted benefits like
being able to catch an accidental usage of an internal variable.
Trust would be replaced by mistrust, and programming
system I worked on.
In fact, our engine simulation was a special-purpose object-oriented
language with--get this--no private variables. Some other systems I
worked on didn't even use scoping, let alone encapsulation.
Looks like my anecdote cancels out yours! Got any more?
Carl Banks
--
http
On Jan 12, 12:32 am, John Machin sjmac...@lexicon.net wrote:
On Jan 12, 12:23 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Jan 9, 6:11 pm, John Machin sjmac...@lexicon.net wrote:
On Jan 10, 6:58 am, Carl Banks pavlovevide...@gmail.com wrote:
On Jan 9, 12:36 pm, J. Cliff Dyer j
On Jan 12, 5:26 am, John Machin sjmac...@lexicon.net wrote:
On Jan 12, 7:29 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Jan 12, 12:32 am, John Machin sjmac...@lexicon.net wrote:
On Jan 12, 12:23 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Jan 9, 6:11 pm, John Machin
at 0x00FD86B0
This is messed him up?
If you believe in waiting for bugs to occur and then fixing them,
rather than programming to avoid bugs, there is no helping you.
P.S. The obvious solution is wrong, although I'm not sure if you
were making some kind of ironic point.
Carl Banks
--
http
that the variable isn't in use until it is initialized, and
Explicit is better than implicit.)
In the end, the answer to you question is simply, Readibilty counts,
but other stuff matters too.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
there is something to be said for
variables that exist when they are needed and don't when they're not.
However, I acknowledge that listing all the variables you intend to
use in __init__ is highly comforting, even if it does belie their
current uselessness.
Carl Banks
--
http://mail.python.org/mailman/listinfo
On Jan 11, 5:02 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
and where it was manipulated for that matter.
This criticism is completely unfair. Instance variables have to be
manipulated somewhere, and unless your object is immutable
On Jan 11, 5:49 pm, Chris Rebert c...@rebertia.com wrote:
On Sun, Jan 11, 2009 at 3:15 PM, Carl Banks pavlovevide...@gmail.com wrote:
On Jan 11, 3:31 pm, Chris Rebert c...@rebertia.com wrote:
On Sun, Jan 11, 2009 at 1:22 PM, Madhusudan.C.S madhusuda...@gmail.com
wrote:
def somemethod
On Jan 11, 5:41 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
The criticism is very valid. Some languages do support immutable
variables (e.g. final declarations in Java, const in C++, or
universal immutability in pure functional
On Jan 11, 6:42 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
If so, what is it that's so evil about conditionally-existent
variables? (I'll leave the question open-ended this time.)
I have found they make the code more confusing and bug
On Jan 9, 6:11 pm, John Machin sjmac...@lexicon.net wrote:
On Jan 10, 6:58 am, Carl Banks pavlovevide...@gmail.com wrote:
On Jan 9, 12:36 pm, J. Cliff Dyer j...@sdf.lonestar.org wrote:
On Fri, 2009-01-09 at 13:13 -0500, Steve Holden wrote:
Aivar Annamaa wrote:
As was recently
module can handle it. It might
help you out.
http://groups.google.com/group/comp.lang.python/msg/c2008e48368c6543
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
, and really have no shame when it comes
to engaging in questionable practices like relying on accidental side
effects, rather than taking the time to try to program robustly. I
expect people with that style of programming will have many more
issues with the transition.
Carl Banks
--
http
*)(op))
So, if the reference count goes down to zero, Py_DECREF calls
_Py_Dealloc to delete the object. _Py_Dealloc is the common point you
want.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
it should instead fail loudly.
It's always a judgment call how much to screen for bad input, but type
errors aren't different from any other error in this regard.
Sometimes it's appropriate (note: not, IMHO, in this case), just like
it's sometimes appropriate to check for 442.
Carl Banks
--
http
: the PyImport_Import and PyImport_ImportModule functions now
default to absolute imports, not relative imports. This will affect C
extensions that import other modules.
Presumably __import__ also defaults to absolute (since PyImport_Import
calls it) so the two modules should both use absolute imports in 2.6.
Carl
always be the same object, and that's just a
waste.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
, and, instead of loading it as a Python file, invokes your DSL
parser.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
know what function to call or class to use at compile-time,
you can just pass the objects around. No strings required.
So what I'm saying is: the Python developers didn't bother to make an
high-level, easy-to-use __import__ because there really isn't much
demand for it.
Carl Banks
--
http
functions in the same namespace
because I am following the example of other language bindings in Perl,
Java, Ruby, etc.,, then figure out whether it's important to be
consistent with Perl, Java, Ruby, etc., and if so, do whatever they
did. If not, see #1.
Carl Banks
--
http://mail.python.org
module in
EN - just to make sure that the A1Factory updation code is hit. This
looks in-elegent.
Not worth it. The straightforward, good-enough way above is good
enough.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
En Mon, 29 Dec 2008 19:47:51 -0200, Carl Banks pavlovevide...@gmail.com
escribi�:
On Dec 29, 10:51�am, Kottiyath n.kottiy...@gmail.com wrote:
Module Factory:
A1Factory: {'B1Tag':1.1.B1, 'C1Tag':1.2.C1, 'D1Tag':1.3.D1'}
A2Factory: {'B2Tag':2.1.B2, 'C2Tag':2.2.C2
for.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
the input.
To be honest I am a little concerned over the more-or-less knee-jerk
suggestions to refactor this into a highly object-oriented approach.
For the task at hand the OP's approach is fine (aside from the use of
exec).
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
in s use Identity(d) in s.
And so on.
To do it a bit better, you could create an IdentitySet class that
subclasses set and wraps the methods so that they automatically apply
wrap and unwrap the arguments on their way in and out (I'd bet there's
already a cookbook recipe to do that).
Carl Banks
and slicing, most notably numpy.
So, for instance, if you were install numpy, you could get
multidimensional arrays and slice 'em up however you'd like:
import numpy
a = numpy.array([[1,2,3],[4,5,6],[7,8,9]])
print a[1:3,0:2]
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
credibility, but now
there is no doubt that he none at all, so he's not worth replying to,
so I don't. I suggest everyone else does likewise and ignores the
fool.
If you have to followup, at least keep your reply to something short
and witty, like, Go away, troll.
Carl Banks
--
http
-encoding
is given, for urllib to have an option to automatically decode and
return a string instead of bytes. (For all I know, it already can do
that.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
kinds of new things,
a new string formating method would be a minor one. As for everyone
else, they'll probably have an easier time of it.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
hacked-
up fork of a highly wrought out programming language?
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
no reason they couldn't have
added another method for printf-style formating, e.g.:
The answer is %s..sprintf(yes)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
function for dicts.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
it, if the rule had been, Use an apostrophe for any
word that forms it's possessive by adding an s or z sound, it would
have been less inconsistent. Sadly, that's not the rule. English
spelling is the Perl of orthography.
Carl Banks
(...For that matter, if the rule had been, Never augment your
On Dec 14, 5:52 am, Karlo Lozovina _kar...@_mosor.net_ wrote:
Carl Banks pavlovevide...@gmail.com wrote
innews:69d2698a-6f44-4d85-adc3-1180ab158...@r15g2000prd.googlegroups.com:
Unless you are referring to some wget screen mode I don't know about,
I suspect wget outputs its progress bar
is sent.
Therefore we have to call sys.stdout.flush() to flush the buffer
manually.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
return False
# note: in Python 3.0 you would want to throw exceptions
# for unexpected types
Then use ValidDate instead of datetime.date when the date is
specified.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
or
__new__ or snooping to datetime.date's class dict anything like that.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
the short answer is you can't.
The way you have done it is best--its not a hack and is good style.
Yes, it's straightforward and readable, a perfectly good workaround
for a very minor style issue.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 10, 12:42 pm, cm_gui [EMAIL PROTECTED] wrote:
Python is SLOW. And I am not comparing it with compiled languages
like C.
Python is even slower than PHP!
cm_gui is TROLL. And I am not compring it with bots like Aaron
Castironpi Brody. cm_gui is even troller than Xah Lee!
Carl
as
an identifier, even when allowed.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
(class_reference) is the only obvious concise answer.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
these start to
be widely available for 3.x, people will sometimes have to make do
with the 2.x stuff.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
: bar
I had been -0 on this, but now I think I'm -1.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
. $, used as proposed, would be.
(Then again, _ is an identifier.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
would lose your bet if
it were me.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
but I think that's what it ought to be, in general.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 6, 4:39 pm, Russ P. [EMAIL PROTECTED] wrote:
On Dec 6, 1:21 pm, Carl Banks [EMAIL PROTECTED] wrote:
On Dec 6, 9:12 am, Russ P. [EMAIL PROTECTED] wrote:
On Dec 6, 1:02 am, Antoine De Groote [EMAIL PROTECTED] wrote:
Allowing $ as a substitute for self wouldn't require this new
of the original data.
That's exactly what these methods would be doing, changing the type
while preserving the semantic value as much as possble, so cast is a
perfectly appropriate name for it.
(BTW, in C++, even pointer-to-pointer static casts don't always
preserve the bits.)
Carl Banks
--
http
On Dec 6, 6:42 pm, Russ P. [EMAIL PROTECTED] wrote:
But it's ugly. No amount of rationalization will make it not ugly.
The dollar sign is ugly? I beg to differ.
Nope, you're wrong.
Carl Banks
(See where this is going?)
--
http://mail.python.org/mailman/listinfo/python-list
minutes a year
to visit Python.org to see what changes are planned for upcoming
releases, then feel free to use a language like Java that has the
corporate backing to keep bad decisions around for decades.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
of) a history of backward-
incompatible changes with every major release.
It's not like Python has ignored the users; it's been very careful and
considerate when making backwards-incompatible change. This change
was planned for eight freaking years.
Carl Banks
--
http://mail.python.org/mailman
minority, I would guess.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 3, 7:51 pm, Barry Warsaw [EMAIL PROTECTED] wrote:
On behalf of the Python development team and the Python community, I
am happy to announce the release of Python 3.0 final.
Congratulations! This is a great day for the Python community.
Carl Banks
--
http://mail.python.org/mailman
] += 1
return start[0]
return counter
You can access variables from an enclosing scope starting from Python
2.2 (from 2.1 with from __future__ import nested_scopes), but you
could not rebind those variables until Python 3.0 came out today.
Carl Banks
--
http://mail.python.org/mailman
.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
a
profiler to get an idea of how much it costs, so you can make an
informed decision.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
statement had lots of peculiarities), whereas all function calls
follow the same syntax.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
newbie. There's a
few organizational decisions I'd make differently, but overall it's
clean and readable and not too complicated how you did it. At least
not what you've showed us. :)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
with the directory
included. If you do use os.chdir(), then early in your script script,
add a line such as sys.path[0] = os.getcwd(). Then, no matter where
you are, always import the file relative to the starting directory.
So always use from test.data import DATA, even after you os.chdir().
Carl Banks
On Nov 28, 3:15 am, Ben Finney [EMAIL PROTECTED]
wrote:
Carl Banks [EMAIL PROTECTED] writes:
I like to think that import abc always does the same thing
regardless of any seemingly unrelated state changes of my program,
especially since, as the OP pointed out, import is used as a means
On Nov 28, 3:24 am, Viktor Kerkez [EMAIL PROTECTED] wrote:
On Nov 28, 9:35 am, Carl Banks [EMAIL PROTECTED] wrote:
However, I'm not so sure the effect of os.chdir() on the import path
is a good idea.
I'm not actually using os.chidir(), I just used it here to create a
clearer example
On Nov 28, 2:59 pm, Ben Finney [EMAIL PROTECTED]
wrote:
Carl Banks [EMAIL PROTECTED] writes:
On Nov 28, 3:15 am, Ben Finney [EMAIL PROTECTED]
wrote:
This is resolved in the Python 2.x series by implementing PEP 328
URL:http://www.python.org/dev/peps/pep-0328/, such that the
search
On Nov 28, 11:51 pm, Carl Banks
Absolute versus relative imports don't have anything to do with the
issue here. PEP 328 concerns itself with imports relative to the
executing module in package space. It has nothing to do with imports
relative to the current directory in filename space.
I
:
value = self.false_surrogate
super(special_dict,self).__getitem__(value)
## etc.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
= 'binarytree')
-1
This doesn't buy you anything over simply implementing different types
altogether.
a = collections.linkedlist([1,2,3,4,5])
b = collections.btree({'a': 'A'})
In fact, it adds a whole lot of complexity to the built-in types.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python
it.
I'm guessing no.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
. :) But please
leave seek() out it.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
+= 1
c.notify()
c.release()
The reason threading.Condition is required and not a simple lock is
that simply acquiring the lock is not enough; the counter must be in
the right state as well.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
switch could take place. Obviously the
wisdom of what he was doing was suspect, but the OP was right in that
a manual GIL release would allow a thread switch and could have helped
avoid starvation in that case.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
, so a long time ago)
in single-threaded, real-time simulations.
Don't know mcuh about the sched module, but time scheduling in general
doesn't need multithreading, not one bit.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 21, 7:49 am, MRAB [EMAIL PROTECTED] wrote:
On Oct 21, 10:22 am, Carl Banks [EMAIL PROTECTED] wrote:
On Oct 21, 5:09 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Tue, 21 Oct 2008 04:58:00 -0200, Piotr Sobolewski
[EMAIL PROTECTED] escribió:
But what about my main
On Oct 17, 4:25 am, Damien Wyart [EMAIL PROTECTED] wrote:
* Carl Banks [EMAIL PROTECTED] in comp.lang.python:
The python-mode.el on Subversion (python-mode's Subversion on source
forge, not the ancient version of python-mode in the Python
repository) has a fix for this issue. It doesn't
, not the ancient version of python-mode in the Python
repository) has a fix for this issue. It doesn't look like there's
any way to browse the subversion any more, though.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 16, 12:21 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Carl Banks a écrit :
On Oct 14, 1:05 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
- a slightly less but still annoying problem (I wouldn't
call it a bug)
is the handling of indentation for nested litteral dicts/lists
to
search for existing systems, and as an added bonus wouldn't have had
to work around all those things that are almost but not quite the way
he wanted.
Cut him some slack.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
it can be
implemented without introducing inconsistencies.
If set behaved that way then del a[1] wouldn't behave like del
anymore. Normally, del whatever means that you can no longer use
whatever; in this proposal you can.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
the entry in
the object with a value of 1, which IMHO would be perfectly logical for a set
(which is why I started this discussion).
It's not logical at all. In all current uses of del, the thing that
follows del is a valid expression. With sets, that's not the case.
Carl Banks
--
http
() into a function is just a
design decision, that len is a common enough operation that it need
elevated status. It's really nothing more. Python wouldn't suffer
much regardless if len is a method, a built-in function, or an
operator with its own syntax.
Carl Banks
--
http://mail.python.org/mailman
a metaclass. There are reasons to
prefer any of these. I'd recommend the factory function unless you
think the users could significantly benefit from type inspection.
Just don't do it by rebinding the class name. That's not nice.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
it is, not for whatever computer science buzzword labels it has.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
object type called namedtuple in the collections
module. (Actually it's a type factory that creates a subclass of
tuple with attribute names mapped to the indices.) This might be a
perfect fit for your needs. You have to upgrade to 2.6, though, which
won't be released for a few days.
Carl
On Sep 26, 7:43 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
On Fri, 26 Sep 2008 14:54:36 -0700, Carl Banks wrote:
However, it seems from the rest of your comments that speed is your main
concern. Last time someone reported __slots__ didn't make a big
difference
On Sep 26, 8:53 pm, Carl Banks [EMAIL PROTECTED] wrote:
It might still end up being slower (creating slot descriptors might
take more time for all I know) but it's more than just an effect of
less memory.
Actually scratch that. Descriptors are only created when the type
object is created. I
changes, using the same ideas as the
multimethod implementations, but guaranteeing trial-and-error
dispatching.
Carl Banks
(**) I avoid the term generic function since it constrasts starkly
with the use of the word generic in generic programming.
--
http://mail.python.org/mailman/listinfo/python
, a library should never print error or status
messages. Messages should either be sent to the caller somehow, or
handled using the logging facility.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
with
numpy.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
but uses processes. I think you can still run it as a third-
party module in 2.5.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
thing that would benefit only a tiny fraction of
users.)
Carl Banks
(**) Actually the compiler can do some compile-time constant
expression folding, but that's about it. Otherwise it's object
agnostic.
--
http://mail.python.org/mailman/listinfo/python-list
for the truth value of an expression in the first place...
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
should ask on the setuptools mailing list.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
801 - 900 of 1669 matches
Mail list logo