On 2016-02-08 00:05, Paulo da Silva wrote:
> Às 22:17 de 07-02-2016, Tim Chase escreveu:
>> all_files = list(generate_MyFile_objects())
>> interesting = [
>> (my_file1, my_file2)
>> for i, my_file1
>> in enumerate(all_files, 1)
>> for my_
On 2016-02-09 19:26, Anthony Papillion wrote:
> myfile-2015-02-09-19-08-45-4223
>
> Notice I'm replacing all of the "."'s, " "'s, and ":"'s returned by
> datetime.now() with "-"'s. I'm doing that using the following code
> but it's freaking ugly and I KNOW there is a better way to do it. I
> just
On 2016-02-12 00:31, Paulo da Silva wrote:
> What is the best (shortest memory usage) way to store lots of
> pathnames in memory where:
>
> 1. Path names are pathname=(dirname,filename)
> 2. There many different dirnames but much less than pathnames
> 3. dirnames have in general many chars
>
> Th
On 2016-02-17 16:51, Steven D'Aprano wrote:
> If you want the file to be closed immediately, you must:
>
> - use a with statement;
>
> - or explicitly call f.close()
I have a lot of pre-"with" code (i.e., Py2.4) that looks like
f = open(...)
try:
do_stuff()
finally:
f.close()
To
On 2016-02-18 09:00, grsm...@atlanticbb.net wrote:
> Would this be the correct way to return
> a list as a default result.
>
> Also, would the list be the preferable result (to a python
> programmer) ?
>
> def test(command, return_type='LIST'):
> """ Go to database and return data"""
> if
On 2016-02-18 09:58, wrong.addres...@gmail.com wrote:
> How long can I depend on VB?
Are you talking the VB6-and-before, or VB.Net? Given that MS dropped
support for the VB6 line a decade ago (2005-2008 depending on whether
you had extended support) with little to no help in transitioning to
VB.N
On 2016-02-18 07:33, wrong.addres...@gmail.com wrote:
> Another question I have is regarding reading numerical data from
> text files. Is it necessary to read one character at a time, or can
> one read like in Fortran and Basic (something like Input #5, X1,
> X2, X3)?
A lot of my work is extractin
On 2016-02-18 10:57, grsm...@atlanticbb.net wrote:
> Tim, the 'crazy-other-result format' is the
> result returned by the database, nothing
> I can do about that :)
then, much like converting byte-strings to unicode strings as early
as possible and converting them back to byte-strings as late as
p
On 2016-02-19 02:47, wrong.addres...@gmail.com wrote:
> 2 12.657823 0.1823467E-04 114 0
> 3 4 5 9 11
> "Lower"
> 278.15
>
> Is it straightforward to read this, or does one have to read one
> character at a time and then figure out what the numbers are? --
It's easy to read. What you do with tha
On 2016-02-19 10:46, noydb wrote:
> I want to be able to download this CSV file and save to disk
> >> http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv
from urllib.request import urlopen
data =
urlopen("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.c
On 2016-02-21 13:16, BartC wrote:
> > No need for anyone to re-invent the
> > wheel! ;-)
>
> I keep seeing this in the thread. Python has all this capability,
> yet it still requires a lot of fiddly code to be added to get
> anywhere near as simple as this:
>
>read f, a, b, c
>
> And this i
On 2016-03-03 08:29, Ben Finney wrote:
> Skip Montanaro writes:
>> Running flake8 over some code which has if statements with
>> multiple conditions like this:
>>
>> if (some_condition and
>> some_other_condition and
>> some_final_condition):
>> play_bingo()
>
> For th
On 2016-03-03 10:43, Nick Sarbicki wrote:
> The number of times I've had to correct a student for naming their
> script "turtle.py".
>
> And the number of times I've caught myself doing it...
I'm surprised at the number of times I find myself creating an
"email.py" DESPITE KNOWING BETTER EVERY SI
On 2016-03-03 16:29, Oscar Benjamin wrote:
> On 3 March 2016 at 11:48, Tim Chase
> wrote:
> > On 2016-03-03 10:43, Nick Sarbicki wrote:
> >> The number of times I've had to correct a student for naming
> >> their script "turtle.py".
> >>
&g
On 2016-03-04 17:17, sohcahto...@gmail.com wrote:
> x \
> = \
> 5
> if \
> y \
> == \
> z:
> print \
> 'this is terrible'
> print \
> 'but still not incorrect
>
> It would be terrible, still but not incorrect.
And has the sociopathic benefit that the diffs make it quite clear
what
On 2016-03-06 19:29, Sven R. Kunze wrote:
> what's the reason that reversed(zip(...)) raises as a TypeError?
>
> Would allowing reversed to handle zip and related functions lead to
> strange errors?
Peculiar, as this works in 2.x but falls over in 3.x:
$ python
Python 2.7.9 (default, Mar 1 201
On 2016-03-06 12:38, Tim Chase wrote:
> On 2016-03-06 19:29, Sven R. Kunze wrote:
> > what's the reason that reversed(zip(...)) raises as a TypeError?
>
> I'm not sure why reversed() doesn't think that the thing returned by
> zip() isn't a sequence.
Ah, a li
On 2016-03-16 16:53, Peter Otten wrote:
> > item=None
> > for item in items:
> > #do stuff
> if item is None:
> > #do something else
>
> I like that better now I see it.
The only problem with that is if your iterable returns None as the
last item:
items = ["Something here", N
On 2016-03-17 15:29, Charles T. Smith wrote:
> isready = re.compile ("(.*) is ready")
> relreq = re.compile (".*release_req")
> for fn in sys.argv[1:]: # logfile
> name tn = None
> with open (fn) as fd:
> for line in fd:
> #match = re.match ("
On 2016-03-19 12:24, BartC wrote:
> So a string that looks like:
>
> "ññ"
>
> can have 2**50 different representations? And occupy somewhere
> between 50 and 200 bytes? Or is that 400?
And moreover, they're all distinct if you don't normalize them.
On 2016-03-16 15:29, Sven R. Kunze wrote:
> I would re-use the "for-else" for this. Everything I thought I
> could make use of the "-else" clause, I was disappointed I couldn't.
Hmm...this must be a mind-set thing. I use the "else" clause with
for/while loops fairly regularly and would be miffed
On 2016-03-18 17:33, Fillmore wrote:
> >>> d = dict()
> >>> d['squib'] = "007"
> >>> key = d.items()[0]
I posted a similar question about 1-element-sets[1] a while back and
Peter Otten & Rene Pijlman both suggested
>>> s = set(["hello"])
>>> element, = s
which, in your case would translate t
On 2016-03-16 11:23, Sven R. Kunze wrote:
> for x in my_iterable:
> # do
> empty:
> # do something else
>
> What's the most Pythonic way of doing this?
If you can len() on it, then the obvious way is
if my_iterable:
for x in my_iterable:
do_something(x)
else:
somethin
On 2016-03-24 11:49, David Palao wrote:
>> s = "(1, 2, 3, 4)"
>>
>> and I want to recover the tuple in a variable t
>>
>> t = (1, 2, 3, 4)
>>
>> how would you do ?
>
> Use "eval":
> s = "(1, 2, 3, 4)"
> t = eval(s)
Using eval() has security implications. Use ast.literal_eval for
safety instead:
On 2016-03-27 14:28, Steven D'Aprano wrote:
> > So intrigued by this question I tried the following
> > def fnc( n ):
> > print "fnc called with parameter '%d'" % n
> > return n
> >
> > for i in range(0,5):
> > if i%2 == 0:
> > fnc
> > next
> > print i
> >
>
On 2016-03-28 12:38, Chris Angelico wrote:
> I would still look askance at code that adds two things and drops
> the result, though. The compiler can't discard it, but if a linter
> complains, I'd support that. A DSL that requires you to do this is,
> imo, poorly designed.
Is it only the "*add* tw
On 2014-10-28 12:53, Ethan Furman wrote:
> dbf (also known as python dbase) is a module for reading/writing
> dBase III, FP, VFP, and Clipper .dbf database files. It's
> an ancient format that still finds lots of use
Just a little note to give thanks for all the work you put into such
an unglamo
On 2014-11-04 05:53, Fatih Güven wrote:
> > > for x in range(1,10):
> > > exec("list%d = []" % x)
> >
> > Why would you do this?
>
> I have a structured and repetitive data. I want to read a .txt file
> line by line and classified it to call easily. For example
> employee1 has a name, a salar
On 2014-11-09 02:42, satishmlm...@gmail.com wrote:
> What does description attribute in the following code mean?
>
> curs.execute('select * from people')
> colnames = [desc[0] for desc in curs.description]
http://legacy.python.org/dev/peps/pep-0249/#cursor-attributes
-tkc
--
https://mail.py
On 2014-11-10 20:08, Mark Lawrence wrote:
> On 10/11/2014 11:31, David Palao wrote:
> >> My crystal ball is currently in for repair and is not expected
> >> back in the foreseeable future.
> >
> > Without a crystal ball, this prediction might be not well founded.
> >
>
> Especially in the future w
On 2014-11-11 11:40, Peter Cacioppi wrote:
> I get the impression that most Pythonistas aren't as habituated
> with assert statements as I am. Is that just a misimpression on my
> part?
I tend to use it to catch my bone-headedness rather than actual
tests. I'm particularly fond of one that catche
On 2014-11-15 12:48, Chris Angelico wrote:
> conn = establish_database_connection()
> try:
> do_stuff()
> finally:
> conn.rollback()
this sounds suspiciously like you'd never actually commit. Do you
mean something like
conn = establisth_database_connection()
try:
do_stuff(conn)
On 2014-11-14 18:19, Richard Riehle wrote:
> Decorators are new in Python, so there are not a lot of people
> using them.
Um...they were introduced in 2.4 which was released in late 2004. So
they've only been around for about (almost exactly) a decade. Not
sure that qualifies as "new in Python"
On 2014-11-16 22:45, Abdul Abdul wrote:
> I just came across the following line of code:
>
> outputfile = os.path.splitext(infile)[0] + ".jpg"
>
> Can you kindly explain to me what those parts mean?
Have you tried them?
https://docs.python.org/2/library/os.path.html#os.path.splitext
This takes
On 2014-11-20 21:54, Dennis Lee Bieber wrote:
> VIM in one window for editing, and a bare command line for test
> execution in another (I'm sure VIM probably has a way to invoke a
> command line,
It can be done, but (without an unofficial patch) it's modal, so most
of us vi/vim users prefer to hos
On 2014-11-20 19:53, Rick Johnson wrote:
> FOR INSTANCE: Let's say i write a module that presents a
> reusable GUI calendar widget, and then i name the module
> "calender.py".
>
> Then Later, when i try to import *MY* GUI widget named
> "calendar", i will not get *MY* calendar widget, no, i will
>
On 2014-11-22 02:23, Steven D'Aprano wrote:
> LATIN SMALL LETTER E
> COMBINING CIRCUMFLEX ACCENT
>
> then my application should treat that as a single "character" and
> display it as:
>
> LATIN SMALL LETTER E WITH CIRCUMFLEX
>
> which looks like this: ê
>
> rather than two distinct "characters"
On 2014-11-21 07:52, Rick Johnson wrote:
> On Friday, November 21, 2014 4:29:48 AM UTC-6, Tim Chase wrote:
>
> > What messed-up version of Python are you running?
> > Or did you fail to test your conjecture?
> >
> > $ cat > calendar.py
> > print(
On 2014-11-22 23:25, Steven D'Aprano wrote:
> Having said that, it's not fair to blame the user for shadowing
> standard library modules:
>
> - All users start off as beginners, who may not be aware that this
> is even a possibility;
While it's one thing to explicitly shadow a module (creating yo
On 2014-11-23 12:00, Steven D'Aprano wrote:
> >> > And after all that, it would still fail if you happened to
> >> > want to import both "calendar" modules into the same module.
> >>
> >> __path__ = []
> >> import calendar
> >> __path__ = ['my/python/modules']
> >> import calendar as mycalendar
On 2014-11-24 01:33, Abdul Abdul wrote:
> Wxy**2
>
> What do ** mean here?
"to the power of", so your code squares the value of "Wxy", or "Wxy *
Wxy"
https://docs.python.org/2/reference/expressions.html#the-power-operator
-tkc
--
https://mail.python.org/mailman/listinfo/python-list
On 2014-11-25 18:18, Tim Daneliuk wrote:
> A problem for your consideration:
>
> We are given a tuple of delimiter string pairs to quote or comment
> text, possibly over multiple lines. Something like this:
>
> delims = (('"', '"'), ("'", "'"), ('#', '\n'), ("\*", "*\),
> ('\\', '\n') ...)
On 2014-11-25 19:20, Tim Daneliuk wrote:
> > hen you find any opener, you seek its
> corresponding closer, and then special-case /* to count any
> additional /* and look for a */ for each one */ .
>
> That's more or less where I was headed. I just wanted something
> less brute force :)
This se
On 2014-11-26 00:04, Tim Daneliuk wrote:
> someprog.py uname && sudo cat /etc/sudoers
>
> vs.
>
> someprog.py uname && echo "sudo cat /etc/suoders"
>
>
> In the first instance, I need the sudo passoword, in the second I
> don't.
This doesn't jibe with the pairs of quotes you sent and your requ
On 2014-11-26 15:45, Jussi Piitulainen wrote:
> Tim Chase writes:
> > bash$ echo // hello
> > hello
>
> Where did the // go?
The bad-copy-and-paste gremlins ate them :-o
Good catch. :)
-tkc
--
https://mail.python.org/mailman/listinfo/python-list
On 2014-11-26 08:58, Tim Daneliuk wrote:
> On 11/26/2014 06:56 AM, Tim Chase wrote:
> > On 2014-11-26 00:04, Tim Daneliuk wrote:
> >> someprog.py uname && sudo cat /etc/sudoers
> >>
> >> vs.
> >>
> >> someprog.py uname && ech
I've created a small application in a virtualenv and would like to
package it up as a .deb file for distribution on various
Debian/Ubuntu (and derivatives) systems.
Are there any good resources documenting this process? The biggest
issue involves using versions of modules installed via pip into m
On 2014-12-01 13:05, Larry Martell wrote:
> Is there a way to set the default_factory of defaultdict so that
> accesses to undefined keys get to set to the key?
>
> i.e. if d['xxx'] were accessed and there was no key 'xxx' then
> d['xxx'] would get set to 'xxx'
>
> I know I can define a function
On 2014-12-01 11:28, Israel Brewster wrote:
> I don't know if this is a cherrypy specific question (although it
> will be implemented in cherrypy for sure), or more of a general
> http protocol question, but when using cherrypy to serve a web app,
> is there anyway to prevent browser prefetch? I'm
On 2014-12-01 22:44, Christoph M. Becker wrote:
> Tim Chase wrote:
> > haven't investigated recently, but I remember Django's ability to
> > trigger a log-out merely via a GET was something that irked me.
> >
> > All this to also say that performing non-idemp
On 2014-12-01 16:50, Ned Batchelder wrote:
> On 12/1/14 4:26 PM, Tim Chase wrote:
>> All this to also say that performing non-idempotent actions on a
>> GET request is just begging for trouble. ;-)
>
> This is the key point: your web application shouldn't be doing
&
On 2014-12-01 13:14, Israel Brewster wrote:
> On Dec 1, 2014, at 12:50 PM, Ned Batchelder
>> The way to indicate to a browser that it shouldn't pre-fetch a
>> URL is to make it a POST request.
>
> Ok, that makes sense. The only difficulty I have with that answer
> is that to the best of my knowle
On 2014-12-02 11:41, Zachary Ware wrote:
> On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote:
> > Wouldn’t it be neat to write:
> >
> >foo == 42 or else
> >
> > and have that be an synonym for:
> >
> > assert foo == 42
> >
> > :-)
>
> Never going to happen, but I like it! Perhaps raise
>
On 2014-12-02 23:05, Dennis Lee Bieber wrote:
> > foo == 42 or else
>
> Has a PERL stink to it... like: foo == 42 or die
This actually works in Python and I occasionally use in debugging
(much like
--
https://mail.python.org/mailman/listinfo/python-list
On 2014-12-02 23:05, Dennis Lee Bieber wrote:
> > foo == 42 or else
>
> Has a PERL stink to it... like: foo == 42 or die
This statement actually works in Python and I occasionally use it
when debugging (in the same fashion as one might do printf()
debugging in C). It raises a NameError a
On 2014-12-08 19:11, Luuk wrote:
> On 8-12-2014 18:37, ishish wrote:
> >> with open(localpath, 'wb') as fl:
> >> PermissionError: [Errno 13] Permission denied: 'c:'
> >
> > I remember gloomily (haven't used windows since ages) that newer
> > Windows versions don't like users to write directly t
On 2014-12-08 18:46, alister wrote:
> on most systems that DO have a ssh server root logins are usually
> prohibited, either enable root logins (dangerous) or log in with a
> user that has permissions to do what you require. if you don't have
> access to the server then you need assistance from so
On 2014-12-08 14:10, bSneddon wrote:
> I ran into an issue setting variables from a GUI module that
> imports a back end module. My approach was wrong obviously but
> what is the best way to set values in a back end module.
>
> #module name beTest.py
>
> cfg = { 'def' : 'blue'}
>
> def printDef
To: alister
Copy: python-list@python.org
On 2014-12-08 18:46, alister wrote:
> on most systems that DO have a ssh server root logins are usually
> prohibited, either enable root logins (dangerous) or log in with a
> user that has permissions to do what you require. if you don't have
> access to
To: Luuk
Copy: python-list@python.org
On 2014-12-08 19:11, Luuk wrote:
> On 8-12-2014 18:37, ishish wrote:
> >> with open(localpath, 'wb') as fl:
> >> PermissionError: [Errno 13] Permission denied: 'c:'
> >
> > I remember gloomily (haven't used windows since ages) that newer
> > Windows vers
To: bSneddon
Copy: python-list@python.org
On 2014-12-08 14:10, bSneddon wrote:
> I ran into an issue setting variables from a GUI module that
> imports a back end module. My approach was wrong obviously but
> what is the best way to set values in a back end module.
>
> #module name beTest.py
>
On 2014-12-22 00:20, mm0fmf wrote:
> On 22/12/2014 00:10, Chris Angelico wrote:
> > Level 0: Why implement your own crypto?!?
>
> Because people who don't understand the concepts behind
> cryptography don't understand that the crypto algorithm can be open
> whilst the results of applying the algor
On 2014-12-22 19:05, MRAB wrote:
> On 2014-12-22 18:51, Mark Lawrence wrote:
> > I'm having wonderful thoughts of Michael Palin's favourite Python
> > sketch which involved fish slapping.
> >
> Well, ChrisA _has_ mentioned Pike in this thread. :-)
But you know he does it just for the halibut...
-
On 2014-12-24 11:42, Ethan Furman wrote:
> According to the docs [1] these functions should be available as of
> 2.6, yet they are missing on a 2.7, 3.2, and 3.4 install (ubuntu
> 12.10 and 14.04)
Confirming the same absence of os.lchmod and os.lchflags in 2.7 and
3.2 on Debian Stable.
tim@laptop
On 2014-12-25 08:23, Chris Angelico wrote:
>> On 2014-12-24 11:42, Ethan Furman wrote:
>>> According to the docs [1] these functions should be available as
>>> of 2.6, yet they are missing on a 2.7, 3.2, and 3.4 install
>>> (ubuntu 12.10 and 14.04)
>
> http://bugs.python.org/issue7479
Indeed it d
On 2014-12-25 17:59, Vincent Davis wrote:
> These are vintage motorcycles so the "VIN's" are not like modern
> VIN's these are frame numbers and engine number.
> I don't want to parse the page, I what a function that given a VIN
> (frame or engine number) returns the year the bike was made.
While
On 2014-12-25 19:58, Vincent Davis wrote:
> Any comment on using pyparsing VS regex
If the VIN had any sort of regular grammar (especially if it involved
nesting) then pyparsing would have value.
I defaulted to regexp (1) because it's available out of the box, and
(2) while it might be overkill,
On 2014-12-27 01:56, pfranke...@gmail.com wrote:
> I am just about setting up a project with an Raspberry Pi that is
> connected to some hardware via its GPIO pins. Reading the data
> already works perfectly but now I want to distribute it to clients
> running in the network. Hence, I have to setup
On 2014-12-27 14:28, Denis McMahon wrote:
> On Sat, 27 Dec 2014 02:52:39 +, Juan Christian wrote:
> > reply: b'550 SMTP is available only with SSL or TLS connection
> > enabled.\r\n'
> > reply: retcode (550); Msg: b'SMTP is available only with SSL or
> > TLS connection enabled.'
>
> ^^ hav
On 2014-12-29 00:34, pfranke...@gmail.com wrote:
> Am Samstag, 27. Dezember 2014 14:19:21 UTC+1 schrieb Tim Chase:
> > - do clients need to know if they missed a message? (somebody
> > disconnected from the LAN for a moment)
>
> This would be nice indeed. At least, the us
On 2014-12-29 16:11, JC wrote:
> On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote:
>
> > On Mon, Dec 29, 2014 at 9:35 AM, JC wrote:
> >> How could I get the all the records?
> >
> > This should work:
> >
> > with open('x.csv','rb') as f:
> > rdr = csv.DictReader(f,delimiter=',')
> >
On 2014-12-29 16:37, JC wrote:
> On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote:
>
> > On Mon, Dec 29, 2014 at 10:11 AM, JC
> > wrote:
> >> Do I have to open the file again to get 'rdr' work again?
> >
> > Yes, but if you want the number of records, just operate on the
> > rows list, e
On 2014-12-30 18:42, jptechnical.co.uk wrote:
> I've recently started using the logging module and wondered if
> there was a way to enumerate all the Logger objects available as a
> result of calls to "logging.getLogger(name)". Went through the docs
> and could not spot any way of doing this. Have
On 2015-01-02 21:21, Cameron Simpson wrote:
> >def unlinkFiles():
> >dirname = "/path/to/dir"
> >for f in os.listdir(dirname):
> >if re.match("^unix*$", f):
> >os.remove(os.path.join(dirname, f))
>
> That is a very expensive way to check the filename in this
> particula
On 2015-01-17 02:03, Chris Angelico wrote:
> Ideally, this should be something that can be demo'd quickly and
> easily, and it should be impressive without going into great details
> of "and see, this is how it works on the inside". So, how would you
> brag about this language?
First, I agree with
On 2015-01-17 22:18, Roy Smith wrote:
> Tell me about it. I have an E-Trade ATM card. When I first got
> it, I set it up with a 6 digit PIN. I was shocked to discover some
> time later that it actually only looks at the first 4 digits. And,
> no, I'm not talking *characters*, I'm talking *digit
On 2015-01-19 16:19, Michael Torrie wrote:
> On 01/19/2015 04:08 PM, Steven D'Aprano wrote:
> > Zachary Gilmartin wrote:
> >> Why aren't there trees in the python standard library?
> >
> > Possibly because they aren't needed? Under what circumstances
> > would you use a tree instead of a list or a
On 2015-01-21 23:35, Chris Angelico wrote:
> On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote
> > Its a bit of a nuisance that we have to write set([1,2,3]) for
> > the first
>
> Wait, what?
>
> rosuav@sikorsky:~$ python
> Python 2.7.3 (default, Mar 13 2014, 11:03:55)
> [GCC 4.7.2] on linux2
>
On 2015-01-22 00:01, Chris Angelico wrote:
> On Wed, Jan 21, 2015 at 11:55 PM, Tim Chase
>>> Looks like {1,2,3} works for me.
>>
>> That hasn't always worked:
>
> the argument's still fairly weak when it's alongside a pipe-dream
> desire to use sp
On 2015-01-22 03:34, Steven D'Aprano wrote:
> In 2009, Robert Martin gave a talk at RailsConf titled "What Killed
> Smalltalk Could Kill Ruby".
Holy pacing, Batman. Watching it at 2x leaves me wondering how much
of the stage was worn off during the presentation.
> And now it's all but dead. Why
On 2015-01-21 23:10, Grant Edwards wrote:
> I happily ignored PHP until a couple years back when we decided to
> use PHP for the web site on a small embedded Linux system.
[snip]
> I briefly considered trying to switch to Python, but the Python
> footprint is just too big...
Interesting that your
On 2015-01-24 17:28, Chris Angelico wrote:
> but this is hardly generic. There's no convenient way to give an
> argument to a decorator that says "please assign this here", short
> of using some stupid eval hack... is there?
>
> (Incidentally, for a non-generic dispatch table, a callable dict
> su
On 2015-01-24 17:21, Steven D'Aprano wrote:
> # Cobra
> def sqroot(i as int) as float
>
> # Python
> def sqroot(i:int)->float:
>
>
> Cobra's use of "as" clashes with Python. In Python, "as" is used for
> name-binding:
>
> import module as name
> with open('file') as f
> except Exception as e
>
On 2015-01-25 04:31, Steven D'Aprano wrote:
> Of course we don't have $1/3 dollar coins, but I do have a pair of
> tin-snips and can easily cut a $1 coin into three equal pieces.
I'm impressed that you can use tin-snips to cut it into exactly three
equal pieces with greater precision than the floa
On 2015-01-28 10:12, alb wrote:
> I've a document structure which is extremely simple and represented
> on a spreadsheet in the following way (a made up example):
>
> subsystem | chapter | section | subsection | subsubsec |
> A | | || |
> | f
On 2015-01-28 07:50, stephen.bou...@gmail.com wrote:
> I am using the following to open a file in its default application
> in Windows 7:
>
> from subprocess import call
>
> filename = 'my file.csv'
> call('"%s"' % filename, shell=True)
You can try
import os
filename = 'my file.csv'
os.st
On 2015-01-29 17:17, Mark Lawrence wrote:
> The author is quite clear on his views here
> https://realpython.com/blog/python/the-most-diabolical-python-antipattern/
> but what do you guys and gals think?
I just read that earlier today and agree for the most part. The only
exception (pun only pa
On 2015-02-05 08:45, Rustom Mody wrote:
> > >>> def f(a, (b, c)):
> > ... print a, b, c
>
> What the hell is that?!
> First I am hearing/seeing it.
> Whats it called?
"tuple parameter unpacking", removed in Py3
https://www.python.org/dev/peps/pep-3113/
-tkc
--
https://mail.python.org/ma
On 2015-02-05 09:08, Ian Kelly wrote:
> > Got an example where you can use a,b but not [a,b] or (a,b)?
>
> >>> def f(a, (b, c)):
> ... print a, b, c
> ...
Interesting. I knew that at one point you could do this with lambdas
but never thought to do it with regular functions. There are ti
On 2015-02-10 15:05, Skip Montanaro wrote:
> For instance, If I press and hold the "d" key, I see these choices
> (ignore the capitalization of the first letter - my mistake sending
> a text message to myself from my phone, and I can't seem to convert
> it to lower case): Đ|¦&dðď
>
> I haven't t
On 2015-02-10 19:37, Ned Deily wrote:
> On OS X, the system provides both a "Character Viewer" (which
> allows the selection of any Unicode character
Windows also provides charmap.exe which provides similar
functionality, though last I checked it, it still had the feel of a
Win3.1 app (usability w
On 2015-02-11 10:07, Dave Angel wrote:
> if there are tons of them, you do NOT want to pollute your local
> namespace with them, and should do:
>
> import mydef
>
> x = mydef.func2() # or whatever
or, if that's verbose, you can give a shorter alias:
import Tkinter as tk
root = tk.Tk()
On 2015-02-12 17:45, Gisle Vanem wrote:
> I tried using Interactive Python with a PyQt4 console:
>"IPython.exe qtconsole"
>
> But got a
>"ImportError: IPython requires PyQT4 >= 4.7, found 4.10.4"
>
> Looking at Ipython's check (in
> site-packages\IPython\external\qt.py): if QtCore.PYQT_VE
On 2015-02-12 18:37, Gisle Vanem wrote:
> Tim Chase wrote:> So the test should actually be something like
>
> >if LooseVersion(QtCore.PYQT_VERSION_STR) <
> > LooseVersion("4.10"): balk()
>
> That's exactly what they do now in IPython/utils/vers
On 2015-02-12 12:16, Ian Kelly wrote:
> >> It still becomes an issue when we get to Python 10.
> >>
> > Just call it Python X! :-)
>
> Things break down again when we get to Python XIX.
>
> >>> 'XVIII' < 'XIX'
> False
You know what this sub-thread gives me? The icks.
https://www.youtube.com/wat
On 2015-02-13 11:19, Chris Angelico wrote:
> On Fri, Feb 13, 2015 at 11:07 AM, wrote:
> > Here is an example of my problem. I have for the moment a CSV
> > file named "Stars" saved on my windows desktop containing around
> > 50.000 different links that directly starts downloading a xls
> > file w
On 2015-02-13 12:20, Ben Finney wrote:
> > Not sure why this is "ridiculous".
>
> Right, versions are effectively a special type [0], specifically
> *because* they intentionally don't compare as scalar numbers or
> strings. It's not “ridiculous” to need custom comparisons when
> that's the case.
>
On 2015-02-19 05:32, Mark Lawrence wrote:
> On 19/02/2015 00:08, Mario Figueiredo wrote:
> > Parameterized queries is just a pet peeve of mine that I wish to
> > include here. SQLite misses it and I miss the fact SQLite misses
> > it. The less SQL one needs to write in their code, the happier
> > o
On 2015-02-19 15:04, Mark Lawrence wrote:
> On 19/02/2015 14:17, Tim Chase wrote:
>>>> Parameterized queries is just a pet peeve of mine that I wish to
>>>> include here. SQLite misses it and I miss the fact SQLite misses
>>>> it. The less SQL one needs to wr
On 2015-02-18 20:05, ru...@yahoo.com.dmarc.invalid wrote:
> Sqlite offers concurrent access already.
> What Sqlite doesn't offer is high performance concurrent write
> access. That is, it locks the entire database for the duration
> of a write operation. Given that most such operations are pre
601 - 700 of 2407 matches
Mail list logo