On Sat, 23 Jul 2016 01:21 am, justin walters wrote:
> That should illustrate why. This is because simply typing '{}' could be
> interpreted as
> either a dict or a set.
No. {} is always an empty dict. That is a language guarantee. Any
programming language where {} is not an empty disk is not val
On 2016-07-22 16:41, D'Arcy J.M. Cain wrote:
On Fri, 22 Jul 2016 08:21:17 -0700
justin walters wrote:
You could also replace that line with:
if stock is None or type(stock) != dict:
Use isinstance(). That handles classes that subclass dict as well.
If you're checking that it's a dict,
On Fri, 22 Jul 2016 08:21:17 -0700
justin walters wrote:
> You could also replace that line with:
>
> if stock is None or type(stock) != dict:
Use isinstance(). That handles classes that subclass dict as well.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@
On Fri, Jul 22, 2016, at 11:21, justin walters wrote:
> Try opening the interactive terminal on your command line and type the
> following:
>
> type({}) == dict()
>
> That should illustrate why.
That doesn't illustrate anything relevant at all. The reason this is
false is because dict() is
On Sat, Jul 23, 2016 at 1:21 AM, justin walters
wrote:
> Hi Chris,
>
> Try opening the interactive terminal on your command line and type the
> following:
>
> type({}) == dict()
>
> That should illustrate why. This is because simply typing '{}' could be
> interpreted as
> either a dict or a se
On Fri, Jul 22, 2016 at 6:24 AM, Chris Angelico wrote:
> On Fri, Jul 22, 2016 at 11:13 PM, Dennis Lee Bieber
> wrote:
> > Now... Going much beyond the assignment (if you were having
> trouble
> > with the assignment, this will seem like magic) [Python 2.7]:
>
> I'm not sure, but I think
On Fri, Jul 22, 2016 at 11:13 PM, Dennis Lee Bieber
wrote:
> Now... Going much beyond the assignment (if you were having trouble
> with the assignment, this will seem like magic) [Python 2.7]:
I'm not sure, but I think your code would become Py3 compatible if you
just change your prints.
having a little trouble with defining functions. i have a doc called ch5.py and
when i was trying the following i had issues
"
Try It Out: Defining a Function
Try saving the following in your file for Chapter 5, ch5.py.def in_fridge():
try:
count = fridge[wanted
Andre P.S Duarte wrote:
> How do I define a function, then import it, without having to save it
> in lib; like "C:\python25\lib". ?
>
The best way I have found (in windows ) for permanently extending your
search path for modules is to create the file:
package.pth
and put your path/s in a line
On Apr 5, 12:38 pm, "Andre P.S Duarte" <[EMAIL PROTECTED]>
wrote:
> How do I define a function, then import it, without having to save it
> in lib; like "C:\python25\lib". ?
...or permanently set your PYTHONPATH environment variable to the
folders you want python to look in for the modules you imp
On Apr 5, 1:38 pm, "Andre P.S Duarte" <[EMAIL PROTECTED]>
wrote:
> How do I define a function, then import it, without having to save it
> in lib; like "C:\python25\lib". ?
Defining a function:
def someFunc():
# do something here
Save the file some place. Import the sys module BEFORE you imp
How do I define a function, then import it, without having to save it
in lib; like "C:\python25\lib". ?
--
http://mail.python.org/mailman/listinfo/python-list
westymatt wrote:
> I am fairly new to python and I want to put alot of my functions in
> another python file and import or from it into my script so I can call
> the functions. How is this done?
>
What you are describing are modules. The Python Tutorial has some
information on this
http://docs.
westymatt schrieb:
> I am fairly new to python and I want to put alot of my functions in
> another python file and import or from it into my script so I can call
> the functions. How is this done?
import myfilefullofusefulfunctionsandclasses
Works if you have the file
myfilefullofusefulfuncti
I am fairly new to python and I want to put alot of my functions in
another python file and import or from it into my script so I can call
the functions. How is this done?
--
http://mail.python.org/mailman/listinfo/python-list
15 matches
Mail list logo