To take the heat out of the discussion:
sets are blazingly fast.
--
http://mail.python.org/mailman/listinfo/python-list
Jim O'D wrote:
> Hi all
>
> I have an array a=array([2,3,-1]).
>
> I want to extract an array with all the elements of a that are less than 0.
>
> Method 1.
> new = array([i for i in a if i < 0])
>
> Method 2.
> new = a[nonzero(a<0)]
>
> I'm using Numeric arrays but can't seem to find a function t
Jim O'D wrote:
> Hi all
>
> I have an array a=array([2,3,-1]).
>
> I want to extract an array with all the elements of a that are less than 0.
>
> Method 1.
> new = array([i for i in a if i < 0])
>
> Method 2.
> new = a[nonzero(a<0)]
>
> I'm using Numeric arrays but can't seem to find a function t
Does python have a module that will translate between different spoken
languages? My python program displays all of its messages in English
currently and my boss wants it to default to Korean now.
Any ideas how to go about doing this?
--
http://mail.python.org/mailman/listinfo/python-list
should be defined in
the built-in "regex" module. Why is it telling me that capwords is not
defined?
I am completely new to Python so my apologies for such a basic question!
Thanks,
Jon
--
http://mail.python.org/mailman/listinfo/python-list
here something even more basic that I am failing to do? I'm
using the IDLE GUI in WinXP, Python release 2.4...
Thanks!
Jon
"Jeffrey Maitland" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Jon writes:
>
> > Hi,
> >
> > The following fou
Tommy, same question to you... :-)
-Jon
--
http://mail.python.org/mailman/listinfo/python-list
I've introduced typos below, but hopefully you get the idea?
Good luck,
Jon
---
typedef struct
{
stuff/* I don't know or care what is in here */
} imagefilestruct;
%extend imagefilestruct {
[... snip constructor destructor other functions etc]
%cstring_output_allocate_size(
/Downloads.html] or the like
you'd be able to make use of those functions.
Jon
D wrote:
> I would like to create a script for Windows 2000 that will create a
> Standard TCP/IP printer port and install a printer (I have the
> applicable printer drivers needed for the install on a network share).
&
Hi,
I'm not sure if this is exactly what you had in mind but what about
something like this:
elements = []
Els = ""
pt = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182,
'B':10.811}
while Els != 'No':
Els = raw_input("""Are there any further elements you would like to
include? if so
Perhaps using os you could work with lsof
[http://www.linuxcommand.org/man_pages/lsof8.html]
Jon
Thomas Bartkus wrote:
> This may be more of a Linux question, but I'm doing this from Python. .
>
> How can I know if anything (I don't care who or what!) is in the middle of
&
ny plan for a
statement like:
"from future import PleaseDontJustGuessWhatToImport" ?
Thanks in advance for any useful advice, perhaps I am just missing the
out on the "right way to do it"? It is normal to remove '.' from
sys.path at the start of a script?
Jon
-
Hi,
I wrote some code to read in info from a port using pyserial. the code
reads info sent by a box that is connected to my computer by an
rs232-to usb adapter. When I was writing the code and testing it on my
computer it worked fine.
I ran py2exe on the program (which uses wxpython for its gui) a
ave on your system. They still work fine. Not sure
what the "Matrix" package is that you are using?
HTH,
Jon
example:
C:\>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "
have time myself. Not very elegant, but someone can
probably transform it to the three line recursion which escapes me.
Best,
Jon
import Numeric
from Pycluster import treecluster
dist = Numeric.zeros((10,10),Numeric.Float)
for i in range(dist.shape[0]):
dist[i:,i:]=i
tree , dist = treecluste
I'm a frequent helper in the IRC channel for the Pylons web framework.
Pylons is installed from eggs using easy_install, and when Cheeseshop
is down (or so slow it might as well be down), it gives a bad
impression of our framework and Python in general. It took us half an
hour to figure out how to
Go for it! I can see immediate application in displaying and
exploring multivariate projections. e.g., factor analyses and
components analysis, multivariate groupings superimposed on projected
hyperspaces... This is stuff some of us have been dreaming about for a
couple of decades, and getting the
.
Or is there a better way?
Many thanks!
- Jon
--
http://mail.python.org/mailman/listinfo/python-list
aving narrowed
it down to linux I still need to choose between libKLT32.so and
libKLT64.so
Can someone tell me an idiom to choose the right one?
Thanks!
Jon
--
http://mail.python.org/mailman/listinfo/python-list
Christian Heimes wrote:
> You can check the size of a void pointer with ctypes:
>>> import ctypes
>>> ctypes.sizeof(ctypes.c_void_p) * 8
And Matt Nordhoff wrote:
>>> import platform
>>> platform.architecture()
Thanks guys! Exactly what I was after.
-
l times but I still can't figure out how to make these scripts
part of the build. There seems to be a lot of talk about entry_points,
but I'm blocked on those as to what is the entry point for an if
__name__=="__main__": idiom?
Thanks in advance for any help!
Jon
--
http://mail.python.org/mailman/listinfo/python-list
I would like to be able to control the (stop/resume) the download of a
large http object when using urllib2:urlopen() in Linux My
understanding is that the open reads data until the socket buffers are
filled, then waits until data is consumed (urllib2.read()) and fetches
more.
Is there a way to
On Jan 23, 9:48 pm, "M.Pekala" wrote:
> Hello, I am having some trouble with a serial stream on a project I am
> working on. I have an external board that is attached to a set of
> sensors. The board polls the sensors, filters them, formats the
> values, and sends the formatted values over a seria
here]:
img = Image.open(fname)
print img.format
Might be more expensive than the file utility, but that's up to you to
determine (open might be lazy, or it might load it - there is a
separate load function though, so who knows).
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ot plugging my other projects enough... You should check
> out elementwise.
>
> Thanks,
>
> Nathan
I love elementwise and this one - thanks.
If I can be so bold, I would call it 'contracts'. Or, if you want to
be more imaginative and esoteric - 'judge'/'barrister'/'solicitor'.
Thanks again,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ed modification or creation
times.
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
hat would work.
>
> Tobiah
Something like the following might be worth a go:
(untested)
from PIL import Image
img = Image.open(StringIO(blob))
print img.format
HTH
Jon.
PIL: http://www.pythonware.com/library/pil/handbook/image.htm
--
http://mail.python.org/mailman/listinfo/python-list
On Monday, 12 March 2012 20:31:35 UTC, MRAB wrote:
> On 12/03/2012 19:39, Virgil Stokes wrote:
> > I have a rather large ASCII file that is structured as follows
> >
> > header line
> > 9 nonblank lines with alphanumeric data
> > header line
> > 9 nonblank lines with alphanumeric data
> > ...
> >
d type at ?
>
> Thanks
> Cosmia
import inspect
if inspect.ismethod(foo):
# ...
Will return True if foo is a bound method.
hth
Jon
--
http://mail.python.org/mailman/listinfo/python-list
pt we don't know what's in the map_content
block.
Thirdly, 500 is an internal server error - so it's possible it's nothing to do
with any of this anyway -- could you provide a more comprehensive error message?
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
d
>
> I think I've seen this used elsewhere, but googling only seems to show
> results about the string method join, not whatever this is.
>
> To be clear, I understand how to use "".join(list), but have not found
> any information about this other, seemingly global, join function
> which takes multiple arguments. It's been bugging me.
os.path.join
Jon
--
http://mail.python.org/mailman/listinfo/python-list
gt; > for value in list:
> > if not value is another_value:
> > value.do_something()
> > break
> >
> > I always feel uncomfortable with this because it's misleading: a loop
> > that never loops.
>
> I agree. Please do not do this in public ;-).
>
> --
> Terry Jan Reedy
I'm not sure it's efficient or even if I like it, but it avoids try/except and
the use of a for loop.
if next( iter(mylist), object() ) is not another_value:
# ...
Just my 2p,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
nything... If it constantly calls the hook or never calls it, that's one thing.
Alternately, tcpdump/wireshark whatever, to see what the heck is going on with
traffic - if any.
hth
Jon
--
http://mail.python.org/mailman/listinfo/python-list
; > nearly
> > complete migration to Python 3, further maturity of JVM-based languages,
> > etc., where the bar gets a little higher from what people expect from
> > languages. Instead of fighting semicolons and braces, we start thinking
> > bigger. It could also be some sort of hardware advance, like screen
> > resolutions that are so amazing they let us completely rethink our views
> > on terseness, punctuation, code organization, etc.
>
> And what of those with poor eyesight, or the blind? Are they to be
> excluded from your "bigger" brave new world?
>
>
>
> --
> Steven
Completely not related to this discussion, but, I just have to say to Steven, I
could not have expressed that better.
+1 QOTW (albeit a long one)
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
y try to get
another reading, and notify the consumer which can then determine if it's got
enough data to calculate a peak/trough. This article is also a fairly good
read[4].
That's some pointers anyway,
hth,
Jon.
[1] http://pandas.pydata.org/
[2] http://statsmodels.sourceforge.net/
r tr in table.xpath('//tr'):
print [ (el.get('class', ''), el.text_content()) for el in
tr.iterfind('td') ]
[('', 'Sum'), ('', ''), ('green', '245'), ('red', '11'), ('
mp) < 20
Failing that, two (default)dicts with a tuple as the pair, then use that as
your base.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
t;
> Thanks for any help,
> Peter
Details here:
http://stackoverflow.com/questions/399022/why-cant-i-subclass-datetime-date
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
on built on Twisted), and various
modules that will offer synch and events - GIYF! It's doable!
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote:
> Greetings,
>
> I'm going to give a "Python Gotcha's" talk at work.
> If you have an interesting/common "Gotcha" (warts/dark corners ...) please
> share.
>
> (Note that I want over http://wiki.python.org/moin/PythonWarts already).
>
Any reason you can't derive from int instead of object? You may also want to
check out functions.total_ordering on 2.7+
--
http://mail.python.org/mailman/listinfo/python-list
On Monday, 9 April 2012 12:33:25 UTC+1, Neil Cerutti wrote:
> On 2012-04-07, Jon Clements wrote:
> > Any reason you can't derive from int instead of object? You may
> > also want to check out functions.total_ordering on 2.7+
>
> functools.total_ordering
>
> I w
On Monday, 16 April 2012 11:03:31 UTC+1, Kiuhnm wrote:
> On 4/16/2012 4:42, Steven D'Aprano wrote:
> > On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote:
> >
> >> This is the behavior I need:
> >> path = path.replace('\\', '')
> >> msg = ". {} .. '{}' .. {} .".format(a, path, b)
> >
st don't fully rely on a regex. I would, for time, and the little sanity I
believe I have left, would just do something like:
death_toll = re.search(r'death toll.*\d+', text).group().rsplit(' ', 1)[1]
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
scribe the concept, but most of them
> seem rather verbose and awkward compared to "a list of words", "a
> dictionary whose keys are words", etc.
I would just write the function signature as (very similar to how itertools
does it):
def func(iterable, ..):
pass
sing func.__defaults__, but without knowing the
> number and names of func's positional arguments (which I don't know how
> to find out) this doesn't help me. Any suggestions?
>
>
> --
> Hate music? Then you'll hate this:
>
> http://tinyurl.com/psymix
Possibly take a look at functools.lru_cache (which is Python 3.2+), and use the
code from that (at it's part of the stdlib, someone must have done design and
testing on it!). http://hg.python.org/cpython/file/default/Lib/functools.py
Jon
--
http://mail.python.org/mailman/listinfo/python-list
On Saturday, 21 April 2012 09:25:40 UTC+1, Steven D'Aprano wrote:
> On Fri, 20 Apr 2012 09:10:15 -0700, Jon Clements wrote:
>
> >> But I don't know how. I know that I can see the default arguments of
> >> the original function using func.__defaults__, but w
ot;+"*"[:stringlength%2]
> > spacer="*"+" "*(stringlength - 2)+"*"
> > fancyText="* "+string+" *"
> > return(hBorder,spacer,fancyText,hBorder)
> >
> > textTuple = border(SHI)
> > for
arch=A'
tree = lxml.html.parse(url).getroot()
trs = tree.xpath(QUERY)
for tr in trs:
tds = [el.text_content() for el in tr.iterfind('td')]
print tds
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
comcast.net> writes:
>
> Hello,
>
[snip]
> Any thoughts as to how to define a function to do this, or do this
> some other way? All insight is much appreciated! Thanks.
>
Did you not see my reply to your previous thread?
And why do you want the line nu
s...
import lxml.html
QUERY = '//tr[@bgcolor="#F1F3F4"][td[starts-with(@class, "body_cols")]]'
url = 'http://www.skadden.com/Index.cfm?contentID=44&alphaSearch=A'
tree = lxml.html.parse(url).getroot()
trs = tree.xpath(QUERY)
for tr in trs:
tds =
On Friday, 4 May 2012 16:27:54 UTC+1, Steve Howell wrote:
> On May 3, 6:10 pm, Miki Tebeka wrote:
> > > I'm looking for a fairly lightweight key/value store that works for
> > > this type of problem:
> >
> > I'd start with a benchmark and try some of the things that are already in
> > the standa
while, but doesn't the model provide a
get_experience_display() method which you could use...
Failing that, if order isn't important, you can not bother with tuples and have
CHOICES be a dict, then pass choices=CHOICES.iteritems() as I believe it takes
any iterable, and maybe plug an ordereddict if order is important.
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
e only option is
to send and handle a bounce (and some don't even send back bounces). And a
pretty good way for malicious people to make mail servers think you're trying a
DoS.
Although, what I'm finding useful is an option of "auth'ing" with twitter,
faceboo
life until you
> have learned about code injection attacks, data sanitation, trusted and
> untrusted input. Then you can come back to eval and use it safely and
> appropriately.
I would +1 QOTW - but fear might have to cheat and say +1 to 2 paragraphs of
the week :)
Jon.
--
http://
news groups? I use to be with an
ISP that hosted usenet servers, but alas, it's no longer around...
Only really interested in Python groups and C++.
Any advice appreciated,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
gt; if I'm using SQL I guess I might as well include that in the query.) The
> output files are inputs for other (C++) code that I have no control over.
>
> Any approach that doesn't consume large amounts of memory will do. Cheers.
>
> Duncan
It might be worth checking out https://sdm.lbl.gov/fastbit/ which has Python
bindings (nb: the library itself takes a while to compile), but I'm not I00%
sure it would meet all your requirements.
Jon
--
http://mail.python.org/mailman/listinfo/python-list
ld probably enjoy not keep re-typing "record.xxx" and would
save you having to invent another possibly conflicting name) such as:
print record['full_name', 'nick_name', 'pet_name'] # looks clean to me
In short I totally agree with MRAB here.
Just my 2p,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On 06/06/12 18:54, Prasad, Ramit wrote:
data= []
for index in range(N, 1): # see Chris Rebert's comment
with open('data%d.txt' % index,'r') as f:
data.append( f.readlines() )
I think "data.extend(f)" would be a better choice.
Jon.
--
http
On 06/06/12 19:51, MRAB wrote:
On 06/06/2012 19:28, Jon Clements wrote:
On 06/06/12 18:54, Prasad, Ramit wrote:
data= []
for index in range(N, 1): # see Chris Rebert's comment
with open('data%d.txt' % index,'r') as f:
data.append( f.readlines() )
I think "dat
en
possibly look at some sort of scheduling to fulfil what happens after 15
minutes.
I'm sure there's subtleties I'm missing, but just thought it could be
useful.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
there's a
product out there that works with Windows), is a lot easier and puts the
load on the filesystem/OS instead of having to be handled in your
application is a lot simpler.
Jon
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 17 Jun 2012 23:17:37 +, Steven D'Aprano wrote:
> On Mon, 18 Jun 2012 08:41:57 +1000, Chris Angelico wrote:
>
>> On Mon, Jun 18, 2012 at 3:06 AM, Rafael Durán Castañeda
>> wrote:
>>> The language Python includes a SystemRandom class that obtains
>>> cryptographic grade random bits fro
On Jun 5, 4:37 am, Ben Finney wrote:
> writes:
> > I was surfing around looking for a way to split a list into equal
> > sections. I came upon this algorithm:
>
> > >>> f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc
> > >>> f("Hallo Welt", 3)
> > ['Hal', 'lo ', 'Wel', 't']
>
>
dding iOS specific modules
Syntax highlighting
and more...
Regards,
Jon Dowdall
--
http://mail.python.org/mailman/listinfo/python-list
s for future versions include:
Improved cursor handling in interactive mode.
Access to the interactive command history.
Modules to access iOS specific functionality.
Additional documentation.
Syntax highlighting.
Improved script debugging support.
Regards,
Jon
--
http://mail.python.org/mailman/lis
, but going by what you've
put here, I might be tempted to take this kind of stuff out of the
class's and using a graph library (such as networkx) - that way if
traversal is necessary, it might be a lot easier. But once again, I
must say I'm not 100% sure what the OP wants to achieve...
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
It seems unreasonably hard to write simple one-line unix command line
filters in python:
eg: ls | python -c " print x.upper()"
to get at sys.stdin or similar needs an import, which makes a
subsequent for-loop illegal.
python -c "import sys; for x in sys.stdin(): print x" <<- SyntaxError
Am I mi
> > Am I missing something obvious?
>
> ls | python -c "for line in __import__('sys').stdin: print (line.upper())"
Ah, so I am missing something - it is possible - but 'obvious'?
Do people think it should be more accessible
--
http://mail.python.org/mailman/listinfo/python-list
lso go one step further reformatting and do something such as:
>>> from time import strptime, strftime
>>> d = '01/12/2011'
>>> strftime('%Y%m%d', strptime(d, '%m/%d/%Y'))
'20110112'
That way you get some validation about the data, ie, if you get
'13/12/2011' you've probably got mixed data formats.
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
oping someone with more experience will be able to enlighten me!
Best regards,
Jon
--
http://mail.python.org/mailman/listinfo/python-list
2011 at 4:49 PM, Santoso Wijaya wrote:
> Have you taken a look at numpy? [1] It was written for exactly this kind of
> usage.
>
> ~/santa
>
> [1] http://numpy.scipy.org/
>
>
> On Fri, Mar 4, 2011 at 2:32 PM, Jon Herman wrote:
>
>> Hello all,
>>
>>
mp2+c[l]*k[:,l]
X=Xold + dt * Xtemp2
t=told+dt
Xstore=vstack((Xstore,X))
tstore=vstack((tstore,t))
if abs(tf-t)< 1e-14:
print('At tf')
break
On Fri, Mar 4, 2011 at 6:46 PM, Jon Herman wrote:
> Actually,
Sorry Robert, I'd missed your post when I just made my last one. The output
I am getting in Python looks as follows:
array([ 9.91565050e-01, 1.55680112e-05, -1.53258602e-05,
-5.75847623e-05, -9.64290960e-03, -8.26333458e-08])
This is the final state vector, consisting of 6 states (p
-mu)*(X[0]+mu)/r1**3-mu*(X[0]-(1-mu))/r2**3
Ay= X[1]-2*X[3]-(1-mu)*X[1]/r1**3-mu*X[1]/r2**3
Az= -(1-mu)*X[2]/r1**3-mu*X[2]/r2**3
XDelta=array([X[3], X[4], X[5], Ax, Ay, Az])
return XDelta
On Mon, Mar 7, 2011 at 11:50 AM, Jon Herman wrote:
> Sorry Robert, I'd missed y
And for the sake of additional completeness (I'm sorry I didn't think of all
this in one go): my derivative function in Python produces results that
agree with MATLAB to order e-16 (machine precision), so the error is
definitely building up in my integrator.
On Mon, Mar 7, 2011 at 11:
x=xwrk + dt * Xtemp2;
t=twrk+dt;
On Mon, Mar 7, 2011 at 1:50 PM, Chris Rebert wrote:
> >>> On Fri, Mar 4, 2011 at 2:32 PM, Jon Herman
> wrote:
> >>>>
> >>>> I am new to the Python language and writing a Runge-Kutta-Fellberg
> 7(8)
&
Thanks Terry! Of course, speed is not my main concern at this point and I'm
more worried about precision...would you have some input on this discussion?
:)
Jon
On Mon, Mar 7, 2011 at 2:35 PM, Terry Reedy wrote:
> On 3/7/2011 1:59 PM, Jon Herman wrote:
>
>> And for the sak
ize for asking your time for such a
beginner's oversight...I'll be fluent in Python some day ;-)
On Mon, Mar 7, 2011 at 5:34 PM, Robert Kern wrote:
> On 3/7/11 2:52 PM, Jon Herman wrote:
>
>> It really is exactly the same process, but sure. Below is my Matlab
>> translat
dules from
succesfully) does not appear to be it.
So my question is: How do I tell Python where to look for opening files, and
where to store new files?
Thanks,
Jon
--
http://mail.python.org/mailman/listinfo/python-list
t the following error: IOError: [Errno 13] Permission denied: 'f'
If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f'
Can anyone explain to me why this happens?
On Fri, Mar 18, 2011 at 3:50 PM, Jack Trades wrote:
>
> On Fri, Mar 18, 2011 at 4:33
load that array again, the next time I
start up my computer?
Basically I am doing very large computations and want to store the results.
Thanks a lot guys!
Jon
On Fri, Mar 18, 2011 at 4:18 PM, Dan Stromberg wrote:
>
> Are you on windows?
>
> You probably should use / as yo
Wow, Jack, that is one awesome and simple module...thank you so much! I am
happily storing and accessing all the arrays I could ever want :)
Thanks to all for the quick assistance!
On Fri, Mar 18, 2011 at 4:24 PM, Jack Trades wrote:
>
> On Fri, Mar 18, 2011 at 5:21 PM, Jon Herman
wanted to have python available 'on the go' without carrying a laptop.
The current implementation is based on my need to test simple python
functions in an isolated environment. I hope to add more iOS specific
capabilities if there is enough interest.
Enjoy...
Jon Dowdall
--
ht
On Sat, 09 Apr 2011 00:36:58 -0700, Raymond Hettinger wrote:
> On Apr 8, 10:13 pm, Jon Dowdall wrote:
>> Hi All,
>>
>> Sorry for the blatant advertising but hope some of you may be
>> interested to know that I've created an iPad application containing the
&g
On Apr 14, 9:52 pm, Fabio wrote:
> Hi to all,
> I have troubles with TextWrangler "run" command in the "shebang" (#!)
> menu.
> I am on MacOSX 10.6.7.
> I have the "built-in" Python2.5 which comes installed by "mother Apple".
> Then I installed Python2.6, and left 2.5 untouched (I was suggested to
problem at all?
And why the time stats with /dev/null ???
I'd probably go for something like:
import csv
with open('somefile') as fin:
nulls = set()
for row in csv.reader(fin, delimiter='|'):
nulls.update(idx for idx,val in enumerate(row, start=1) if not
val)
print 'nulls =', sorted(nulls)
hth
Jon
--
http://mail.python.org/mailman/listinfo/python-list
items({}.iteritems())
My stab:
from itertools import chain
def print_it(iterable):
it = iter(iterable)
try:
head = next(it)
except StopIteration:
print 'Empty'
return
for el in chain( (head,), it ):
print el
Not sure if I'm truly happy with that though.
Jon
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On 2017-10-12, Ben Bacarisse wrote:
> Chris Angelico writes:
>> Normally, with a Python-based framework, you don't need _any_ web
>> server configuration. You simply define your URL routing within the
>> Python code. The only thing the web server needs to know is where to
>> find the web app, and
On 2017-10-12, Ben Bacarisse wrote:
> I see. If I'm reading this right, the app requests are passed through
> to another server -- uWSGI.
Yes. It doesn't have to be uWSGI; it could be gunicorn, or you could
probably use Apache's mod_fcgid. As a last resort you could use CGI,
which wouldn't invol
On 2017-10-31, Stefan Ram wrote:
> Ned Batchelder writes:
>> Â Â Â def wrapped_join(values, sep):
>
> Ok, here's a report on me seing non-breaking spaces in
> posts in this NG. I have written this report so that you
> can see that it's not my newsreader that is converting
> something, b
On 2017-11-01, Alexey Muranov wrote:
> what do you think about the idea of replacing "`else`" with "`then`" in
> the contexts of `for` and `try`?
>
> It seems clear that it should be rather "then" than "else." Compare
> also "try ... then ... finally" with "try ... else ... finally".
>
> Curren
On 2017-11-02, Steve D'Aprano wrote:
> On Fri, 3 Nov 2017 12:39 am, Jon Ribbens wrote:
>> Why would we want to make the language worse? It is fairly obvious
>> what 'else' means,
>
> Yes, obvious and WRONG.
Nope, obvious and right.
> for x in seq:
>
On 2017-11-03, Alexey Muranov wrote:
> 'Then' describes what happens next indeed, unless some extraordinary
> situation prevents it from happening, for example:
>
> try:
> go_to_the_bakery()
> then:
> buy_croissants(2)
> except BakeryClosed:
> go_to_the_grocier
On 2017-11-03, Steve D'Aprano wrote:
> On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote:
>> No, it's an obvious bug. You have a 'for...else' with no 'break'.
>> Like I said, that should probably be a syntax error.
>
> It should absolutely not be
On 2017-11-03, Chris Angelico wrote:
> On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens
> wrote:
>>> It should absolutely not be a syntax error. There's no reason for it
>>> to be a syntax error, except to satisfy some arrogant and foolish
>>> idea of purity
On 2017-11-03, Steve D'Aprano wrote:
> The for loop does not necessarily perform a search:
>
> count = 1
> for obj in sequence:
> if count > MAX_OBJECTS:
> print("too many objects, halting")
> break
> process(obj)
> else:
> print("finished")
>
> According to your mental
On 2017-11-04, Michael Torrie wrote:
> On 11/03/2017 09:06 PM, Chris Angelico wrote:
>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote:
>>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
That's incorrect. There are multiple ways to exit a loop that
will prevent the `else` block fro
On 2017-11-04, Ben Finney wrote:
> To respond to the criticism of an idea – criticism containing no mention
> of the person – as though it “clearly refers to the [person]”, is of
> significant concern on a software dicussion forum such as this.
No, the thing that is "of significant conern on a so
On 2017-11-05, Steve D'Aprano wrote:
> On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote:
>> That conforms to my model. It's searching for the condition
>> 'count > MAX_OBJECTS'.
>
> That's sounds to me that you are willing to call just about any
1 - 100 of 1223 matches
Mail list logo