On Aug 28, 2:42 pm, Terry Reedy tjre...@udel.edu wrote:
Carl Banks wrote:
I don't think it needs a syntax for that, but I'm not so sure a method
to modify a value in place with a single key lookup wouldn't
occasioanally be useful.
Augmented assignment does that.
Internally uses two
to the object.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
design points of Python: that attributes
should always be accessed explicitly.
Having said that, the syntax you propose is awful. :) Normally when
this is proposed they use a keyword such as using:
p = Person()
using p:
name = Carl Banks
location = Los Angeles
or, perhaps to save a line
On Aug 27, 7:25 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Thursday 27 August 2009 15:26:04 Carl Banks wrote:
Deleting items from a list while iterating over it is a bad idea,
exceptions or not.
Hmm, this sounds like something someone might do for a game. You have
a list
On Aug 27, 8:01 am, zaur szp...@gmail.com wrote:
On 27 авг, 18:34, Carl Banks pavlovevide...@gmail.com wrote:
The idea has been
discussed in various forms here quite a bit over the years. I doubt
there's any chance it'll be accepted into Python, because it goes
against one of the main
for them.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 26, 7:09 am, kj no.em...@please.post wrote:
In 16b72319-8023-471c-ba40-8025aa6d4...@a26g2000yqn.googlegroups.com Carl
Banks pavlovevide...@gmail.com writes:
First, one of the goals of OO is encapsulation, not only at the
level of instances, but also at the level of classes. =A0Your
print x # prints 5
Well, it wouldn't be a can I rebind a variable using a with-
statement thread if someone didn't post a solution that they thought
worked, but didn't test it on local variables.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
- 1)
_classvar = fact(5)
fact = staticmethod(fact)
print Demo9._classvar
xx = Demo9()
print xx.fact(6)
print Demo9.fact(8)
This won't work normally. It only worked for you because you made a
typo.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 26, 8:36 am, kj no.em...@please.post wrote:
In 1bf83a7e-f9eb-46ff-84fe-cf42d9608...@j21g2000yqe.googlegroups.com Carl
Banks pavlovevide...@gmail.com writes:
Yeah, it's a little surprising that you can't access class scope from
a function, but that has nothing to do with encapsulation
there's really only one reasonable
interpretation. The point of consistency is to help understand things
by analogy, but if analogy doesn't help understanding--and it wouldn't
in this case--there's no point.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
is to write out the ElementTree object as XML with
an .xml extension, and view it in a modern web browser (Firefox, IE,
others maybe) that can show XML structure.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
to explain it,
but I decided it's not worth a serious argument.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
programming langauge is, at most, a polite
suggestion for how Python should do it.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
but this relic of the past
should have been consigned to the waste bin of history long ago. :)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
with
this:
ctypes.pythonapi.PyErr_SetFromErrno(ctypes.py_object(OSError))
Not entirely sure it'll work with Python built with a static library,
but I think it will.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
it some other way than by following up
to an obvious joke, probably one designed to diffuse the ill-feeling.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
.
If the syntax bothers you can always do this:
str.join(,iter(four score))
I think .join is ugly as hell but in this case convenience beats
beauty for me.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
because you can use xrange, you don't
need compiler magic to recognize and optimize range.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
* friendly form, so there is really nothing to worry about it.
I like how being very friendly means calling people after a guy who
tried to blow up the English Parliament.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
altogether. Price you pay for popularity.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 17, 5:40 pm, Mensanator mensana...@aol.com wrote:
On Aug 17, 4:06 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Aug 17, 10:03 am, Jean-Michel Pichavant jeanmic...@sequans.com
wrote:
I'm no English native, but I already heard women/men referring to a
group as guys, no matter
On Aug 17, 8:49 pm, Mensanator mensana...@aol.com wrote:
On Aug 17, 8:04 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Aug 17, 5:40 pm, Mensanator mensana...@aol.com wrote:
On Aug 17, 4:06 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Aug 17, 10:03 am, Jean-Michel
complaints to be made about this situation it's that
there are any 2.x learning materials anythere that continue to use
range() and not xrange() in this context.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
is able to do this.
Cython can do this easily because it is a different language that is a
lot less dynamic than Python.
If you don't care about the dynamic stuff why don't you just use
Cython? Or quit complaining and just use xrange.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python
)):
Funcs.append(create_funcs_caller(i))
(I prefer to do it this way in any case; never liked the keyword
argument hack way of doing it.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
is that their response is to shutdown changes that are
intended
to *help* newbies help themselves. It seems self-defeating to me.
Intended to help newbies doesn't necessarily mean it actually will
help newbies.
(Just sayin'.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
.
So since both are offered and gauss is faster, I assume it
must have some offsetting disadvantage. What is it?
random.gauss is not thread safe.
I'm kind of surprised the html docs don't mention this; the docstring
does.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
altogether; only
import modules. It's more typing and a bit less efficient, but it
makes everything more straightforward and consistent.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
optparse instead of
argparse.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
by the language to be
equal to itself, so equality is preserved and there should be no issue
with it, even if the hash code changes across invocations.
Now, if you are doing something weird with the hash value itself--
which I highly discourage--then all bets are off.
Carl Banks
--
http://mail.python.org
was vague; if
you want a better answer please rephrase to be more specific. Include
details like what you would like the code of a Python plugin to look
like.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
has been
available for months.
Hello,
I'm mailing you to kindly request, again, that you please stop
validating r's disruptiveness by responding to him on
comp.lang.python. Thank you.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
that opinions differ; they have to take perceived defects in
the docs personally.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
attributes (and maybe also it's underlying code
object) which are read-only.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
?
It is possible to redefine == operator by defining __ne__ instead of
__eq__, at least on Python 2.5, so you should keep that in mind.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 9, 11:10 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote:
Why should a backslash in a string literal be an error?
Because the behavior of \ in a string is context-dependent, which means
a reader can't know
):
def __init__(self,*args,**kwargs):
raise TypeError('Type not callable; use factory function
instead')
@classmethod
def _create_object(cls,initial_value):
self = object.__new__(cls) # avoid __init__
self.value = initial_value
Carl Banks
--
http://mail.python.org
other character is just
the character, except for backslash followed by a newline, which
suppresses the newline.
That would be reasonable; it'd match the behavior of regexps.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 10, 1:37 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Mon, 10 Aug 2009 00:37:33 -0700, Carl Banks wrote:
On Aug 9, 11:10 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote:
Why should
errors raised inside the _instancecall method.
Then set _instancecall on any objects you want to be callable.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
real-world importance,
but in terms of raw unPythonicness this might be the worst offense the
language makes.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
py_compile.compile(sys.argv[1],'/dev/null',None,False)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
, that guy is Xah Lee, a person who's been trolling Usenet
for a long time. He is best ignored, but I don't blame someone for
snapping at him.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
not being visible at an
interactive prompt.
I have given you some fairly vague answers, hopefully that'll give you
some idea. It sounds like you have an ambitious project, suggesting
that you are probably good enough to implement the suggestions.
Carl Banks
--
http://mail.python.org/mailman
to return a closure with a
boolean value. See my upcoming reply to the author.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 7, 9:01 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Aug 7, 7:18 am, Diez B. Roggisch de...@nospam.web.de wrote:
alex23 schrieb:
On Aug 7, 10:50 pm, Benjamin Kaplan benjamin.kap...@case.edu wrote:
That isn't an operator at all. Python does not support compound
probably be useful, but might also attract spam and lots of
useless fluff, because it's likely to be much higher volume than
documentation on other projects.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
several mutually-exclusive
features.
http://www.geocities.com/connorbd/tarpit/magentaaarm.html
(It's on Geocities, yikes, someone better archive that)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
indispensible,
though.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
(evidently) will soon use to create a regexp.
Yes, you can do that in Python as well, in exactly the same way, using
Python's string manipulation capabilities.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
of implicit boolean values, but given that Python has it, I think it
is best to adhere strongly idiomatic uses like regexps.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 3, 8:12 pm, Fred Atkinson fatkin...@mishmash.com wrote:
On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks
pavlovevide...@gmail.com wrote:
I appreciate the response.
I am executing a statement to retrieve one record at random.
An example would
smoking? That's like
Perl! Haven't you learned your lesson?
Python's syntax might even be better than Lisp's, but it's certainly
harder to parse.- Hide quoted text -
Go away, troll.
[This is cross-posted; I recommend that no one else follow up.]
Carl Banks
--
http://mail.python.org/mailman
or there was an error in
a CGI script.
Your script has a syntax error. (You forgot a colon or something like
that.)
If you can, try to run the file directly from a Python interpreter to
see where the error is.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
information if you want a better answer
than that.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
bookmark in web browser for Python documentation - keyword
search for correct module (easy with firefox) - scroll.
This might not be the smoothest method ever (omg you have to use a
*mouse*) but it should be usable enough.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 31, 1:55 pm, Mark Lawrence breamore...@yahoo.co.uk wrote:
Apart from that what have the Pythonistas ever done for us? Nothing!:)
Please don't feed the trolls.
And if you do feed the trolls don't smile at them.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 31, 2:28 pm, kj no.em...@please.post wrote:
In e22013d0-fbad-44e0-919b-ad5bb5f2d...@g19g2000vbi.googlegroups.com Carl
Banks pavlovevide...@gmail.com writes:
(omg you have to use a
*mouse*)
That's precisely the point. There's a huge number of programmers
out there who, like me
On Jul 31, 3:09 pm, kj no.em...@please.post wrote:
In 09bf4f17-40a5-4bad-81d3-1950545b7...@g6g2000vbr.googlegroups.com
Carl Banks pavlovevide...@gmail.com writes:
snip
Thanks. Your remarks at least confirm that my impression was not
simply due to my noob ignorance: the keyboard-accessible
On Jul 29, 7:14 am, Piet van Oostrum p...@cs.uu.nl wrote:
Carl Banks pavlovevide...@gmail.com (CB) wrote:
CB On Jul 28, 3:15 pm, John D Giotta jdgio...@gmail.com wrote:
I'm looking to run a process with a limit of 3 instances, but each
execution is over a crontab interval. I've been
?
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
, then you want to use a thread pool (create three threads, and
give them tasks as necessary). But you'll have to have a way for the
process started by crontab to communicate with the server.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
and inconsistency, especially if you are a
Python newbie. Just pass in a list if your function expects a list.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
really is the point?
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
://xahlee.org/perl-python/index.html
• Xah's PHP Tutorial
http://xahlee.org/php/index.html
Xah
∑http://xahlee.org/
Wow, you leave no stone unturned.
computer science R us
I'm stealing this.
Carl BAnks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 24, 11:06 am, Raffael Cavallaro
raffaelcavall...@pas.espam.s.il.vous.plait.mac.com wrote:
On 2009-07-23 23:51:02 -0400, Carl Banks pavlovevide...@gmail.com said:
On Jul 23, 5:52 pm, Rui Maciel rui.mac...@gmail.com wrote:
fft1976 wrote:
How do you explain that something as inferior
that can be indexed. Sounds
like a big mess to me...
You can call the big mess Matlab.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 22, 8:38 pm, a...@pythoncraft.com (Aahz) wrote:
In article
f3d88edf-b5d3-43e4-89a3-b05ef0f55...@p28g2000vbn.googlegroups.com,
Carl Banks pavlovevide...@gmail.com wrote:
You have to be REALLY REALLY careful not to pass any user-supplied
data to it if this is a server running on your
On Jul 23, 2:37 am, Nobody nob...@nowhere.com wrote:
On Wed, 22 Jul 2009 15:17:52 -0700, Carl Banks wrote:
So do all these OSes have some kind of __mega_unifying_poll system
call that works for anything that might possibly block, that you can
exploit from a user process?
Threads ;)
Yeah
allows some threads to run while
others are blocked in a system call (as well as in a few other minor
cases), which can't be done with green threads.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 22, 10:20 am, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
Wrong. It only partially undermines the utility of native threads,
not completely. Native threading allows some threads to run while
others are blocked in a system call (as well
On Jul 22, 12:04 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
Why is that such an advantage? Green threads work fine if you just
organize the i/o system to never block.
Because then I don't have to organize the I/O system never
On Jul 22, 1:53 pm, Jean-Paul Calderone exar...@divmod.com wrote:
On Wed, 22 Jul 2009 12:35:52 -0700 (PDT), Carl Banks
pavlovevide...@gmail.com wrote:
On Jul 22, 12:04 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
Why
On Jul 19, 10:18 pm, Tim Daneliuk tun...@tundraware.com wrote:
Uh Carl ... are you familiar with the concept of mocking humor?
You got me, lip hurts bad. :)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
a list
of characters).
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
idea to pass it through some kind of validator
for extra protection.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
at the original
thread on comp.lang.lisp it seems they were doing a surprisingly good
job discussing the issue.
I'm guessing it's because the fanboy Lispers like Ken Tifton were busy
with a flamewar in another thread (LISP vs PROLOG vs HASKELL).
Carl Banks
--
http://mail.python.org/mailman/listinfo
On Jul 19, 4:29 pm, Tim Daneliuk tun...@tundraware.com wrote:
Carl Banks wrote:
On Jul 19, 10:33 am, fft1976 fft1...@gmail.com wrote:
On Jul 19, 9:55 am, Frank Buss f...@frank-buss.de wrote:
E.g. the number system: In many Lisp
implementations (/ 2 3) results in the fractional object 2/3
using a dictionary. A regexp can be used after
dispatching to extract parameters if necessary.
It's possible to have disjoint regexps without a simple dispatch
criterion, but I'd guess that's less common.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
ask me.
Not Perlish at all.
(Perl would never want you not to use something.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
to see if you
are the owner of the condition, but this method is undocumented.
cond = Condition()
...
cond.acquire()
while not ok_to_proceed():
cond.wait()
if not cond._is_owned():
# must've timed out
raise TimeOutException
operate()
cond.release()
Carl Banks
--
http
misread the code. So scratch what I said.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
.
Pretty confusing if you ask me. Unfortunately Python is very
unPythonic when it comes to importing. :(
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
the
code import sys; print sys.modules.get('nc'); what does that output?
Is there an old nc.py or nc.pyc file anywhere?
Carl Banks
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 13, 8:25 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Mon, 13 Jul 2009 17:49:23 -0700, Carl Banks wrote:
On Jul 13, 12:31 pm, Piet van Oostrum p...@cs.uu.nl wrote:
seldan24 selda...@gmail.com (s) wrote:
s Hello,
s I'm fairly new at Python so hopefully
On Jul 14, 2:14 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote:
Seriously, do you *ever* take more than 2 seconds to consider whether
you might be missing something obvious before following up with these
indignant knee
On Jul 14, 4:48 am, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
In message 93f6a517-63d8-4c80-
bf19-4614b7099...@m7g2000prd.googlegroups.com, Carl Banks wrote:
Or would you rather let all unexpected exceptions print to standard
error, which is often a black hole in non
.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
in enumerate(page):
page['position'] = start+i
return page
That might not work depending on what you are doing but you should
consider it.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
).communicate()
return float(stdout)
clock_scan('1 hour ago')
clock_scan('next week')
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
a __del__ method
you care enough to clean it up explicitly. 'with' blocks are very
nice for that.
The OP already said with blocks won't suffice since the resources are
long-lived objects that aren't limited to a single scope.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
. I'd recommend making an
effort to call it and to rely on __del__ as little as possible.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
that if more than one class on the mro defines a
method
only the first will get called?
super returns [a proxy to] the *next* class in the MRO chain; it may or
may not be a superclass of C (it may be a sibling class instead).
It could be even a niece class.
Carl Banks
--
http
.
If you have any C-extensions it might complicate this.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
relatively random order.
Instead, call random.shuffle() on the list, and iterate through that
to get the elements in random order.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
(notwithstanding Duncan Booth's
explanation of slight semantic differences). However, I find myself
using re.match much more often than re.search, so perhaps in this case
a second obvious way is justified.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 1, 5:49 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
Instead, call random.shuffle() on the list, and iterate through that
to get the elements in random order.
It's better to use random.sample() than random.shuffle().
If you're
On Jul 1, 6:37 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Carl Banks pavlovevide...@gmail.com writes:
If you're iterating through the whole list and don't need to preserve
the original order (as was the case here) random.shuffle() is better.
1. Random.sample avoids iterating through
501 - 600 of 1669 matches
Mail list logo